The Virial Theorem

Follow any function along a Hamiltonian flow and, in general, it fluctuates forever — that is the lesson of the phase-space machinery built earlier in this chapter. The quantity G=∑ipi⋅riG = \sum_i \mathbf{p}_i\cdot\mathbf{r}_i, sometimes called the virial generator, is the great exception. Its time derivative splits cleanly into a kinetic piece and a force piece, and if the motion is confined to a finite region of phase space, GG itself is trapped between fixed bounds — so its time-averaged growth rate has nowhere to go but zero. That single line of bookkeeping forces an exact relation between the average kinetic energy and the average of the forces: the virial theorem. The genius of the theorem is its generality. It assumes nothing about integrability, separability, or even the precise form of the forces. It requires only that positions and momenta remain bounded for all time — a condition met by closed orbits, chaotic but confined motion, and statistically stationary many-body systems alike. The price for this generality is that the result is purely about averages: it tells you nothing about the trajectory itself, only about how energy is partitioned, on average, between motion and interaction. Clausius coined the word virial (from the Latin vis, force) in 1870 while working on the kinetic theory of gases. The same identity weighs galaxy clusters, checks quantum wavefunctions, and closes stellar-structure models — one of the few exact relations that survives essentially unchanged from classical to quantum to statistical mechanics. This article proves it in the Hamiltonian language, specializes it to power-law potentials, and scales it up to ensembles; the companion article on the virial theorem for central forces walks the single-orbit story in detail.

Key takeaways
  • The engine is the phase-space function G=∑ipi⋅riG=\sum_i\mathbf{p}_i\cdot\mathbf{r}_i, whose Hamiltonian evolution G˙={G,H}=2T−∑iqi⋅∂V/∂qi\dot G = \{G,H\} = 2T - \sum_i \mathbf{q}_i\cdot\partial V/\partial\mathbf{q}_i is bounded whenever the motion is — so ⟨G˙⟩=0\langle\dot G\rangle = 0.
  • For a potential homogeneous of degree nn (so V∝rnV\propto r^{n}), Euler's theorem collapses the result to 2⟨T⟩=n⟨V⟩2\langle T\rangle = n\langle V\rangle.
  • Gravity and Coulomb (n=−1n=-1): 2⟨T⟩=−⟨V⟩2\langle T\rangle = -\langle V\rangle, hence E=−⟨T⟩=12⟨V⟩E = -\langle T\rangle = \tfrac12\langle V\rangle — the root of virial mass estimates and the negative heat capacity of stars.
  • The harmonic oscillator (n=2n=2) shares energy equally, ⟨T⟩=⟨V⟩\langle T\rangle = \langle V\rangle; walls with no potential at all reproduce the ideal-gas law PV=NkBTPV = Nk_BT — Clausius's original application.
  • Boundedness is the only hypothesis, so single orbits, chaotic swarms, gases, star clusters, and quantum stationary states all obey the same identity.
  • Key idea: for bounded motion the time average of the total derivative of G=∑ipi⋅riG=\sum_i\mathbf{p}_i\cdot\mathbf{r}_i is zero, which forces a fixed relation between the average kinetic energy and the average virial of the forces.

Where this lives today

Every modern N-body code ships with a virial diagnostic. The ratio 2T/∣V∣2T/|V| is computed at each snapshot, and its settling to unity is the standard operational test that a simulated halo, star cluster, or merger remnant has finished relaxing — equation (5) running live inside gravity solvers from GADGET to modern GPU codes. Simulators also read it in reverse: a halo with 2T/∣V∣2T/|V| far from 1 is flagged as unrelaxed and its "virial mass" quoted with suspicion. On the observational side, cluster masses estimated from velocity dispersions via the virial theorem are now routinely cross-checked against weak gravitational lensing, which weighs the same clusters with entirely independent physics. The Euclid mission's survey data — with cluster catalogs growing through 2026 — makes this comparison at scale, and the concordance of dispersion-based virial masses with lensing masses is one of the quiet, load-bearing consistency checks of the dark-matter paradigm. Meanwhile Chandrasekhar's stellar-structure virial still anchors the theory of white dwarfs: the balance between degenerate-electron kinetic energy and gravitational binding, run through the relativistic version of the theorem, is what sets the Chandrasekhar mass limit that every Type Ia supernova respects.

The physical picture

Picture a comet on a closed, eccentric orbit. Near perihelion it whips past the Sun — kinetic energy spikes, potential energy dives; near aphelion it crawls, and the ledger reverses. Instant by instant, TT and VV swing wildly and tell you nothing universal. But watch their running time averages: within a few periods each settles onto a fixed value, and the two values are locked in the ratio 2⟨T⟩=−⟨V⟩2\langle T\rangle = -\langle V\rangle — the same lock for every bound orbit in a 1/r1/r potential, whatever its eccentricity. The virial theorem is the statement that this lock is not a Kepler coincidence but a consequence of boundedness alone.

Figure
The virial theorem is a statement about averages — on an eccentric Kepler orbit the kinetic and potential energies swing wildly, yet their running time averages settle onto the locked ratio two to one
tenergy1 period2 periodsT(t) — spikes at perihelionV(t) — dives at perihelionrunning average of T → +1/2running average of V → −12⟨T⟩ = −⟨V⟩the virial lock, n = −1computed Kepler orbit, e = 0.6, units GM = a = m = 1: T = 1/r − 1/2, V = −1/r;dotted curves are the running averages, converging to +1/2 and −1

Why should averages be constrained when instants are not? Think of G=∑ipi⋅riG=\sum_i\mathbf{p}_i\cdot\mathbf{r}_i as a bookkeeping scalar. Its growth rate collects 2T2T from the kinetic side and ∑iFi⋅ri\sum_i\mathbf{F}_i\cdot\mathbf{r}_i from the force side. If the books are never allowed to run off to infinity — bounded positions, bounded momenta — then whatever one term contributes on average, the other must on average cancel. That forced cancellation is the theorem. And it shows exactly where the hypothesis bites: on an escape trajectory GG grows without bound, its average growth rate stays finite forever, and no relation between ⟨T⟩\langle T\rangle and ⟨V⟩\langle V\rangle survives.

