All posts
25 min read

My favourite theorem

Is it a hidden assumption you make?


Whenever you hear about gravitational force between two objects of mass MM and mm, you are told it follows the law:

F=GMmr2F = \frac{GMm}{r^2}

where GG is the gravitational constant and rr the distance between the centres of the two objects. Interestingly, you can apply this to large scale objects too, not only particles: the Moon’s orbit around Earth, Earth’s orbit around the Sun, the acceleration of a satellite or gravity at your feet.a

Isn’t it weird that it explodes as r0r\to0 ? Do you really accelerate more and more as you get to the center of the planet? Of course you go faster and faster, but not only that, the acceleration itself increases more and more?

Another problem is that, whether we refer to the Moon, Earth or Sun, these are giant balls, yet when we refer to their gravity, all that matters is their total mass and the distance to their centre. It’s as if we treat them as points with mass instead of taking their geometry into account. Doesn’t size matter?

Take gravity at your feet - certainly a rock under your feet pulls you more strongly than a rock in Australia 12,000 km away. Or in the case of Moon’s orbit around Earth - certainly the bit of Earth closer to the Moon is pulling it more than the opposite side of the planet. Whether the planet is bigger or smaller, if total mass is the same, what changes in gravity?

Is the formula an approximation? How exact if so?

Spoiler: the formula is exact and the mess averages out perfectly to treating big objects as if only their centre mattered. And the reason is my favourite theorem - the shell theorem - originally proved by Newton in the Principia (1687).1


The shell theorem

Assume gravity between two point masses m1m_1 and m2m_2 that are rr distance apart takes the form F=Gm1m2r2F=\frac{Gm_1m_2}{r^2}.

Take a thin spherical hollow shell of radius RR and total mass MM, spread uniformly, with each piece attracting via 1/r21/r^2. Then for a test mass at distance rr from the centre1 2:

  1. Outside (r>Rr > R): the force is exactly GMm/r2GMm/r^2, as if all of MM sat at the centre.
  2. Inside (r<Rr < R): the force is exactly zero. Everywhere inside. Not just at the centre.

Corollary - from shell to sphere

