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 , 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, 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.
- The engine is the phase-space function , whose Hamiltonian evolution is bounded whenever the motion is — so .
- For a potential homogeneous of degree (so ), Euler's theorem collapses the result to .
- Gravity and Coulomb (): , hence — the root of virial mass estimates and the negative heat capacity of stars.
- The harmonic oscillator () shares energy equally, ; walls with no potential at all reproduce the ideal-gas law — 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 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 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 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, and 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 — the same lock for every bound orbit in a potential, whatever its eccentricity. The virial theorem is the statement that this lock is not a Kepler coincidence but a consequence of boundedness alone.
Why should averages be constrained when instants are not? Think of as a bookkeeping scalar. Its growth rate collects from the kinetic side and 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 grows without bound, its average growth rate stays finite forever, and no relation between and survives.
The exponent in encodes how steeply the potential climbs with distance. A stiff confining potential (large ) demands a large share of kinetic energy to keep the motion trapped; an attractive potential () 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 works, unpacked below: 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 on phase space — no dynamics yet, just bookkeeping:
where: — the momentum of particle ; — its position vector; — a scalar phase-space function with the dimensions of action (momentum times length). For it equals with the moment of inertia about the origin — measures whether the system is currently swelling () or contracting (). Differentiate along the motion and the product rule splits 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:
where: — the net force on particle (Newton's second law); — the total kinetic energy, entering doubled because is twice each particle's kinetic energy. The combination is Clausius's virial of the forces (up to the conventional factor ). The same statement reads more elegantly in the language of this chapter. 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 a two-line computation gives
where: — the Poisson bracket of the generator with the Hamiltonian; — the radial stretch of the potential, equal to for conservative forces, so (3) and (2) agree. Read it structurally: generates the dilation , , and measures how responds to that rescaling — the kinetic term (which scales as , hence the ) pitted against the potential term (which contributes its radial stretch). Unlike the conserved quantities of the conservation-laws article, does not commute with ; 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:
where: — any dynamical quantity evaluated along the motion; — the averaging window. For motion of period , the integral over each period repeats, so equals the one-period average exactly — no limit required. Now apply (4) to itself. A time average of a total derivative telescopes: the integral of is just at the endpoints, and boundedness pins the numerator while the denominator grows without limit,
where: — the net change of the generator over the window, bounded by 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 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:
where: — the time-averaged total kinetic energy; the right side is twice Clausius's virial . Note what is not assumed: no periodicity, no integrability, no two-body structure — chaotic triple systems and -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 — , which covers every power law — Euler's theorem converts the virial into a multiple of itself, and the theorem becomes an energy-partition rule:
where: — the degree of homogeneity; — the time-averaged potential energy. One number fixes the entire average energy budget: splits it evenly, binds it, and the crossover through marks potentials (like ) whose average kinetic energy is fixed independently of orbit size. Combining (7) with energy conservation eliminates either average in favour of the conserved total — the form you reach for in astrophysical estimates:
where: — the conserved total energy. For gravity (): , 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 want | use | notes |
|---|---|---|
| forces, most general | eq. (6) | walls, constraints, non-conservative confinement included |
| Hamiltonian bookkeeping | eq. (3) | ; generates dilations |
| power-law potential | eq. (7) | via Euler's theorem |
| energy budget from | eq. (8) | astrophysics: for gravity |
| gas in a container | derivation C below | wall virial gives |
| single Kepler orbit checked explicitly | companion central-force article | ellipse-by-ellipse verification, drag paradox |
We derive the general virial theorem, equation (6): for any system whose positions and momenta remain bounded for all time, . The strategy is the cleanest available — differentiate the generator 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 , the product rule gives
Step 2. Identify the kinetic term. Using ,
Why the factor of two appears: each term is twice the particle's kinetic energy — the virial theorem's characteristic 2 is born here, in the quadratic dependence of on velocity.
Step 3. Identify the force term. Newton's second law turns the first sum into , so
Step 4. Time-average both sides over a window using definition (4). Averaging is linear, so it distributes over the two terms:
Why the left side telescopes: 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 and remain finite for all time, then for some fixed bound, and
Taking in Step 4 and rearranging gives , which is equation (6).
Step 6. Note the periodic shortcut. If the motion has period , then exactly, so the left side of Step 4 vanishes identically at — 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 and for gravity to , 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
We now specialize the general theorem to potentials that scale as a pure power of the coordinates and obtain equation (7), , together with the energy partition (8). The strategy is to trade the force virial for a statement about itself using Euler's identity for homogeneous functions — a one-line differentiation trick. The thing to watch is what "homogeneous of degree " 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 for all . A pair sum satisfies this, since each separation stretches by .
Step 2. Differentiate the scaling relation with respect to and set :
Why this works: the left side is the directional derivative of along the dilation flow, and the right side is what the explicit power of 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 , so
Step 4. Average and substitute into the general theorem (6):
Step 5. Read off the energy partition. With conserved, eliminate :
For : — check it directly: , consistent. For : , i.e. . Verified: for this gives and for it gives , matching Landau–Lifshitz §10; the limit correctly signals the logarithmic case, where 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 gives the generalized equipartition theorem,
where: — any phase-space coordinate, position or momentum; — the Kronecker delta; — the absolute temperature. Choosing gives — each momentum degree of freedom carries , the ensemble shadow of the in (2); choosing 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 says : the heat capacity is negative. Radiate energy away ( decreases) and 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: 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 gives — expectation values in place of time averages, with stationarity of the state playing the role that boundedness played classically. For hydrogen it yields exactly, a stringent test applied routinely to variational wavefunctions.
Go deeper · Derivation C · 1 minClausius'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 inward on the gas across each surface element (outward normal), so the time-averaged force on the gas near is and
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 in the first place.
Step 2. Apply the divergence theorem to the surface integral:
since 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:
with the total kinetic energy of molecules.
Step 4. Connect to temperature through equipartition, equation (9): each molecule carries , so
Verified: this recovers the ideal gas law exactly; with intermolecular forces restored, the same route generates the virial expansion — the historical origin of the name "virial coefficients."
Limiting cases
For a homogeneous potential the theorem reads , and the physically important exponents deserve a table of their own:
| case | result | meaning |
|---|---|---|
| gravity / Coulomb, | , | bound systems have ; virial mass estimates; negative heat capacity |
| harmonic oscillator, | equal average sharing — verifiable directly for | |
| constant force, | bouncing ball, particle column in uniform gravity | |
| logarithmic potential, | const | independent of orbit size — flat galactic rotation curves |
| free gas in a box, | wall virial only: Clausius's route to | |
| unbound (hyperbolic) motion | theorem fails | unbounded, : no relation survives |
Worked examples
1 · Checking the lock on a harmonic oscillator (confidence builder)
A block of mass oscillates on a spring with angular frequency and amplitude . Compute and over one period explicitly and verify the virial prediction.
Step 1. Write the motion and the two energies. With : and . Their sum is constant, .
Step 2. Average over one period. Since over a full period, and — equal, as the theorem demands.
Step 3. Check against the virial prediction. The spring potential is homogeneous of degree , so equation (7) says , i.e. , and equation (8) says . Both match the explicit averages.
Step 4. Note what would fail instantaneously. At the split is , — 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.
A rich cluster has line-of-sight velocity dispersion and characteristic radius . Estimate its virial mass and compare with the luminous mass, in stars plus in hot gas.
Step 1. Set up the gravitational virial. For a self-gravitating system in equilibrium, with and , where is a structure constant of order unity encoding the mass profile. Solving for the mass: .
Step 2. Get the order of magnitude first, ignoring all factors of order one: . With and :
Dividing by gives .
Step 3. Restore the honest factors. The line-of-sight dispersion sees one of three velocity components, so for isotropic orbits , pushing the estimate up to ; the profile constant pulls it back down by a factor of a few. The standard estimator (with a projected effective radius) packages both corrections. Honest statement: 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 — about 16 percent of the virial mass. Some 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 — comfortably shorter than the 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
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.
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 by the product rule; (2) check Euler's theorem step for ; (3) verify the harmonic () and Kepler () special cases; (4) confirm the ideal-gas derivation via and the divergence theorem giving . 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 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 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, automatically — stationarity does the job boundedness did classically — and expanding the commutator gives , formally identical to (6). For hydrogen this yields and exactly. It is also a working diagnostic: a variational wavefunction that badly violates the virial ratio is badly wrong, and "virial scaling" (rescaling 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 . Hard walls are handled exactly this way in derivation C. Magnetic forces contribute 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 by radiating heat or shedding energy to escaping members. The virial lock forces : the system gets hotter. The books balance through : the potential energy drops by 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, grows, 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 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 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 , which needs conservative forces but not homogeneity. For — the potential behind a flat rotation curve — is constant, so 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 limit of done correctly, since a logarithm is the limit of and stays finite.