Figure
Why the theorem needs bound motion — for a bound orbit the generator G oscillates inside a fixed band so its average growth rate vanishes, while on an escape trajectory G grows forever and the boundary term never dies
bound orbit: G stays in a bandt+G max−G maxhyperbolic escape: G runs awaytGslope → 2E > 0average never diesboundary term survives — the theorem failsaverage slope (G(τ)−G(0))/τ → 0computed: bound Kepler orbit e = 0.6 gives G = e sin E;hyperbolic orbit e = 1.4, E = +1/2 gives G = e sinh H with dG/dt → 2E

The exponent in 2⟨T⟩=n⟨V⟩2\langle T\rangle = n\langle V\rangle encodes how steeply the potential climbs with distance. A stiff confining potential (large nn) demands a large share of kinetic energy to keep the motion trapped; an attractive 1/r1/r potential (n=−1n=-1) lets the system bind with negative total energy, storing twice as much (negative) potential energy as kinetic. And there is a deeper reason this particular GG works, unpacked below: GG generates dilations, so the theorem is scaling analysis promoted to an exact statement about time averages.

The generator and its bookkeeping

Everything begins with a single scalar built from the phase-space coordinates. Sum the dot product of each particle's momentum with its position and you have a function G(q,p)G(q,p) on phase space — no dynamics yet, just bookkeeping:

G≡∑ipi⋅ri(1)G \equiv \sum_i \mathbf{p}_i\cdot\mathbf{r}_i \qquad (1)

where: pi\mathbf{p}_i — the momentum of particle ii; ri\mathbf{r}_i — its position vector; GG — a scalar phase-space function with the dimensions of action (momentum times length). For pi=mir˙i\mathbf{p}_i = m_i\dot{\mathbf{r}}_i it equals 12 dI/dt\tfrac12\,\mathrm{d}I/\mathrm{d}t with I=∑imiri2I=\sum_i m_i r_i^2 the moment of inertia about the origin — GG measures whether the system is currently swelling (G>0G>0) or contracting (G<0G<0). Differentiate along the motion and the product rule splits G˙\dot G into two terms with sharply different physical meanings. One collects the momenta acting on the velocities; the other collects the forces acting on the positions:

dGdt=∑ip˙i⋅ri+∑ipi⋅r˙i=∑iFi⋅ri+2T(2)\frac{\mathrm{d}G}{\mathrm{d}t} = \sum_i \dot{\mathbf{p}}_i\cdot\mathbf{r}_i + \sum_i \mathbf{p}_i\cdot\dot{\mathbf{r}}_i = \sum_i \mathbf{F}_i\cdot\mathbf{r}_i + 2T \qquad (2)