What we really want is the gravity over a sphere, not a hollow shell. But any spherically symmetric body - a planet, a star - is a stack of thin shells, and the theorem extends immediately by interpreting a sphere as a sum of shells.

  • From the outside, every shell acts as a point at the common centre, so the whole body together also pulls exactly like a point at the centre carrying its total mass: if each shell ii at radius rir_i has a mass MiM_i; then a test mass mm feels the force Fi=GMim/r2F_i = G M_i m / r^2 from each, which add to:

    F=iFi=iGMimr2=Gmr2iMi=GMtotmr2F = \sum_i F_i = \sum_i \frac{G M_i \, m}{r^2} = \frac{Gm}{r^2}\sum_i M_i = \frac{G M_{\text{tot}} \, m}{r^2}

    with MtotM_{\text{tot}} the body’s total mass.

  • Standing inside the body at radius rr, every shell above you (ri>rr_i > r) does not affect you, and every shell below you (ri<rr_i < r) acts as a central point - writing M(r)=ri<rMiM(r) = \sum_{r_i < r} M_i for the mass interior to radius rr:

    F(r)=GM(r)mr2F(r) = \frac{G M(r)\, m}{r^2}

    In the continuum limit of infinitely thin shells, a shell at radius rr' with thickness drdr' carries mass dM=ρ(r)4πr2drdM = \rho(r')\, 4\pi r'^2\, dr' - the body’s density ρ(r)\rho(r') at that radius, times the shell’s area 4πr24\pi r'^2, times its thickness. The sum becomes an integral, and the force takes the form:

    F(r)=4πGmr20rρ(r)r2drF(r) = \frac{4\pi G m}{r^2} \int_0^r \rho(r')\, r'^2\, dr'

    For the simplest case of constant density ρ\rho, the integral is 0rρr2dr=ρr3/3\int_0^r \rho\, r'^2\, dr' = \rho\, r^3/3, giving

    F(r)=4πGρm3r=GMtotmR3rF(r) = \frac{4\pi G \rho\, m}{3}\, r = \frac{GM_{tot}m}{R^3}r

    where RR is the radius of the sphere and Mtot=43πR3ρM_{tot} = \frac{4}{3}\pi R^3 \rho.

We then conclude that inside a uniform body, the force doesn’t explode as you go to the center, but instead it grows linearly with the distance from the centre as only the mass beneath your feet counts**. Outside of it, it decreases with the usual inverse-square law where the whole sphere can be treated like a point mass.**


The simple proof

The fastest route is Gauss’s law. Write MencM_{\text{enc}} for the total mass enclosed by a closed surface, and let F(r)\vec{F}(\vec{r}) be the gravitational force our test mass mm would feel if placed at the point r\vec{r} from the origin. From Gauss’s law, the flux of F\vec{F} through that surface - a purely geometric quantity defined below - satisfies

FdA=4πGmMenc\oint \vec{F} \cdot d\vec{A} = -4\pi G \, m \, M_{\text{enc}}

whatever the shape of the surface: only the mass inside counts, and everything outside is invisible for the flux. This is not physics but a mathematical property of 1/r21/r^2 vector fields.

Gauss's law: another quick proof

Gauss’s law is a statement that the flux of an inverse-square law field over any closed surface reduces to the sum of the internal sources.

To see why, take a radial vector field of a point source of strength kk sitting at the origin,

F(r)=kr2r^\vec{F}(\vec{r}) = \frac{k}{r^2}\,\hat{r}

where r^=r/r\hat{r} = \vec{r}/r is the unit vector pointing radially away from the origin: at every point the field aims straight outward, with strength k/r2k/r^2.

The flux of a vector field through a surface measures how much of it “pokes through”: for a small flat patch of area dAdA, it is the component of the field perpendicular to the patch, times the area,

dΦ=FcosαdA=FdAd\Phi = F \cos\alpha \, dA = \vec{F}\cdot d\vec{A}

where α\alpha is the angle between the field and the patch’s normal. A patch face-on to the field catches everything (cosα=1\cos\alpha = 1); a patch edge-on catches nothing (cosα=0\cos\alpha = 0). For a whole surface, add up the patches over the surface: Φ=FdA\Phi = \oint \vec{F}\cdot d\vec{A}.

Now compute the flux of F\vec{F} through any closed surface around the origin. Chop the surface, which spans a total solid angle of 4π4\pi, into small patches using thin cones drawn from the origin: a cone of solid angle dΩd\Omega (the 3D opening angle of the cone) hits a patch at distance rr, tilted by α\alpha, so its area is dA=r2dΩ/cosαdA = r^2\, d\Omega / \cos\alpha. Its flux:

dΦ=kr2cosαperpendicular fieldr2dΩcosαarea=kdΩd\Phi = \underbrace{\frac{k}{r^2}\cos\alpha}_{\text{perpendicular field}} \cdot \underbrace{\frac{r^2\, d\Omega}{\cos\alpha}}_{\text{area}} = k \, d\Omega

Everything cancels: the r2r^2 of the patch area eats the 1/r21/r^2 of the field, and the tilt drops out too. Each patch contributes according to the solid angle it covers, not how far away it sits, not how tilted it is. Only 1/r21/r^2 fields carry a constant flux.

Now we can add up the patches. If the surface encloses the origin (i.e. the source point is inside the surface), the source sees the full solid angle 4π4\pi around it, so the total flux is 4πk4\pi k - for any surface, any shape, any position of the source inside. If the surface doesn’t enclose the origin (the source point is outside), its flux is zero: every infinitesimal cone from the origin that enters the surface must also exit, and the entering and exiting patches carry the same kdΩk\,d\Omega flux with opposite orientations.

Finally, go from one point source to many. Given a collection of point sources labelled ii, each of strength kik_i at various positions - some inside our closed surface, some outside. The total field is the sum of the individual point-source fields, F=iFi\vec{F} = \sum_i \vec{F}_i, and the flux integral over the surface distributes over that sum:

FdA=(iFi)dA=iFidA\oint \vec{F} \cdot d\vec{A} = \oint \Big(\sum_i \vec{F}_i\Big) \cdot d\vec{A} = \sum_i \oint \vec{F}_i \cdot d\vec{A}

Every term in the last sum is a single-source flux we have already computed: it equals 4πki4\pi k_i if the point source ii sits inside the surface, and 00 when it sits outside. The outside sources drop out of the sum, the inside ones pile up, and we are left with

FdA=4πi insideki\oint \vec{F} \cdot d\vec{A} = 4\pi \sum_{i\ \text{inside}} k_i

That is Gauss’s law: the total flux of a 1/r21/r^2 field through a closed surface is 4π4\pi times the summed strength of the point sources it encloses.1 2

For gravity specifically, all we do is pick the field strength ki=Gmimk_i = -Gm_im, for each mass element mim_i of the attracting body acting as a point source, and the sum of strengths inside a surface is GmMenc-G\, m\, M_{\text{enc}}.

Why do we care about this flux? Because specifically for spherical symmetry, in a spherical shell, the field F\vec{F} must be radial and have the same strength F(r)F(r) on the whole surface, F=F(r)r^\vec{F}=F(r)\hat{r}, where r^=r/r\hat{r} = \vec{r}/r is the unit vector pointing radially away from the origin (length 1, direction of the position vector r\vec{r}). Hence we can simplify the flux to:

FdA=F(r) r^dA=F(r)r2dΩ=4πr2F(r)\oint \vec{F} \cdot d\vec{A} = \oint F(r)\ \hat{r}\cdot d\vec{A} = F(r) \oint r^2 d\Omega = 4\pi r^2 F(r)

Putting both things together:

4πr2F(r)=4πGmMencF(r)=GmMencr24\pi r^2F(r) = -4\pi G\, m\, M_{\text{enc}} \quad\Rightarrow\quad F(r) = -\frac{G\, m\, M_{\text{enc}}}{r^2}
  • If r<Rr < R: the sphere encloses nothing, Menc=0M_{\text{enc}} = 0, so F=0F = 0.
  • If r>Rr > R: it encloses the whole shell, Menc=MM_{\text{enc}} = M, so F=GMmr2F = -\frac{GMm}{r^2}.

Proving it the hard way

Gauss’s law can feel like a magic trick, so here is the long integral proof.

Outside the shell

The shell has uniform density σ\sigma and mass M=4πR2σM = 4\pi R^2\sigma.

Slice the shell into rings at polar angle θ\theta from the axis pointing to the test mass. A ring has mass dm=(2πRsinθ) (R dθ) σ=M2sinθdθdm = (2\pi R \sin{\theta})\ (R\ d\theta)\ \sigma = \frac{M}{2}\sin\theta \, d\theta and all of it sits at the same distance ss from the test point, with

s2=(Rsinθ)2+(rRcosθ)2=R2+r22Rrcosθs^2 = (R\sin{\theta})^2 + (r-R\cos{\theta})^2 = R^2 + r^2 - 2Rr\cos\theta

By symmetry, the sideways forces cancel and only the component along the axis survives. The force from the ring element makes an angle φ\varphi with the axis, with cosφ=(rRcosθ)/s\cos\varphi = (r - R\cos\theta)/s, so the total radial force on a test mass mtm_t is

F=Gmtdms2cosφ=GmtM20π(rRcosθ)sinθdθs3F = \int \frac{G m_t \, dm}{s^2}\cos\varphi = \frac{G m_t M}{2}\int_0^\pi \frac{(r - R\cos\theta)\sin\theta \, d\theta}{s^3}

Now trade θ\theta for ss: differentiating s2=R2+r22Rrcosθs^2 = R^2 + r^2 - 2Rr\cos\theta gives s ds=Rrsinθdθs\ ds = Rr \sin\theta \, d\theta, and solving it for cosθ\cos\theta gives rRcosθ=s2+r2R22rr - R\cos\theta = \frac{s^2 + r^2 - R^2}{2r}. With the test mass outside, ss runs from the nearest point of the shell, rRr - R, to the farthest, r+Rr + R, and the integral is:

F=GmtM2rRr+Rs2+r2R22Rr2s2 ds=GmtM4Rr2rRr+R(1+(rR)(r+R)s2)ds=    =GmtM4Rr2[s(rR)(r+R)s]rRr+R=GmtM4Rr2(2R+2R)=GmtMr2F = \frac{G m_t M}{2}\int_{r-R}^{\,r+R} \frac{s^2 + r^2 - R^2}{2Rr^2s^2} \ ds = \frac{G m_t M}{4Rr^2}\int_{r-R}^{\,r+R} \left(1 + \frac{(r-R)(r+R)}{s^2}\right) ds =\\ \ \ \ \ = \frac{G m_t M}{4Rr^2}\left[s - \frac{(r-R)(r+R)}{s}\right]_{r-R}^{\,r+R} = \frac{G m_t M}{4Rr^2} (2R + 2R) = \frac{G m_t M}{r^2}

The point-mass force, exactly.2

Inside the shell

The setup above assumed r>Rr > R. If we move the test mass inside, all that changes is the integration limits: the nearest point of the shell is now RrR - r away, the farthest still r+Rr + R. Same integral, new bounds:

F=GmtM4Rr2[s(rR)(r+R)s]Rrr+R=GmtM4Rr2(2R2R)=0F = \frac{G m_t M}{4Rr^2}\left[s - \frac{(r-R)(r+R)}{s}\right]_{R-r}^{\,r+R} = \frac{G m_t M}{4Rr^2}(2R - 2R) = 0

Zero, everywhere inside.2

Inside the shell - Newton’s proof

As an alternative proof for the inside zero force, here is Newton’s own argument.1 Stand at any point PP inside the shell. Draw a thin double cone through PP with solid angle dΩd\Omega (its 3D opening angle): it cuts two patches on the shell, one at distance r1r_1, the other at r2r_2 on the opposite side. A chord of a circle meets the circle at equal angles at both ends, so both patches have the same tilt α\alpha, and their areas are

dAi=ri2dΩcosαdA_i = \frac{r_i^2 \, d\Omega}{\cos\alpha}

The mass of each patch is σdAi\sigma\, dA_i, and they pull with force

dFi=GmtσdAiri2=GmtσdΩcosαdF_i = \frac{G m_t \sigma \, dA_i}{r_i^2} = \frac{Gm_t\sigma \, d\Omega}{\cos\alpha}

The ri2r_i^2 cancel: the nearer patch pulls harder per unit mass, but the farther patch is bigger by exactly the same factor. Every cone cancels pairwise, and the total force is zero.


Examples

  1. Gravity: we’ve already concluded that taking the Earth, Moon or Sun as a point mass is not merely a good enough approximation, it’s an exact result for spherical bodies.

    One interesting application of this is computing the travel time from one side of the planet to the other side. It has a surprising answer that this post discusses.

    Another interesting note is that we know that Earth is not perfectly spherical, and hence its slight oblate shape leads to a small correction. Gravity on the surface can vary from place to place, but for planetary distances, such as the Moon, the correction is smaller than 1 part per million.9 11

  2. The dark matter enigma. For a star on a circular orbit at radius rr around the center of a galaxy, with a roughly spherical mass distribution, the centripetal acceleration is ar=v2ra_r = \frac{v^2}{r}, and the shell theorem gives ar=v2r=GM(r)r2a_r = \frac{v^2}{r} = \frac{GM(r)}{r^2}. So, if you measure the rotation speed of a star, you can estimate M(r)=v2rGM(r) = \frac{v^2r}{G} - the mass of everything interior to radius rr.

    We observe that visible matter falls with distance, and given v(r)=GM(r)rv(r)=\sqrt{\frac{GM(r)}{r}}, we should expect the speed of rotation to drop close to 1/r1/\sqrt{r}. YET, empirical observations show that rotation speed stays approximately constant as distance increases, meaning there is some invisible matter at large distances keeping the mass bigger and the speeds constant. The real deal is a lot more complex, but this is roughly the key piece of evidence for dark matter.5

  3. Einstein’s relativity. The gravitational force 1/r21/r^2 we’ve been discussing is a Newtonian approximation. In general relativity, gravity is curvature of spacetime. Yet, without fully explaining why, it holds a similar theorem called Birkhoff’s theorem which states a similar result: in vacuum and spherical symmetry, outside a star the spacetime solution is exactly the same as a point black hole with mass the same as the star. Even if the star is collapsing inwards or pulsating, the outside doesn’t notice.3 Similarly, in general relativity, inside a hollow shell, the spacetime solution is purely flat vacuum space - the equivalent of “zero forces inside”.4

  4. An electrically charged shell: electric forces also decay with 1/r21/r^2. Hence, the same conclusions apply: swap Gmq/4πε0Gm \to q/4\pi\varepsilon_0 and the theorem says the electric field inside a uniformly charged shell is exactly zero, and outside it is the field of a point charge QQ at the centre that equals the total charge of the shell.

    It is tempting to confuse this with the Faraday cage effect, which says that any conductive metal enclosure blocks all external electromagnetic radiation on the inside. This is actually a trap and this effect is due to another reason: charges in the metal are free to move into highly non-uniform shapes that mold to the external field and leave the inside with constant potential (and hence no electric field). This is a different effect from the fixed uniform charged shell effect derived from the shell theorem.10

  5. Half of Maxwell’s equations. In electromagnetism, Gauss’s law gets promoted to fundamental law of nature: EdA=Qenc/ε0\oint \vec{E} \cdot d\vec{A} = Q_{\text{enc}}/\varepsilon_0, with E\vec{E} the electric field and QencQ_{\text{enc}} the enclosed charge, is one of the four Maxwell equations.8 Its magnetic sibling is another: BdA=0\oint \vec{B} \cdot d\vec{A} = 0 for the magnetic field B\vec{B} - the same flux-counting statement, using the empirical input that there are no magnetic charges.


What about D dimensions?

Everything above hinged on one cancellation: force 1/r2\sim 1/r^2 against area r2\sim r^2. Let’s generalize to DD dimensions. In DD spatial dimensions the area of a sphere grows as rD1r^{D-1}, and we allow a general power law F=k/rpF = k/r^p.

Rerun the cone trick from Gauss’s law or Newton’s derivation: a cone patch at distance rr has area rD1dΩ\propto r^{D-1} d\Omega, so its pull is

dFrD1dΩrp=rD1pdΩdF \propto \frac{r^{D-1}\, d\Omega}{r^{p}} = r^{\,D-1-p} \, d\Omega

For the force to be only dependent on the angle and independent of rr:

p=D1\boxed{p = D - 1}6

This means that the inverse-square law is not special because “2” is special - it is special because we live in 3 dimensionsb. In 2D the magic law is 1/r1/r, in 4D it is 1/r31/r^3.

If pD1p \neq D-1, the inside of the shell stops being free to roam: for p>D1p > D-1 the nearer wall wins (from the formula for dFdF above, we can see the pull decreases with distance) and you are pulled towards it; for p<D1p < D-1 the farther wall wins and you are pushed towards the centre.7


The Verdict

Replacing a planet, a star or any spherically symmetric body by a single point at its centre is not a convenient approximation - it is exact. The near side pulls harder, the far side pulls weaker but spreads over more matter, and the two cancel precisely such that all that matters is the total mass. If you step inside instead, the same cancellation leaves you feeling no force at all from outer shells, so our 1/r21/r^2 law no longer applies. All because the force between point masses is 1/r21/r^2 in 3 dimensional space, which results in it dying as fast as areas grow.


Notes

a You may be more familiar that on Earth, gravity is F=mgF = mg, with g=9.8 m/s2g = 9.8\ \text{m/s}^2. This is the same law applied at the Earth’s surface: a body of mass mm feels F=GMm/R2F = GM_\oplus m/R_\oplus^2, where MM_\oplus and RR_\oplus are the mass and radius of Earth, so it accelerates at g=GM/R2=6.67×1011×5.97×1024(6.37×106)29.8 m/s2g = GM_\oplus/R_\oplus^2 = \frac{6.67\times10^{-11}\, \times\, 5.97\times10^{24}}{(6.37\times10^6)^2} \approx 9.8\ \text{m/s}^2. Note the distance used is the distance to the centre of the Earth, which is exactly the licence the shell theorem of this post grants.

b To be precise, for the exterior half of the theorem (that objects can be treated as a point mass in the center), there is one other force law with the point-equivalence property: the linear force FrF \propto r. If you sum attractions Fi=kmi(rri)\vec{F}_i = -k m_i (\vec{r} - \vec{r}_i), the total gives F=kM(rrcm)\vec{F} = -kM(\vec{r} - \vec{r}_{\text{cm}}), where M=imiM = \sum_i m_i and rcm=1Mimiri\vec{r}_{\text{cm}} = \frac{1}{M}\sum_i m_i \vec{r}_i. But the force inside a shell of linear force is not zero, so only the exterior half applies.


Sources

1 Newton, Philosophiæ Naturalis Principia Mathematica (1687), Book I, Section 12, Propositions 70-71 - see Borghi, “Newton’s superb theorem: an elementary geometric proof”, arXiv:1201.6534, which quotes Proposition 70 and reproduces Newton’s double-cone argument

2 Shell theorem - Wikipedia

3 Birkhoff’s theorem (relativity) - Wikipedia

4 Ellis et al., “Birkhoff’s theorem and uniqueness”, Physics Letters B (2025), ScienceDirect - with regularity at the centre, Birkhoff’s theorem implies the metric inside an empty spherical cavity must be Minkowski

5 Galaxy rotation curve - Wikipedia

6 “Generalizing Shell Theorem to Constant Curvature Spaces in All Dimensions and Topologies”, arXiv:2511.20852 - the exterior half generalized beyond flat 3D space

7 Zotter & Frank, “Diffuse Sound Field Synthesis”, arXiv:2402.11330, §3.2 - Newton’s shell theorem in DD dimensions: dS=rD1dΩ/cosϕdS = r^{D-1}d\Omega/\cos\phi against a 1/rD11/r^{D-1} law, with opposing contributions cancelling inside

8 Maxwell’s equations - Wikipedia

9 Gravity of Earth - Wikipedia - surface variation and the oblateness correction

10 Faraday cage - Wikipedia

11 Klioner, Basic Celestial Mechanics, arXiv:1609.00915 - the quadrupole field of an oblate Earth, U=GMr(1J2R2r2P2(sinφ))U = \frac{GM}{r}(1 - J_2 \frac{R^2}{r^2}P_2(\sin\varphi)) with J21.083×103J_2 \approx 1.083\times10^{-3} and all other coefficients around 10610^{-6}