---
title: Hydrostatic Equilibrium and the Virial Theorem
draft: false
module: Stellar Structure
moduleNumber: 4
lessonNumber: 1
order: 401
summary: >
  A star holds itself up by balancing the inward pull of gravity against an
  outward pressure gradient. This balance, hydrostatic equilibrium, fixes a
  lower bound on the central pressure and, combined with the gravitational
  potential energy, yields the virial theorem. The virial relation gives a star
  a negative heat capacity, so that losing energy makes it hotter, and sets the
  Kelvin-Helmholtz timescale over which contraction alone can power the Sun.
topics: [Stellar Structure]
sources:
  - book: Carroll & Ostlie
    ref: "Ch. 10 — The Interiors of Stars; §10.1 Hydrostatic Equilibrium, §10.2 Pressure Equation of State, §10.4 The Virial Theorem"
  - book: Maoz
    ref: "Ch. 3 — Stellar Physics"
---

A star is a self-gravitating ball of gas that neither collapses nor disperses on
a dynamical timescale. Something holds it up. That something is a pressure
gradient, and the statement that the gradient exactly cancels gravity at every
radius is **hydrostatic equilibrium**, the first and most important of the
stellar-structure equations. This lesson derives it from a force balance on a
mass shell, extracts a rigorous lower bound on the central pressure, computes the
gravitational potential energy of a star, and assembles both into the **virial
theorem**. The virial theorem carries two consequences that shape everything a
star does: its total energy is negative and bound, and its effective heat
capacity is negative, so radiating energy away raises the internal temperature.
The last section turns the virial energy into the Kelvin-Helmholtz timescale, the
time gravitational contraction alone could sustain the solar luminosity.

## The condition of hydrostatic equilibrium

Consider a thin spherical shell inside a star at radius $r$, of thickness $\d r$
and unit cross-sectional area, containing gas of mass density $\rho(r)$. Two
forces act on it along the radial direction. Gravity pulls it inward with the
weight of the shell in the field of the mass $m(r)$ interior to it; only the
interior mass matters, because a spherically symmetric shell exerts no net
gravitational force on material inside it. Pressure pushes on both faces: the
larger pressure on the inner face pushes outward, the smaller pressure on the
outer face pushes inward, and the net pressure force is set by the gradient.

The mass of the shell element (per unit area) is $\rho\,\d r$, so its weight per
unit area is $-\,G m(r)\,\rho\,\d r / r^2$, directed inward. The net outward
pressure force per unit area is $P(r) - P(r + \d r) = -\,\d P$. In equilibrium the
two cancel:

$$
-\d P - \frac{G m(r)\,\rho}{r^2}\,\d r = 0,
$$

which rearranges to the **equation of hydrostatic equilibrium**,

$$
\frac{\d P}{\d r} = -\frac{G m(r)\,\rho(r)}{r^2}.
$$

The pressure gradient is negative everywhere: pressure decreases outward, falling
from a maximum at the center to essentially zero at the surface.[^co-hse] Written
against the interior mass instead of the radius, using $\d m = 4\pi r^2 \rho\,\d r$
(mass conservation, derived in the next lesson), it takes the Lagrangian form

$$
\frac{\d P}{\d m} = -\frac{G m}{4\pi r^4},
$$

which is the form used to build numerical models, where $m$ rather than $r$ is the
independent variable.

$$
% caption: The pressure gradient across a shell of thickness dr supports its
% weight in the gravitational field of the interior mass m(r).
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
% star outline
\draw[black] (0,0) circle (3.4);
\node[black, anchor=north east] at (3.2,3.15) {surface};
% interior mass region
\draw (0,0) circle (1.9);
\node[anchor=center] at (0,-0.7) {interior mass m};
% the shell
\draw[acc, very thick] (0,0) circle (2.35);
\draw[acc, very thick] (0,0) circle (2.05);
% forces on a shell element at top, offset horizontally so labels do not collide
\draw[->, black, very thick] (-0.7,2.2) -- (-0.7,3.15) node[above] {pressure out};
\draw[->, black, thick] (-0.7,2.55) -- (-0.7,2.0) node[left] {pressure in};
\draw[->, very thick] (0.7,2.2) -- (0.7,1.25) node[right, yshift=6pt] {gravity};
% radius arrow along a clear diagonal
\draw[->, black] (0,0.2) -- (35:1.85) ;
\node[black, anchor=south] at (1.05,0.75) {r};
\end{tikzpicture}
$$

