This answer addresses the additional questions in Salah's comment:
I am using a 12V battery to power my motors and the ground of the battery is linked to the ground of my motor driver then mounted onto the arduino. So you mean i must use 3.3K resistors and connect them to the SDA and SCL pins on the MPU6050??to prevent any oscillations affecting the sensor is that right ?
The MPU-6050 will work ok with Vdd = 3.3 V. More specifically, page 14 of the 1788002.pdf datasheet for MPU-6000/MPU-6050 products shows
VDD = 2.375V-3.46V, VLOGIC (MPU-6050 only) = 1.8V±5% or VDD, TA = 25°C
The wiring diagram on page 39 shows SDA and SCL being pulled up to VLOGIC (which is either 1.8 V or VDD, say 3.3 V).
One suitable choice would be to operate an 8 MHz Mega and the 6050 at 3.3 V and pull SDA and SCL up to 3.3 V via 3.3 KΩ resistors.
Another choice would be to operate a 16 MHz Mega at 5 V, operate the 6050 at 3.3 V, pull SDA and SCL up to 3.3 V via 3.3 KΩ resistors, and use 3.3V/5V level translations on SDA and SCL into the Mega.
Built-in pullups for I/O pins on Mega2560 and similar devices are spec'd at 20 KΩ min, 50 KΩ max, so will provide less restoring current when a device releases a pin, than will a 3.3 KΩ resistor, and thus may be less noise-resistant or operate less speedily.
The important issues for your power wiring are these:
1, Isolate the motor drive and logic drives. They can use the same ground point but motor current should not be running through the ground lead or leads that connect to the Arduino and the MPU-6050. And use decoupling capacitors as necessary.
2, Power the MPU-6050 with 3.3 V or less; pull up SDA and SCL to that level via 3.3 KΩ resistors; use level translators if the Mega operates at a different voltage than the MPU-6050.
Edit: About Grounding – For a detailed discussion, see Staying Well Grounded, an analog.com article. For overviews, see Star Grounding at lh-electric.net, or at wikipedia, Ground Noise, Ground Bounce, and Ground (electricity) Electronics. By “motor current should not be running through the ground lead or leads that connect to the Arduino and the MPU-6050” I refer to the use of separate wires for conducting ground current. Typically, this will matter only if your motor current is high or noisy. The idea is to have a heavy wire from the ground post of the battery to the motors, and a separate wire from the ground post of the battery to the Arduino and the MPU-6050. Voltage across a wire changes as current in the wire changes. Using separate ground wires, the Arduino and the MPU-6050 are less affected by ground wire voltage changes caused by motor current.