There is a web site at the Jet Propulsion Laboratory that gives the basics of gravity-assist trajectories. To really follow the step by step details you have to go through the actual physics of the encounter. As the JPL guide notes, the spacecraft extracts angular momentum from Jupiter from the frame of reference of the sun, even though its ingoing and outgoing speeds are the same as it enters and leaves the gravity well of the planet which is symmetric in space. Here in the top panel, is the view of the spacecraft motion with respect to the stationary planet. In other words, you are orbiting the sun at the same speed as the planet and watching the spacecraft:
When you view the physics from the stand point of the sun in the lower panel (and this is the body that the spacecraft is really trying to work against to go deeper into the solar system), the spacecraft enters the planets sphere of influence, and gains varrying amounts of its orbital speed depending on how deeply it penetrates the planets gravity well. The orbital speed of Jupiter, for example, is 13 kilometers/sec so the satellite can easily gain a velocity of 13 x .64 x 3600 = 30,000 miles/hour. Below is a graph showing the velocity boosts the Voyager 2 actually got:
Note how the satellite speed decreased between encounters as it exchanged kinetic energy for gravitational potential energy in the sun's gravity field. In the end, it was boosted to nearly 6 times the solar systems escape speed, and that's why it is currently an interstellar spacecraft. In fact, its boost at Jupiter was more than enough to give it escape speed.
Return toAsk the Astronomer