## Central pressure: a rigorous lower bound

The hydrostatic equation alone, without knowing the density profile, already
bounds the central pressure from below. Start from the Lagrangian form and
integrate from the center ($m = 0$, $P = P_c$) to the surface ($m = M$, $P
\approx 0$):

$$
P_c = \int_0^M \frac{G m}{4\pi r^4}\,\d m.
$$

Inside the star every mass shell lies at a radius $r < R$, the total radius, so
$1/r^4 > 1/R^4$ for every shell. Replacing $r$ by $R$ therefore only decreases the
integrand:

$$
P_c > \int_0^M \frac{G m}{4\pi R^4}\,\d m = \frac{G}{4\pi R^4}\int_0^M m\,\d m
    = \frac{G M^2}{8\pi R^4}.
$$

This is a strict inequality that uses no equation of state and no assumption about
the internal structure beyond spherical symmetry and monotone density. For the Sun,
$M_\odot = 1.989 \times 10^{30}\ \text{kg}$ and $R_\odot = 6.96 \times 10^8\ \text{m}$
give a bound

$$
P_c > \frac{(6.674\times 10^{-11})(1.989\times 10^{30})^2}{8\pi\,(6.96\times 10^8)^4}
    \approx 4.5 \times 10^{13}\ \text{Pa}.
$$

The true central pressure of a solar model is about $2.5 \times 10^{16}\ \text{Pa}$,
roughly five hundred times the bound. The gap is expected: replacing $r$ by $R$
everywhere is a crude underestimate, because most of the mass sits at radii well
inside $R$ where the integrand is far larger. The value of the bound is that it is
exact given only mechanical equilibrium, and it already tells us the interior is at
a pressure enormously larger than anything in a laboratory.

$$
% caption: Replacing every shell radius r by the full radius R shrinks the
% integrand, so the true central pressure exceeds the closed-form lower bound.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (0,0) -- (8.4,0) node[right, black!70] {interior mass m};
\draw[->, black] (0,0) -- (0,4.2) node[above, black!70] {integrand};
% true integrand: rises steeply toward the center-weighted mass
\draw[acc, very thick] (0.3,0.2) .. controls (2.2,0.5) and (3.6,1.4) .. (5.2,2.6)
  .. controls (6.4,3.5) and (7.2,3.9) .. (7.8,4.0);
\node[acc, anchor=south east] at (7.7,3.5) {true integrand};
% the lower-bound integrand: much smaller, uses R everywhere
\draw[black, very thick, densely dashed] (0.3,0.15) -- (7.8,1.5);
\node[black, anchor=north west] at (5.2,0.95) {bound uses r = R};
% shaded gap
\node[black, anchor=center] at (4.0,1.5) {gap};
\end{tikzpicture}
$$

## Gravitational potential energy

Assembling a star from dispersed matter releases gravitational energy. The
**gravitational potential energy** $U$ is the work done against gravity to
disperse the star to infinity, taken with a negative sign, and it is built up
shell by shell. Bringing a shell of mass $\d m$ from infinity to radius $r$, where
the interior mass is $m(r)$, releases $-\,G m\,\d m / r$. Summing over all shells,

$$
U = -\int_0^M \frac{G m}{r}\,\d m.
$$

Evaluating the integral needs the density profile. For the simplest case, a sphere
of uniform density $\rho = 3M/(4\pi R^3)$, the interior mass is $m(r) = M (r/R)^3$,
so $\d m = 3M r^2\,\d r / R^3$, and

