Steven from City of Sunderland College sent us in a wonderful, complete solution to this problem, which we recommend reading in full to any budding problem solver. The main points are as follows:

The gravitational potential energy of a cannon ball of mass $m$ at a distance $r$ from the centre of a planet of mass $M$ is

$$

V = -\frac{GMm}{r}\;.

$$

The kinetic energy of a cannon ball launched at speed $v$ is

$$

KE = \frac{1}{2}mv^2\;.

$$

Suppose that a cannon ball just escapes the pull of a planet and makes it to infinity. At this point, both its potential and kinetic energies will be zero. Thus, the initial kinetic and potential energies must sum to zero. So, if launched from a planet of radius $R$ we must have

$$

\frac{GMm}{R} = \frac{1}{2}mv^2\;.

$$

This gives the escape velocity $v$ as

$$

v =\sqrt{\frac{2GM}{R}}\;.

$$

Putting in the numbers for Earth gives

$$

v=\sqrt{\frac{2\times 6.674\times 10^{-11}\times 5.9763\times 10^{24}}{6.378\times 10^6}}=11.2\textrm{ km s}^{-1}\;.

$$

For the moon, Jupiter and the sun the escape velocity changes by the relative change in the factor $\sqrt{\frac{M}{R}}$. For the moon, Jupiter and the sun these are $0.2122$, $5.32$ and $55.26$, giving rise to escape velocities of

Moon: $2.37\textrm{ km s}^{-1}$,

Jupiter: $59.5\textrm{ km s}^{-1}$,

Sun: $619\textrm{ km s}^{-1}$.