where: Fi=p˙i\mathbf{F}_i=\dot{\mathbf{p}}_i — the net force on particle ii (Newton's second law); T=12∑imir˙i2T=\tfrac12\sum_i m_i\dot{\mathbf{r}}_i^2 — the total kinetic energy, entering doubled because pi⋅r˙i=mir˙i2\mathbf{p}_i\cdot\dot{\mathbf{r}}_i = m_i\dot{\mathbf{r}}_i^2 is twice each particle's kinetic energy. The combination ∑iFi⋅ri\sum_i\mathbf{F}_i\cdot\mathbf{r}_i is Clausius's virial of the forces (up to the conventional factor −12-\tfrac12). The same statement reads more elegantly in the language of this chapter. GG is a phase-space function, so its evolution is a Poisson bracket with the Hamiltonian — the universal law from the article on time evolution of phase-space functions. For H=∑ipi2/2mi+V(q)H = \sum_i p_i^2/2m_i + V(q) a two-line computation gives

dGdt={G,H}=2T−∑iri⋅∂V∂ri(3)\frac{\mathrm{d}G}{\mathrm{d}t} = \{G, H\} = 2T - \sum_i \mathbf{r}_i\cdot\frac{\partial V}{\partial \mathbf{r}_i} \qquad (3)

where: {G,H}\{G,H\} — the Poisson bracket of the generator with the Hamiltonian; ri⋅∂V/∂ri\mathbf{r}_i\cdot\partial V/\partial\mathbf{r}_i — the radial stretch of the potential, equal to −Fi⋅ri-\mathbf{F}_i\cdot\mathbf{r}_i for conservative forces, so (3) and (2) agree. Read it structurally: GG generates the dilation r→λr\mathbf{r}\to\lambda\mathbf{r}, p→p/λ\mathbf{p}\to\mathbf{p}/\lambda, and {G,H}\{G,H\} measures how HH responds to that rescaling — the kinetic term (which scales as λ−2\lambda^{-2}, hence the 2T2T) pitted against the potential term (which contributes its radial stretch). Unlike the conserved quantities of the conservation-laws article, GG does not commute with HH; the theorem instead exploits the weaker, subtler fact that its bracket averages to zero. Averages need a definition before they can be manipulated. The relevant one is the infinite-time average along the actual trajectory — for periodic motion, one period already gives the exact answer:

⟨f⟩≡lim⁡τ→∞1τ∫0τf(t) dt(4)\langle f\rangle \equiv \lim_{\tau\to\infty}\frac{1}{\tau}\int_0^{\tau} f(t)\,\mathrm{d}t \qquad (4)

where: ff — any dynamical quantity evaluated along the motion; τ\tau — the averaging window. For motion of period TpT_p, the integral over each period repeats, so ⟨f⟩\langle f\rangle equals the one-period average exactly — no limit required. Now apply (4) to G˙\dot G itself. A time average of a total derivative telescopes: the integral of G˙\dot G is just GG at the endpoints, and boundedness pins the numerator while the denominator grows without limit,

⟨dGdt⟩=lim⁡τ→∞G(τ)−G(0)τ=0(5)\left\langle \frac{\mathrm{d}G}{\mathrm{d}t}\right\rangle = \lim_{\tau\to\infty}\frac{G(\tau)-G(0)}{\tau} = 0 \qquad (5)

where: G(τ)−G(0)G(\tau)-G(0) — the net change of the generator over the window, bounded by 2Gmax⁡2G_{\max} whenever positions and momenta stay finite. This is the only place boundedness enters, and it is the step that fails for unbound motion: on a hyperbolic orbit G˙→2E>0\dot G \to 2E > 0 and the average never dies.

The theorem and its special cases

Averaging equation (2) term by term and feeding in (5) yields the theorem in its most general dress — a statement about forces, valid whether or not they come from a potential:

2⟨T⟩=−⟨∑iFi⋅ri⟩(6)2\langle T\rangle = -\left\langle \sum_i \mathbf{F}_i\cdot\mathbf{r}_i\right\rangle \qquad (6)

where: ⟨T⟩\langle T\rangle — the time-averaged total kinetic energy; the right side is twice Clausius's virial −12⟨∑iFi⋅ri⟩-\tfrac12\langle\sum_i\mathbf{F}_i\cdot\mathbf{r}_i\rangle. Note what is not assumed: no periodicity, no integrability, no two-body structure — chaotic triple systems and 10310^{3}-galaxy clusters qualify just as well as a Kepler ellipse. When the forces derive from a potential that is a homogeneous function of the coordinates — V(λr1,… )=λnV(r1,… )V(\lambda\mathbf{r}_1,\dots) = \lambda^n V(\mathbf{r}_1,\dots), which covers every power law V∝rnV\propto r^n — Euler's theorem converts the virial into a multiple of VV itself, and the theorem becomes an energy-partition rule:

2⟨T⟩=n ⟨V⟩(V homogeneous of degree n)(7)2\langle T\rangle = n\,\langle V\rangle \qquad (V \text{ homogeneous of degree } n) \qquad (7)

where: nn — the degree of homogeneity; ⟨V⟩\langle V\rangle — the time-averaged potential energy. One number fixes the entire average energy budget: n=2n=2 splits it evenly, n=−1n=-1 binds it, and the crossover through n=0n=0 marks potentials (like log⁡r\log r) whose average kinetic energy is fixed independently of orbit size. Combining (7) with energy conservation E=⟨T⟩+⟨V⟩E = \langle T\rangle + \langle V\rangle eliminates either average in favour of the conserved total — the form you reach for in astrophysical estimates:

⟨E⟩=n+2n ⟨T⟩=n+22 ⟨V⟩(8)\langle E\rangle = \frac{n+2}{n}\,\langle T\rangle = \frac{n+2}{2}\,\langle V\rangle \qquad (8)

where: ⟨E⟩=E\langle E\rangle = E — the conserved total energy. For gravity (n=−1n=-1): E=−⟨T⟩=12⟨V⟩E = -\langle T\rangle = \tfrac12\langle V\rangle, so a bound system's kinetic energy is minus its total energy — lose energy and the system heats up, the negative heat capacity that drives stellar evolution.

Which form of the theorem answers which question

you wantusenotes
forces, most generaleq. (6)walls, constraints, non-conservative confinement included
Hamiltonian bookkeepingeq. (3)G˙={G,H}\dot G = \{G,H\}; GG generates dilations
power-law potentialeq. (7)2⟨T⟩=n⟨V⟩2\langle T\rangle = n\langle V\rangle via Euler's theorem
energy budget from EEeq. (8)astrophysics: E=−⟨T⟩E=-\langle T\rangle for gravity
gas in a containerderivation C belowwall virial gives PV=23N⟨t⟩PV = \tfrac23 N\langle t\rangle
single Kepler orbit checked explicitlycompanion central-force articleellipse-by-ellipse verification, drag paradox
Derivation AThe virial theorem from bounded motion

We derive the general virial theorem, equation (6): for any system whose positions and momenta remain bounded for all time, 2⟨T⟩=−⟨∑iFi⋅ri⟩2\langle T\rangle = -\langle\sum_i\mathbf{F}_i\cdot\mathbf{r}_i\rangle. The strategy is the cleanest available — differentiate the generator G=∑ipi⋅riG=\sum_i\mathbf{p}_i\cdot\mathbf{r}_i along the motion, split the result into kinetic and force pieces, and time-average, letting boundedness kill the left side. Watch two things: exactly where the boundedness hypothesis enters (only in the very last step, which is why the rest of the argument is so general), and why for periodic motion a single period suffices with no limit at all.

Step 1. Differentiate the generator. With G=∑ipi⋅riG=\sum_i\mathbf{p}_i\cdot\mathbf{r}_i, the product rule gives

dGdt=∑ip˙i⋅ri+∑ipi⋅r˙i\frac{\mathrm{d}G}{\mathrm{d}t}=\sum_i\dot{\mathbf{p}}_i\cdot\mathbf{r}_i+\sum_i\mathbf{p}_i\cdot\dot{\mathbf{r}}_i

Step 2. Identify the kinetic term. Using pi=mir˙i\mathbf{p}_i=m_i\dot{\mathbf{r}}_i,

∑ipi⋅r˙i=∑imir˙i2=2T\sum_i\mathbf{p}_i\cdot\dot{\mathbf{r}}_i=\sum_i m_i\dot{\mathbf{r}}_i^2=2T

Why the factor of two appears: each term is twice the particle's kinetic energy 12mir˙i2\tfrac12 m_i\dot{\mathbf{r}}_i^2 — the virial theorem's characteristic 2 is born here, in the quadratic dependence of TT on velocity.

Step 3. Identify the force term. Newton's second law p˙i=Fi\dot{\mathbf{p}}_i=\mathbf{F}_i turns the first sum into ∑iFi⋅ri\sum_i\mathbf{F}_i\cdot\mathbf{r}_i, so

dGdt=2T+∑iFi⋅ri\frac{\mathrm{d}G}{\mathrm{d}t} = 2T + \sum_i\mathbf{F}_i\cdot\mathbf{r}_i

Step 4. Time-average both sides over a window τ\tau using definition (4). Averaging is linear, so it distributes over the two terms:

G(τ)−G(0)τ=2τ∫0τT dt+1τ∫0τ∑iFi⋅ri dt\frac{G(\tau)-G(0)}{\tau} = \frac{2}{\tau}\int_0^\tau T\,\mathrm{d}t + \frac{1}{\tau}\int_0^\tau \sum_i\mathbf{F}_i\cdot\mathbf{r}_i\,\mathrm{d}t

Why the left side telescopes: G˙\dot G is a total derivative, so its integral is pure boundary — the whole theorem is the statement that a bounded function's boundary term cannot keep up with a growing denominator.

Step 5. Impose boundedness — the only place the hypothesis is used. If all ri\mathbf{r}_i and pi\mathbf{p}_i remain finite for all time, then ∣G(t)∣≤Gmax⁡|G(t)|\le G_{\max} for some fixed bound, and

∣G(τ)−G(0)τ∣≤2Gmax⁡τ→τ→∞0\left|\frac{G(\tau)-G(0)}{\tau}\right| \le \frac{2G_{\max}}{\tau} \xrightarrow[\tau\to\infty]{} 0

Taking τ→∞\tau\to\infty in Step 4 and rearranging gives 2⟨T⟩=−⟨∑iFi⋅ri⟩2\langle T\rangle = -\langle\sum_i\mathbf{F}_i\cdot\mathbf{r}_i\rangle, which is equation (6).

Step 6. Note the periodic shortcut. If the motion has period TpT_p, then G(Tp)=G(0)G(T_p)=G(0) exactly, so the left side of Step 4 vanishes identically at τ=Tp\tau=T_p — the theorem holds as an exact one-period statement, no limit needed. For quasiperiodic or chaotic bounded motion the limit does the same job, only asymptotically. Verified: for the harmonic oscillator the result reduces to ⟨T⟩=⟨V⟩\langle T\rangle=\langle V\rangle and for gravity to 2⟨T⟩=−⟨V⟩2\langle T\rangle=-\langle V\rangle, both confirmed independently in the worked examples; the derivation matches Goldstein §3.4.

Go deeper · Derivation B · 1 minPower-law potentials via Euler's homogeneous-function theorem
Derivation BPower-law potentials via Euler's homogeneous-function theorem

We now specialize the general theorem to potentials that scale as a pure power of the coordinates and obtain equation (7), 2⟨T⟩=n⟨V⟩2\langle T\rangle = n\langle V\rangle, together with the energy partition (8). The strategy is to trade the force virial −∑iFi⋅ri-\sum_i\mathbf{F}_i\cdot\mathbf{r}_i for a statement about VV itself using Euler's identity for homogeneous functions — a one-line differentiation trick. The thing to watch is what "homogeneous of degree nn" means for a many-body potential: all coordinates are rescaled together, which is exactly the property of gravitational and Coulomb pair sums.

Step 1. State the scaling hypothesis. Suppose V(λr1,…,λrN)=λnV(r1,…,rN)V(\lambda\mathbf{r}_1,\dots,\lambda\mathbf{r}_N)=\lambda^n V(\mathbf{r}_1,\dots,\mathbf{r}_N) for all λ>0\lambda>0. A pair sum ∑i<jkij∣ri−rj∣n\sum_{i<j} k_{ij}|\mathbf{r}_i-\mathbf{r}_j|^n satisfies this, since each separation stretches by λ\lambda.

Step 2. Differentiate the scaling relation with respect to λ\lambda and set λ=1\lambda=1:

∑iri⋅∇iV=n V\sum_i \mathbf{r}_i\cdot\nabla_i V = n\,V

Why this works: the left side is the directional derivative of VV along the dilation flow, and the right side is what the explicit power of λ\lambda produces — Euler's theorem is nothing but the chain rule applied to a scaling family.

Step 3. Express the virial through the potential. For conservative forces Fi=−∇iV\mathbf{F}_i=-\nabla_i V, so

−∑iFi⋅ri=∑iri⋅∇iV=nV-\sum_i\mathbf{F}_i\cdot\mathbf{r}_i=\sum_i\mathbf{r}_i\cdot\nabla_i V = nV

Step 4. Average and substitute into the general theorem (6):

2⟨T⟩=−⟨∑iFi⋅ri⟩=n⟨V⟩2\langle T\rangle = -\left\langle\sum_i\mathbf{F}_i\cdot\mathbf{r}_i\right\rangle = n\langle V\rangle

Step 5. Read off the energy partition. With E=⟨T⟩+⟨V⟩E=\langle T\rangle+\langle V\rangle conserved, eliminate ⟨V⟩=2⟨T⟩/n\langle V\rangle = 2\langle T\rangle/n:

E=n+2n ⟨T⟩=n+22 ⟨V⟩E = \frac{n+2}{n}\,\langle T\rangle = \frac{n+2}{2}\,\langle V\rangle

For n=−1n=-1: E=12⟨T⟩⋅(1)⇒E=−⟨T⟩E=\tfrac12\langle T\rangle\cdot(1) \Rightarrow E=-\langle T\rangle — check it directly: E=⟨T⟩+⟨V⟩=⟨T⟩−2⟨T⟩=−⟨T⟩E=\langle T\rangle+\langle V\rangle=\langle T\rangle-2\langle T\rangle=-\langle T\rangle, consistent. For n=2n=2: E=2⟨T⟩E=2\langle T\rangle, i.e. ⟨T⟩=⟨V⟩=E/2\langle T\rangle=\langle V\rangle=E/2. Verified: for n=2n=2 this gives ⟨T⟩=⟨V⟩\langle T\rangle=\langle V\rangle and for n=−1n=-1 it gives E=−⟨T⟩E=-\langle T\rangle, matching Landau–Lifshitz §10; the n→0n\to 0 limit correctly signals the logarithmic case, where 2⟨T⟩=⟨r ∂V/∂r⟩=2\langle T\rangle = \langle r\,\partial V/\partial r\rangle = const replaces (7).

From one orbit to statistical mechanics

Nothing in derivation A referred to a single particle or a single orbit, and this is where the Hamiltonian-chapter version of the theorem earns its keep. For a statistically stationary many-body system — a relaxed star cluster, a gas in equilibrium — the time average along one long trajectory can be traded for an ensemble average over phase space. In the canonical ensemble the exchange becomes a theorem of its own: integrating by parts against the Boltzmann weight e−H/kBTe^{-H/k_BT} gives the generalized equipartition theorem,

⟨xk∂H∂xl⟩=δkl kBTtemp(9)\left\langle x_k \frac{\partial H}{\partial x_l} \right\rangle = \delta_{kl}\, k_B T_{\text{temp}} \qquad (9)

where: xkx_k — any phase-space coordinate, position or momentum; δkl\delta_{kl} — the Kronecker delta; TtempT_{\text{temp}} — the absolute temperature. Choosing xk=xl=px_k = x_l = p gives ⟨p2/m⟩=kBTtemp\langle p^2/m\rangle = k_BT_{\text{temp}} — each momentum degree of freedom carries 12kBTtemp\tfrac12 k_BT_{\text{temp}}, the ensemble shadow of the 2T2T in (2); choosing xk=xl=qx_k = x_l = q recovers the potential-side virial. The virial theorem and equipartition are one bookkeeping read in two ensembles. The gravitational case carries the most dramatic consequence. For a self-gravitating system in virial equilibrium, equation (8) with n=−1n=-1 says E=−⟨T⟩E = -\langle T\rangle: the heat capacity is negative. Radiate energy away (EE decreases) and ⟨T⟩\langle T\rangle must rise — the system contracts and heats up. A star that loses heat gets hotter, which is why gravitational contraction ignites nuclear burning; a globular cluster whose core loses stars to evaporation contracts and heats toward the gravothermal catastrophe. No laboratory gas behaves this way, and the difference is traceable to a single sign: n=−1n=-1 instead of walls. The theorem also crosses into quantum mechanics essentially intact. For a stationary state (an energy eigenstate), Ehrenfest's theorem applied to the operator G^=12∑i(r^i⋅p^i+p^i⋅r^i)\hat G = \tfrac12\sum_i(\hat{\mathbf{r}}_i\cdot\hat{\mathbf{p}}_i + \hat{\mathbf{p}}_i\cdot\hat{\mathbf{r}}_i) gives 2⟨T^⟩=⟨r⋅∇V⟩2\langle\hat T\rangle = \langle\mathbf{r}\cdot\nabla V\rangle — expectation values in place of time averages, with stationarity of the state playing the role that boundedness played classically. For hydrogen it yields ⟨T^⟩=−En\langle\hat T\rangle = -E_n exactly, a stringent test applied routinely to variational wavefunctions.

Go deeper · Derivation C · 1 minClausius's virial and the ideal-gas law
Derivation CClausius's virial and the ideal-gas law

We derive the equation of state of an ideal gas from the virial theorem — Clausius's original 1870 application, and the cleanest example of the general force form (6) doing work that the potential form (7) cannot, because the confining "potential" is a hard wall. The strategy: for non-interacting particles the only forces are wall forces; convert the wall virial into a surface integral over the container, then use the divergence theorem. Watch how the pressure enters — as momentum flux delivered at the boundary — and note the assumption that the gas is in a stationary state so time averages are well defined.

Step 1. Split the virial. For an ideal gas the intermolecular forces vanish, so the total virial is pure wall contribution. The wall exerts pressure PP inward on the gas across each surface element dA\mathrm{d}\mathbf{A} (outward normal), so the time-averaged force on the gas near dA\mathrm{d}\mathbf{A} is −P dA-P\,\mathrm{d}\mathbf{A} and

−⟨∑wallF⋅r⟩=P∮∂Vr⋅dA-\left\langle\sum_{\text{wall}}\mathbf{F}\cdot\mathbf{r}\right\rangle = P\oint_{\partial V}\mathbf{r}\cdot\mathrm{d}\mathbf{A}

Why a continuous integral is legitimate: individual wall kicks are impulsive, but their time average over many collisions is exactly the steady pressure field — the same coarse-graining that defines PP in the first place.

Step 2. Apply the divergence theorem to the surface integral:

∮∂Vr⋅dA=∫V∇⋅r d3r=3V\oint_{\partial V}\mathbf{r}\cdot\mathrm{d}\mathbf{A}=\int_V \nabla\cdot\mathbf{r}\,\mathrm{d}^3r = 3V

since ∇⋅r=3\nabla\cdot\mathbf{r}=3 in three dimensions — the one place the dimensionality of space enters the ideal-gas law.

Step 3. Assemble the virial theorem (6) with this virial:

2⟨T⟩tot=3PV⇒PV=23 ⟨T⟩tot2\langle T\rangle_{\text{tot}} = 3PV \quad\Rightarrow\quad PV=\tfrac{2}{3}\,\langle T\rangle_{\text{tot}}

with ⟨T⟩tot=N⟨t⟩1\langle T\rangle_{\text{tot}} = N\langle t\rangle_{1} the total kinetic energy of NN molecules.

Step 4. Connect to temperature through equipartition, equation (9): each molecule carries ⟨t⟩1=32kBTtemp\langle t\rangle_1 = \tfrac32 k_B T_{\text{temp}}, so

PV=23⋅32NkBTtemp=NkBTtempPV = \tfrac{2}{3}\cdot\tfrac{3}{2}N k_B T_{\text{temp}} = N k_B T_{\text{temp}}

Verified: this recovers the ideal gas law exactly; with intermolecular forces restored, the same route generates the virial expansion PV=NkBT(1+B2/v+… )PV = Nk_BT(1 + B_2/v + \dots) — the historical origin of the name "virial coefficients."

Limiting cases

For a homogeneous potential V∝rnV\propto r^{n} the theorem reads 2⟨T⟩=n⟨V⟩2\langle T\rangle=n\langle V\rangle, and the physically important exponents deserve a table of their own:

caseresultmeaning
gravity / Coulomb, n=−1n=-12⟨T⟩=−⟨V⟩2\langle T\rangle=-\langle V\rangle, E=−⟨T⟩E=-\langle T\ranglebound systems have E<0E<0; virial mass estimates; negative heat capacity
harmonic oscillator, n=2n=2⟨T⟩=⟨V⟩=E/2\langle T\rangle=\langle V\rangle=E/2equal average sharing — verifiable directly for x=Acos⁡ωtx=A\cos\omega t
constant force, n=1n=12⟨T⟩=⟨V⟩2\langle T\rangle=\langle V\ranglebouncing ball, particle column in uniform gravity
logarithmic potential, n→0n\to 02⟨T⟩=⟨r V′⟩=2\langle T\rangle = \langle r\,V'\rangle = const⟨T⟩\langle T\rangle independent of orbit size — flat galactic rotation curves
free gas in a box, V≡0V\equiv 02⟨T⟩=3PV2\langle T\rangle = 3PVwall virial only: Clausius's route to PV=NkBTPV=Nk_BT
unbound (hyperbolic) motiontheorem failsGG unbounded, ⟨G˙⟩=2E≠0\langle\dot G\rangle = 2E \neq 0: no relation survives

Worked examples

1 · Checking the lock on a harmonic oscillator (confidence builder)

A block of mass m=2.0 kgm = 2.0\ \mathrm{kg} oscillates on a spring with angular frequency ω=3.0 rad/s\omega = 3.0\ \mathrm{rad/s} and amplitude A=0.5 mA = 0.5\ \mathrm{m}. Compute ⟨T⟩\langle T\rangle and ⟨V⟩\langle V\rangle over one period explicitly and verify the virial prediction.

Step 1. Write the motion and the two energies. With x(t)=Acos⁡ωtx(t)=A\cos\omega t: T(t)=12mω2A2sin⁡2ωtT(t) = \tfrac12 m\omega^2A^2\sin^2\omega t and V(t)=12mω2A2cos⁡2ωtV(t) = \tfrac12 m\omega^2A^2\cos^2\omega t. Their sum is constant, E=12mω2A2=12(2.0)(9.0)(0.25)=2.25 JE = \tfrac12 m\omega^2 A^2 = \tfrac12(2.0)(9.0)(0.25) = 2.25\ \mathrm{J}.

Step 2. Average over one period. Since ⟨sin⁡2ωt⟩=⟨cos⁡2ωt⟩=12\langle\sin^2\omega t\rangle = \langle\cos^2\omega t\rangle = \tfrac12 over a full period, ⟨T⟩=14mω2A2=14(2.0)(9.0)(0.25)=1.125 J\langle T\rangle = \tfrac14 m\omega^2A^2 = \tfrac14(2.0)(9.0)(0.25) = \boxed{1.125\ \mathrm{J}} and ⟨V⟩=1.125 J\langle V\rangle = \boxed{1.125\ \mathrm{J}} — equal, as the theorem demands.

Step 3. Check against the virial prediction. The spring potential V=12kx2V=\tfrac12 kx^2 is homogeneous of degree n=2n=2, so equation (7) says 2⟨T⟩=2⟨V⟩2\langle T\rangle = 2\langle V\rangle, i.e. ⟨T⟩=⟨V⟩\langle T\rangle = \langle V\rangle, and equation (8) says E=2⟨T⟩=2(1.125)=2.25 JE = 2\langle T\rangle = 2(1.125) = 2.25\ \mathrm{J}. Both match the explicit averages.

Step 4. Note what would fail instantaneously. At t=0t=0 the split is T=0T=0, V=2.25 JV=2.25\ \mathrm{J} — nowhere near equality. The theorem constrains the averages, never the snapshot.

2 · Weighing a galaxy cluster from its velocity dispersion (exam level)

The most famous application of the theorem turns two observables — how fast the members move and how big the system is — into a total mass, including every gram that does not shine.

Figure
The virial theorem as a scale — velocity dispersions weigh everything that gravitates, and in a rich cluster the dynamical mass towers over the stars and gas that telescopes actually record
what telescopes seestars ≈ 2×10¹³ M☉hot gas ≈ 1.4×10¹⁴ M☉baryons: ≈ 16% of the totalwhat the virial theorem weighsdark matter≈ 84%M vir ≈ 10¹⁵ M☉σ ≈ 10³ km/s, R ≈ 3 Mpc2⟨T⟩ = −⟨V⟩ sets the height Coma-like budget: stars 2%, hot gas 14%, dark 84% — Zwicky's 1933 anomaly

A rich cluster has line-of-sight velocity dispersion σ≈1000 km/s\sigma \approx 1000\ \mathrm{km/s} and characteristic radius R≈3 MpcR \approx 3\ \mathrm{Mpc}. Estimate its virial mass and compare with the luminous mass, ∼2×1013 M⊙\sim 2\times10^{13}\ M_\odot in stars plus ∼1.4×1014 M⊙\sim 1.4\times10^{14}\ M_\odot in hot gas.

Step 1. Set up the gravitational virial. For a self-gravitating system in equilibrium, 2⟨T⟩+⟨V⟩=02\langle T\rangle + \langle V\rangle = 0 with ⟨T⟩=12M⟨v2⟩\langle T\rangle = \tfrac12 M\langle v^2\rangle and ⟨V⟩=−α GM2/R\langle V\rangle = -\alpha\,GM^2/R, where α\alpha is a structure constant of order unity encoding the mass profile. Solving for the mass: M=⟨v2⟩R/(αG)M = \langle v^2\rangle R/(\alpha G).

Step 2. Get the order of magnitude first, ignoring all factors of order one: M∼σ2R/GM \sim \sigma^2 R/G. With σ2=(1.0×106 m/s)2=1.0×1012 m2/s2\sigma^2 = (1.0\times10^{6}\ \mathrm{m/s})^2 = 1.0\times10^{12}\ \mathrm{m^2/s^2} and R=3 Mpc=9.26×1022 mR = 3\ \mathrm{Mpc} = 9.26\times10^{22}\ \mathrm{m}:

M∼(1.0×1012)(9.26×1022)6.674×10−11=1.4×1045 kgM \sim \frac{(1.0\times10^{12})(9.26\times10^{22})}{6.674\times10^{-11}} = 1.4\times10^{45}\ \mathrm{kg}

Dividing by M⊙=1.99×1030 kgM_\odot = 1.99\times10^{30}\ \mathrm{kg} gives M∼7×1014 M⊙\boxed{M \sim 7\times10^{14}\ M_\odot}.

Step 3. Restore the honest factors. The line-of-sight dispersion sees one of three velocity components, so for isotropic orbits ⟨v2⟩=3σ2\langle v^2\rangle = 3\sigma^2, pushing the estimate up to ∼2×1015 M⊙\sim 2\times10^{15}\ M_\odot; the profile constant α\alpha pulls it back down by a factor of a few. The standard estimator M≈5σ2Re/GM \approx 5\sigma^2 R_e/G (with ReR_e a projected effective radius) packages both corrections. Honest statement: Mvir≈1015 M⊙M_{\mathrm{vir}} \approx 10^{15}\ M_\odot within a factor of 2, the uncertainty dominated by profile and anisotropy assumptions, not by the theorem.

Step 4. Confront the luminous mass. Stars plus hot gas total ≈1.6×1014 M⊙\approx 1.6\times10^{14}\ M_\odot — about 16 percent of the virial mass. Some 8484 percent of the gravitating matter is dark. This is Zwicky's 1933 Coma argument with modern numbers, and its logic has never been overturned — only confirmed, by X-ray hydrostatic masses and by gravitational lensing.

Step 5. Check the stationarity hypothesis. The crossing time is R/σ≈9.26×1022/106 s≈3 GyrR/\sigma \approx 9.26\times10^{22}/10^{6}\ \mathrm{s} \approx 3\ \mathrm{Gyr} — comfortably shorter than the ∼10 Gyr\sim10\ \mathrm{Gyr} age of a rich cluster, so the central regions have had time to relax and the virial average is meaningful. For a merging cluster this box fails, and virial masses are quoted with correspondingly fat error bars.

Origins · 1 minRudolf Clausius and how this was discovered
RC
Rudolf Clausius
1822–1888 · Zürich and Bonn; kinetic theory and thermodynamics

Clausius was the great bookkeeper of nineteenth-century physics. He gave thermodynamics its second law in the form still taught ("heat cannot of itself pass from a colder to a hotter body"), invented the concept and the name entropy, and then turned the same accounting instinct on the kinetic theory of gases. His 1870 lecture "On a Mechanical Theorem Applicable to Heat" introduced the virial — from vis, force — and proved that the mean kinetic energy of a confined system of molecules equals its mean virial, deriving gas pressure from molecular bombardment decades before atoms were respectable. The theorem was conceived as a bridge between mechanics and heat; that the identical bookkeeping would one day weigh clusters of galaxies is the kind of afterlife theorems earn by being exactly true.

History
1870
— Clausius delivers "On a Mechanical Theorem Applicable to Heat," coining the virial and proving the theorem for confined molecular systems.
1926
— Eddington's The Internal Constitution of the Stars makes the virial balance a working tool of stellar-structure theory.
1930
— Fock proves the quantum-mechanical virial theorem for stationary states, transplanting the classical identity into wave mechanics.
1933
— Zwicky applies the theorem to the Coma cluster and infers dunkle Materie — dark matter — from the impossible velocity dispersion.
1953
— Chandrasekhar and Fermi extend the theorem to magnetized, self-gravitating plasmas, founding the tensor-virial analysis of galactic structure.

Going further

References. Goldstein, Poole & Safko, Classical Mechanics, 3rd ed., §3.4 · Landau & Lifshitz, Mechanics, 3rd ed., §10 · Morin, Introduction to Classical Mechanics, Ch. 5 · Taylor, Classical Mechanics, §13 · Binney & Tremaine, Galactic Dynamics, 2nd ed., §4.8 (tensor virial and astrophysical applications)

Provenance. Derivations follow the standard treatments in Goldstein, Poole & Safko Classical Mechanics 3rd ed. §3.4 (general theorem, power-law case) and Landau & Lifshitz Mechanics §10 (homogeneous potentials, energy partition). A verifier should: (1) reconfirm G˙=2T+∑F⋅r\dot G=2T+\sum\mathbf F\cdot\mathbf r by the product rule; (2) check Euler's theorem step r⋅∇V=nV\mathbf r\cdot\nabla V=nV for V∝rnV\propto r^n; (3) verify the harmonic (⟨T⟩=⟨V⟩\langle T\rangle=\langle V\rangle) and Kepler (E=−TE=-T) special cases; (4) confirm the ideal-gas derivation via ∇⋅r=3\nabla\cdot\mathbf r=3 and the divergence theorem giving 2⟨T⟩=3PV2\langle T\rangle=3PV. The dark-matter (Zwicky 1933) and ideal-gas (Clausius 1870) historical attributions are textbook-standard.

Builds on: The Hamiltonian Function · Hamiltonian as Total Energy · Generalized Momenta · Phase Space. Leads to: Hamiltonian Flow and the Phase Fluid · Phase Portraits and Trajectories · The Harmonic Oscillator in Phase Space. See also the companion article Virial Theorem for Central Forces for the orbit-by-orbit story, and The Kepler Problem for the n=−1n=-1 dynamics itself.

Is the average a time average or an ensemble average — and when can I switch between them?

The derivation gives a time average along one trajectory, definition (4); statistical mechanics wants ensemble averages over phase space. The switch is licensed for statistically stationary, ergodic systems — then the two agree, and equation (9) is the ensemble twin of the mechanical theorem. In practice the requirement is weaker than full ergodicity: you need ⟨T⟩\langle T\rangle and the virial to settle to stable values over the observation window, with the system confined throughout. For a relaxed star cluster (crossing time much shorter than its age) this holds well; for a merging cluster it visibly fails.

Does the theorem survive in quantum mechanics, where trajectories do not exist?

Yes, with time averages replaced by expectation values in stationary states. For an energy eigenstate, d⟨G^⟩/dt=⟨[G^,H^]⟩/iℏ=0\mathrm{d}\langle\hat G\rangle/\mathrm{d}t = \langle[\hat G,\hat H]\rangle/i\hbar = 0 automatically — stationarity does the job boundedness did classically — and expanding the commutator gives 2⟨T^⟩=⟨r⋅∇V⟩2\langle\hat T\rangle = \langle\mathbf{r}\cdot\nabla V\rangle, formally identical to (6). For hydrogen this yields ⟨T^⟩=−En\langle\hat T\rangle = -E_n and ⟨V^⟩=2En\langle\hat V\rangle = 2E_n exactly. It is also a working diagnostic: a variational wavefunction that badly violates the virial ratio is badly wrong, and "virial scaling" (rescaling ψ(r)→ψ(λr)\psi(\mathbf{r})\to\psi(\lambda\mathbf{r}) to enforce the ratio) provably lowers the energy estimate.

What about forces that do not come from a potential — friction, magnetic forces, hard walls?

The general form (6) is a statement about the total force and survives anything, because Steps 1–5 of derivation A never assume F=−∇V\mathbf{F}=-\nabla V. Hard walls are handled exactly this way in derivation C. Magnetic forces contribute q(v×B)⋅rq(\mathbf{v}\times\mathbf{B})\cdot\mathbf{r} to the virial — generally nonzero even though they do no work — and such terms are the heart of the Chandrasekhar–Fermi tensor virial for magnetized plasmas. Friction is subtler: a damped system is not stationary (it spirals to rest), so the theorem applies to the driven steady state, if one exists, not to the decaying transient.

If E equals minus the average kinetic energy for gravity, does losing energy really make a system speed up — and where does the extra kinetic energy come from?

Yes, and nothing is violated. Take E→E−∣dE∣E\to E-|\mathrm{d}E| by radiating heat or shedding energy to escaping members. The virial lock E=−⟨T⟩E=-\langle T\rangle forces ⟨T⟩→⟨T⟩+∣dE∣\langle T\rangle \to \langle T\rangle + |\mathrm{d}E|: the system gets hotter. The books balance through ⟨V⟩=2E\langle V\rangle = 2E: the potential energy drops by 2∣dE∣2|\mathrm{d}E| as the system contracts — one unit leaves as radiation, one unit becomes kinetic energy. Gravitational contraction is thus a heat engine with a negative heat capacity, and it is self-accelerating: a star cluster core that loses heat to its halo gets hotter, steepening the temperature gradient and losing heat faster — the gravothermal runaway.

Does a freely drifting center of mass break the theorem — the positions grow without bound even for a bound cluster?

It does, literally: if the center of mass moves uniformly, ri∼Vcmt\mathbf{r}_i \sim \mathbf{V}_{\text{cm}}t grows, GG picks up a term growing linearly in time, and the boundedness hypothesis fails even though the internal motion is perfectly confined. The fix is the one always used in practice: separate the motion. Apply the theorem to the internal coordinates ri−Rcm\mathbf{r}_i - \mathbf{R}_{\text{cm}} and momenta in the center-of-mass frame, where the internal dynamics is bounded and the theorem holds for the internal kinetic and potential energies. The CM kinetic energy 12MVcm2\tfrac12 M V_{\text{cm}}^2 simply rides along, exactly conserved and exempt from the virial bookkeeping.

What happens for potentials that are not power laws — say the logarithmic potential of a galactic halo?

Fall back to the mid-generality form 2⟨T⟩=⟨∑iri⋅∇iV⟩2\langle T\rangle = \langle\sum_i \mathbf{r}_i\cdot\nabla_i V\rangle, which needs conservative forces but not homogeneity. For V=vc2ln⁡(r/r0)V = v_c^2\ln(r/r_0) — the potential behind a flat rotation curve — r ∂V/∂r=vc2r\,\partial V/\partial r = v_c^2 is constant, so 2⟨T⟩=vc22\langle T\rangle = v_c^2 per unit mass regardless of the orbit's size or shape: every star in the halo carries the same average kinetic energy. That is also the n→0n\to0 limit of 2⟨T⟩=n⟨V⟩2\langle T\rangle = n\langle V\rangle done correctly, since a logarithm is the n→0n\to0 limit of (rn−1)/n(r^n-1)/n and n⟨V⟩n\langle V\rangle stays finite.

Before this

Where this leads