$$
U = -\int_0^R \frac{G\,M (r/R)^3}{r}\,\frac{3 M r^2}{R^3}\,\d r
  = -\frac{3 G M^2}{R^6}\int_0^R r^4\,\d r
  = -\frac{3}{5}\,\frac{G M^2}{R}.
$$

Real stars are centrally concentrated, so their density rises toward the center and
the magnitude of $U$ is larger than the uniform-sphere value. The general result for
a polytrope of index $n$ (derived in the equation-of-state lesson) is

$$
U = -\frac{3}{5 - n}\,\frac{G M^2}{R},
$$

which reduces to the uniform sphere at $n = 0$ and grows as $n$ increases toward the
$n = 5$ limit of infinite central concentration. A useful summary is that $U = -\alpha\,
G M^2 / R$ with a dimensionless structure factor $\alpha$ of order unity ($\alpha =
3/5$ uniform, $\alpha \approx 1.5$ for a Sun-like $n = 3$ model).

## The virial theorem

Hydrostatic equilibrium and the gravitational energy combine into an exact relation
between the total thermal energy and the gravitational energy. Multiply the
Lagrangian hydrostatic equation by the volume $V(r) = \tfrac{4}{3}\pi r^3$ interior
to $r$ and integrate over the star. It is cleaner to multiply the Eulerian form by
$4\pi r^3$ and integrate from $0$ to $R$:

$$
\int_0^R 4\pi r^3\,\frac{\d P}{\d r}\,\d r
  = -\int_0^R \frac{G m}{r^2}\,\rho\,4\pi r^3\,\d r
  = -\int_0^R \frac{G m}{r}\,\d m = U,
$$

where the right-hand side used $\d m = 4\pi r^2 \rho\,\d r$ and reproduced the
potential-energy integral. Integrate the left-hand side by parts, with the boundary
term vanishing because $P(R) = 0$ at the surface and $r^3 = 0$ at the center:

$$
\int_0^R 4\pi r^3\,\frac{\d P}{\d r}\,\d r
  = \Big[4\pi r^3 P\Big]_0^R - \int_0^R 12\pi r^2 P\,\d r
  = -3\int_0^R P\,\big(4\pi r^2\,\d r\big) = -3\int_0^R P\,\d V.
$$

Equating the two evaluations gives the mechanical form of the virial theorem,

$$
-3\int_0^R P\,\d V = U, \qquad \text{equivalently} \qquad 3\int P\,\d V = -U.
$$

The step to a thermal statement uses the equation of state. For a nonrelativistic
ideal gas the pressure and the internal thermal energy density $u$ are related by
$P = \tfrac{2}{3} u$, since a monatomic gas stores $\tfrac{3}{2} k T$ of kinetic
energy per particle and exerts $n k T$ of pressure. Then $\int P\,\d V = \tfrac{2}{3}
\int u\,\d V = \tfrac{2}{3} K$, where $K$ is the **total thermal (kinetic) energy** of
the star. Substituting,

$$
3 \cdot \tfrac{2}{3} K = -U \quad\Longrightarrow\quad 2K + U = 0.
$$

This is the virial theorem in its most useful form for stellar physics.[^co-virial]

> **Theorem (Virial theorem for a self-gravitating ideal gas).** A star in
> hydrostatic equilibrium, supported by a nonrelativistic ideal gas, satisfies
> $2K + U = 0$, where $K > 0$ is the total thermal kinetic energy and $U < 0$ is
> the gravitational potential energy. The total energy is $E = K + U = -K =
> \tfrac{1}{2} U < 0$.

Two facts follow immediately. The total energy $E = K + U$ equals $-K$, so it is
**negative**: the star is gravitationally bound and it takes a positive energy input
to disperse it. And $E = \tfrac{1}{2} U$, so the total energy is half the
gravitational energy, the other half having gone into thermal motion.

