Potential energy of the spaceship due to the gravitational attraction of the Sun is given by,
Where,
Potential energy of the spaceship due to the gravitational attraction of Mars is given by,
Where,
Total potential energy of the spaceship is given as,
Energy required for launching the spaceship out of the solar system is equal to the total energy of the spaceship.
By substituting the given values in the above expression, we get
Thus, the energy required for launching the spaceship out of the solar system is