An astronomical body's Hill sphere is the region in which it dominates the attraction of satellites. To be retained by a planet, a moon must have an orbit that lies within the planet's Hill sphere. That moon would, in turn, have a Hill sphere of its own. Any object within that distance would tend to become a satellite of the moon, rather than of the planet itself.
In more precise terms, the Hill sphere approximates the gravitational sphere of influence of a smaller body in the face of perturbations from a more massive body. It was defined by the American astronomer George William Hill, based upon the work of the French astronomer Édouard Roche. For this reason, it is also known as the Roche sphere (not to be confused with the Roche limit). The Hill sphere extends between the Lagrangian points L1 and L2, which lie along the line of centers of the two bodies. The region of influence of the second body is shortest in that direction, and so it acts as the limiting factor for the size of the Hill sphere. Beyond that distance, a third object in orbit around the second (e.g. Jupiter) would spend at least part of its orbit outside the Hill sphere, and would be progressively perturbed by the tidal forces of the central body (e.g. the Sun), eventually ending up orbiting the latter.
Formula and examples 
If the mass of the smaller body (e.g. Earth) is m, and it orbits a heavier body (e.g. Sun) of mass M with a semi-major axis a and an eccentricity of e, then the radius r of the Hill sphere for the smaller body (e.g. Earth) is, approximately
When eccentricity is negligible (the most favourable case for orbital stability), this becomes
In the Earth example, the Earth (5.97×1024 kg) orbits the Sun (1.99×1030 kg) at a distance of 149.6 million km. The Hill sphere for Earth thus extends out to about 1.5 million km (0.01 AU). The Moon's orbit, at a distance of 0.384 million km from Earth, is comfortably within the gravitational sphere of influence of Earth and it is therefore not at risk of being pulled into an independent orbit around the Sun. All stable satellites of the Earth (those within the Earth's Hill sphere) must have an orbital period shorter than 7 months.
The previous (eccentricity-ignoring) formula can be re-stated as follows:
This expresses the relation in terms of the volume of the Hill sphere compared with the volume of the second body's orbit around the first; specifically, the ratio of the masses is three times the ratio of the volume of these two spheres.
A quick way of estimating the radius of the Hill sphere comes from replacing mass with density in the above equation:
where and are the densities of the primary and secondary bodies, and and are their radii. The second approximation is justified by the fact that, for most cases in the Solar System, happens to be close to one. (The Earth–Moon system is the largest exception, and this approximation is within 20% for most of Saturn's satellites.) This is also convenient, since many planetary astronomers work in and remember distances in units of planetary radii.
True region of stability 
The Hill sphere is only an approximation, and other forces (such as radiation pressure or the Yarkovsky effect) can eventually perturb an object out of the sphere. This third object should also be of small enough mass that it introduces no additional complications through its own gravity. Detailed numerical calculations show that orbits at or just within the Hill sphere are not stable in the long term; it appears that stable satellite orbits exist only inside 1/2 to 1/3 of the Hill radius. The region of stability for retrograde orbits at a large distance from the primary, is larger than the region for prograde orbits at a large distance from the primary. This was thought to explain the preponderance of retrograde moons around Jupiter, however Saturn has a more even mix of retrograde/prograde moons so the reasons are more complicated.
Further examples 
An astronaut could not orbit the Space Shuttle (with mass of 104 tonnes), where the orbit is 300 km above the Earth, since the Hill sphere of the shuttle is only 120 cm in radius, much smaller than the shuttle itself. In fact, in any low Earth orbit, a spherical body must be 800 times denser than lead in order to fit inside its own Hill sphere, or else it will be incapable of supporting an orbit. A spherical geostationary satellite would need to be more than 5 times denser than lead to support satellites of its own; such a satellite would be 2.5 times denser than osmium, the densest naturally-occurring material on Earth. Only at twice the geostationary distance could a lead sphere possibly support its own satellite; since the Moon is more than three times further than the 3-fold geostationary distance necessary, lunar orbits are possible.
Within the Solar System, the planet with the largest Hill radius is Neptune, with 116 million km, or 0.775 AU; its great distance from the Sun amply compensates for its small mass relative to Jupiter (whose own Hill radius measures 53 million km). An asteroid from the asteroid belt will have a Hill sphere that can reach 220 000 km (for 1 Ceres), diminishing rapidly with its mass. The Hill sphere of (66391) 1999 KW4, a Mercury-crosser asteroid that has a moon (S/2001 (66391) 1), measures 22 km in radius.
A typical extrasolar "hot Jupiter", HD 209458 b has a Hill sphere of radius (593,000 km) about 8 times its physical radius (approx 71,000 km). Even the smallest close-in extrasolar planet, CoRoT-7b still has a Hill sphere radius (61,000 km) 6 times greater than its physical radius (approx 10,000 km). Therefore these planets could have small moons close in.
A non-rigorous but conceptually accurate derivation of the Hill radius can be made by equating the orbital angular speed of the orbiter around a body (i.e. a planet) and the orbital angular speed of that planet around the host star. This is the radius at which the gravitational influence of the star roughly equals that of the planet.
where is the Hill radius, a is the semi-major axis of the planet orbiting the star. With some basic algebra:
giving a Hill radius of:
Solar System 
The following plot shows the Hill radius (in km) of some bodies of the Solar System:
See also 
- D.P. Hamilton & J.A. Burns (1992). "Orbital stability zones about asteroids. II - The destabilizing effects of eccentric orbits and of solar radiation". Icarus 96 (1): 43. Bibcode:1992Icar...96...43H. doi:10.1016/0019-1035(92)90005-R.
- Astakhov, Sergey A.; Burbanks, Andrew D.; Wiggins, Stephen & Farrelly, David (2003). "Chaos-assisted capture of irregular moons". Nature 423 (6937): 264–267. Bibcode:2003Natur.423..264A. doi:10.1038/nature01622. PMID 12748635.
- HD 209458 b
- CoRoT-7 b