$$
% caption: Of the gravitational energy released by contraction, half becomes
% thermal energy and half is radiated; the total energy sits at U/2, below zero.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
% zero line
\draw[black] (-0.4,0) -- (9.0,0);
\node[black, anchor=west] at (8.4,0.25) {E = 0};
% U bar (down)
\draw[acc, very thick] (1.2,0) -- (1.2,-3.4);
\draw[acc, very thick] (0.85,-3.4) -- (1.55,-3.4);
\node[acc, anchor=north] at (1.2,-3.55) {U};
% K bar (up), magnitude half of |U|
\draw[black, very thick] (3.4,0) -- (3.4,1.7);
\draw[black, very thick] (3.05,1.7) -- (3.75,1.7);
\node[black, anchor=south] at (3.4,1.8) {K = -U/2};
% radiated (down half of |U|)
\draw[black, very thick, densely dashed] (5.6,0) -- (5.6,-1.7);
\node[black, anchor=north] at (5.6,-1.85) {radiated = -U/2};
% total E bar
\draw[very thick] (7.8,0) -- (7.8,-1.7);
\draw[very thick] (7.45,-1.7) -- (8.15,-1.7);
\node[anchor=north] at (7.8,-1.85) {E = U/2};
\end{tikzpicture}
$$

## Negative heat capacity and the thermostat

The relation $E = -K$ is the source of the most counterintuitive property of
stars. Suppose the star slowly radiates energy from its surface at luminosity $L$,
so that its total energy decreases, $\d E / \d t = -L < 0$. Since $E = -K$, the
thermal energy must **increase**: $\d K / \d t = +L$. The star gets hotter as it
loses energy. The gravitational reservoir supplies the difference: from $U = 2E$,
losing $\d E$ releases $\d U = 2\,\d E$ of gravitational energy, half of which
replaces the radiated energy and half of which goes into raising $K$.

Because the thermal energy scales with the mean internal temperature, this means
a self-gravitating star has an **effective negative heat capacity**: extract heat
and its temperature rises; add heat and it cools and expands. Formally, writing the
mean temperature $\bar{T}$ through $K = \tfrac{3}{2}\,\dfrac{M}{\mu m_H}\,k\bar{T}$
for a gas of mean molecular weight $\mu$, the total energy is $E = -K \propto
-\bar{T}$, so

$$
C_\star \equiv \frac{\d E}{\d \bar{T}} < 0.
$$

This is the thermostat that stabilizes nuclear burning. If a fusion-powered core
generates energy slightly faster than it is radiated, the extra heat expands and
**cools** the core, throttling the temperature-sensitive reaction rate back down; if
it generates too slowly, the core contracts and heats, speeding the reactions up.
The negative heat capacity is why a normal (nondegenerate) star burns stably rather
than exploding. The same mechanism fails when the core becomes degenerate and the
pressure decouples from the temperature, which is what makes the helium flash in
low-mass stars and thermonuclear supernovae runaway events.

## The Kelvin-Helmholtz timescale

Before nuclear fusion was known, Kelvin and Helmholtz proposed that the Sun shines
by slow gravitational contraction, converting the released gravitational energy
into radiation. The virial theorem sets the timescale. If contraction is the only
power source, the luminosity is supplied by the decrease in total energy, and the
available energy is $|E| = \tfrac{1}{2}|U| \approx \tfrac{1}{2}\,G M^2 / R$ up to the
structure factor. The **Kelvin-Helmholtz (thermal) timescale** is this reservoir
divided by the luminosity,

$$
t_{\text{KH}} = \frac{|E|}{L} \approx \frac{G M^2}{2 R L}.
$$

For the Sun,

$$
t_{\text{KH}} \approx
\frac{(6.674\times 10^{-11})(1.989\times 10^{30})^2}{2\,(6.96\times 10^8)(3.828\times 10^{26})}
\approx 5 \times 10^{14}\ \text{s} \approx 1.6 \times 10^{7}\ \text{yr},
$$

