= Solution
A <gravitational assist> changes a spacecraft's <velocity> relative to the Sun by scattering it in the <gravitational field> of a moving planet. In the planet's rest frame, ignore other <forces> during the encounter and take the spacecraft <mass> negligible. The incoming and outgoing asymptotic <velocities> have equal magnitude,
$$
|\mathbf u_{\rm in}|=|\mathbf u_{\rm out}|=u_\infty,
$$
because the encounter is conservative, but their directions differ along a hyperbolic <orbit>. If the planet has approximately constant heliocentric <velocity> $\mathbf V_p$, the heliocentric spacecraft <velocities> are $\mathbf v_{\rm in,out}=\mathbf V_p+\mathbf u_{\rm in,out}$. Its specific <energy> change is
$$
\boxed{\Delta\mathcal E=\frac12(v_{\rm out}^2-v_{\rm in}^2)
=\mathbf V_p\cdot(\mathbf u_{\rm out}-\mathbf u_{\rm in}).}
$$
Thus a flyby can increase or decrease heliocentric <energy> depending on its geometry. The planet exchanges <momentum> and orbital <energy> with the spacecraft; its <speed> change is extremely small because its <mass> is much greater. There is no <energy> creation and no increase of asymptotic <speed> in the planet's own frame.
For a point-mass planet, <conservation of energy> and <angular momentum> gives the hyperbolic eccentricity and deflection angle
$$
e=1+\frac{r_pu_\infty^2}{GM_p},\qquad
\delta=2\sin^{-1}(1/e),
\qquad \tan\frac\delta2=\frac{GM_p}{b u_\infty^2},
$$
where $r_p$ is <periapsis> distance and $b$ the <impact parameter>. The velocity-vector change has magnitude $2u_\infty\sin(\delta/2)$, so the maximum energy-change magnitude for this fixed deflection is $2V_pu_\infty\sin(\delta/2)$. A small <periapsis> increases the turning angle, but <collision>, atmosphere and <tidal forces> limit how close a real spacecraft may pass. Multiple encounters allow large changes without expending the propellant that equivalent direct <velocity> changes would require.
Back to article page