A spacecraft which is moving with a speed u relative to the earth in the x-direction, enters the gravitational field of a much more massive planet which is moving with a speed 3u in the negative x-direction. The spacecraft exits following the trajectory as shown below.
The speed of the spacecraft with respect to the earth a long time after it has escaped the planet's gravity is given by