Since ancient times, humans have gazed up at the night sky and seen much the same picture—a constant amid the turmoil down on Earth. We now know that chaos lies behind that calm persona: stars are in fact massive, hot balls of turbulent gas, continuously forging new elements through nuclear fusion. Given everything they have going on behind the scenes, have you ever wondered why they seem so… stable?

Of course, as with all the beautiful things in the universe, we ultimately have maths to thank for this. Stars are held together by just two simple differential equations:

$\displaystyle\frac{\mathrm{d}P}{\mathrm{d}r}=-\rho\frac{GM_r}{r^2}$

and

$\displaystyle \frac{\mathrm{d}M_r}{\mathrm{d}r}=4\pi r^2\rho$,

where $r$ represents the distance of a given point to the centre of the star.

The first equation is a statement of hydrostatic equilibrium: the pressure force of the gas pushing the star apart must exactly match the gravitational forwards pulling it in on itself. $P$ is the pressure, $M_r$ is the mass of the sphere contained by the radius $r$, and $\rho$ is the (non-constant) density of the star. The left-hand side, therefore, represents pressure force, while the right-hand side is the gravitational force (familiar perhaps from Newton’s law of gravitation).

The second equation effectively just defines $M_r$ (the right-hand side is simply the surface area of a sphere, multiplied by the density).

In fact, with only two more differential equations (and an equation of state, such as the ideal gas law), we can describe a star’s full structure, including temperature and luminosity:

$\displaystyle\frac{\mathrm{d}T}{\mathrm{d}r}=-\frac3{4ac}\frac{\kappa\rho}{T^3}\frac{L_r}{4\pi r^2},$

$\displaystyle\frac{\mathrm{d}L_r}{\mathrm{d}r}=4\pi r^2\rho\varepsilon.$

These have a bit more physics involved but they express the principles of thermal equilibrium and energy equilibrium. Isn’t it amazing that we can break such a massive, complex, intimidating structure down to just a few lines with a bit of mathematical modelling?