about thirty million years. This is the fatal problem with the contraction
hypothesis: the geological and fossil record demanded an age far greater than
$10^7$ years, so gravitational contraction cannot be the Sun's long-term power
source. The resolution is nuclear fusion. Hydrogen burning converts a fraction
$\approx 0.007$ of the rest mass to energy, and only the innermost $\sim 10\%$ of the
Sun's mass reaches core temperatures, giving a **nuclear timescale**

$$
t_{\text{nuc}} \approx \frac{0.1 \times 0.007\, M_\odot c^2}{L_\odot}
\approx \frac{(7\times 10^{-4})(1.989\times 10^{30})(2.998\times 10^8)^2}{3.828\times 10^{26}}
\approx 3 \times 10^{17}\ \text{s} \approx 10^{10}\ \text{yr}.
$$

Nuclear burning outlasts contraction by a factor of roughly a thousand, matching
the Sun's known age of $4.6 \times 10^9$ years with room to spare. The
Kelvin-Helmholtz timescale is not obsolete, though: it governs the pre-main-sequence
contraction of protostars, the readjustment of a star between nuclear burning stages,
and the cooling of white dwarfs, wherever gravitation rather than fusion sets the
pace.

$$
% caption: The Sun's three characteristic timescales span thirteen orders of
% magnitude, from the free-fall dynamical time to the nuclear-burning lifetime.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (0,0) -- (9.6,0) node[right, black!70] {log time in seconds};
\foreach \x/\lab in {0.4/0,2.2/4,4.0/8,5.8/12,7.6/16,9.0/18}
  \draw[black] (\x,0.08) -- (\x,-0.08) node[below, black] {\lab};
% dynamical timescale ~ 10^3 s
\draw[black, very thick] (0.9,0.5) -- (1.4,0.5);
\node[black, anchor=south] at (1.15,0.55) {dynamical};
% KH timescale ~ 5e14 s -> log ~ 14.7
\draw[black, very thick] (6.3,1.2) -- (6.9,1.2);
\node[black, anchor=south] at (6.6,1.25) {Kelvin-Helmholtz};
% nuclear timescale ~ 3e17 s -> log ~ 17.5
\draw[acc, very thick] (8.5,1.9) -- (9.1,1.9);
\node[acc, anchor=south] at (8.8,1.95) {nuclear};
% connective faint guides
\draw[black, densely dotted] (1.15,0.45) -- (1.15,0.05);
\draw[black, densely dotted] (6.6,1.15) -- (6.6,0.05);
\draw[black, densely dotted] (8.8,1.85) -- (8.8,0.05);
\end{tikzpicture}
$$

## Summary

Hydrostatic equilibrium, $\d P/\d r = -G m \rho / r^2$, is the mechanical backbone
of every static star and yields a rigorous central-pressure bound $P_c > G M^2 /
(8\pi R^4)$. The gravitational energy $U = -\alpha\, G M^2 / R$ combines with it
through the virial theorem $2K + U = 0$, forcing the total energy $E = \tfrac{1}{2} U$
to be negative and giving the star a negative heat capacity that stabilizes nuclear
burning. The Kelvin-Helmholtz time $t_{\text{KH}} \approx G M^2 / (2 R L) \sim 3
\times 10^7\ \text{yr}$ for the Sun is far too short to be the Sun's power source,
which fixed the need for fusion, but it still governs contraction phases throughout
stellar life. The next lesson promotes hydrostatic equilibrium into the full set of
[coupled structure
equations](/astrophysics-cosmology/stellar-structure/the-equations-of-stellar-structure),
adding mass conservation, energy generation, and energy transport.

[^co-hse]: Carroll & Ostlie, §10.1 — Hydrostatic Equilibrium: the pressure-gradient support of a mass shell and the central-pressure estimate.
[^co-virial]: Carroll & Ostlie, §10.4 — The Virial Theorem: the derivation $2K + U = 0$, the negative-heat-capacity consequence, and the Kelvin-Helmholtz timescale.
