When a spacecraft travels to the outer solar system it picks up speed by using the gravity of planets along the way. In fact they sometimes would whizz by the earth a few times to pick up speed before continuing their journey. It does work, but I don't understand how it can work.
Suppose a spacecraft is heading to saturn. It approaches jupiter and gradually picks up speed as it nears the planet. However, as it pulls away from jupiter it must now fight the gravity of jupiter which would slow it down. Give the "conservation of energy" and that the distances approaching and leaving the planet are the same, how can the space craft gain energy?
In addition, these spacecraft normally change direction which would use enegy.