Generalized Equipartition Theorem

The familiar equipartition rule — each quadratic term in the Hamiltonian carries 12kBT\tfrac12 k_BT — is only the shadow of a far more powerful statement. For any classical system in thermal equilibrium, described by phase-space coordinates x=(q1,…,q3N,p1,…,p3N)x=(q_1,\dots,q_{3N},p_1,\dots,p_{3N}) and Hamiltonian H(x)H(x), the canonical average obeys a single clean identity: ⟨xi ∂H/∂xj⟩=δij kBT\langle x_i\,\partial H/\partial x_j\rangle=\delta_{ij}\,k_BT. One equation, and out of it fall the heat capacity of a gas, the virial theorem, the pressure of an interacting fluid, and the corrections to ideal-gas behaviour. It is the master key of classical statistical mechanics. The proof is a one-line integration by parts. Because the Boltzmann weight e−βHe^{-\beta H} vanishes wherever H→∞H\to\infty — the physical requirement that the energy confines the system — the boundary terms drop out and each derivative of HH turns into a factor of kBTk_BT. Nothing in this argument requires HH to be quadratic, the coordinates to be Cartesian, or the particles to be free. That robustness is exactly why the theorem reaches so far: it handles anharmonic springs (bq4bq^4 gives 14kBT\tfrac14 k_BT), relativistic energies (c∣p∣c|\mathbf p| gives kBTk_BT per direction), and the forces between interacting molecules on the same footing. Two diagonal specializations dominate the applications. Set xi=xj=pkx_i=x_j=p_k, a momentum, and you recover kinetic equipartition and the heat capacities of gases and solids. Set xi=xj=qkx_i=x_j=q_k, a coordinate, sum over particles, and you get the Clausius virial and the equation of state. And because the identity is purely classical, its failures are equally informative: whenever a quantum level spacing rivals kBTk_BT, the continuous phase-space integral is illegal and equipartition breaks — vibrations freeze out, the Dulong-Petit law collapses, and the theorem's boundary is the boundary of classical physics itself.

Key takeaways
  • The generalized equipartition theorem states that for a classical system with Hamiltonian HH, the canonical average ⟨xi ∂H/∂xj⟩=δij kBT\langle x_i\,\partial H/\partial x_j\rangle=\delta_{ij}\,k_BT for any phase-space coordinates xi,xjx_i,x_j.
  • It follows from one integration by parts, using only that e−βH→0e^{-\beta H}\to0 at the boundaries of phase space.
  • Setting xi=xj=qx_i=x_j=q or pp recovers 12kBT\tfrac12 k_BT per quadratic degree of freedom; the off-diagonal (i≠ji\ne j) average vanishes.
  • For an energy homogeneous of degree nn in a variable, the theorem gives ⟨Hterm⟩=kBT/n\langle H_{\text{term}}\rangle=k_BT/n — quadratic 12kBT\tfrac12 k_BT, anharmonic quartic 14kBT\tfrac14 k_BT, linear (relativistic) kBTk_BT.
  • The momentum-diagonal case gives heat capacities; the coordinate-diagonal case gives the virial theorem and the virial equation of state.
  • It is intrinsically classical: quantization (level spacing ≳kBT\gtrsim k_BT) freezes degrees of freedom and breaks the theorem.
  • Key idea: every appearance of equipartition — the 12kBT\tfrac12 k_BT per mode, the kinetic energy of a gas, the virial of forces, the pressure of an interacting fluid — is the single identity ⟨xi ∂H/∂xj⟩=δijkBT\langle x_i\,\partial H/\partial x_j\rangle=\delta_{ij}k_BT, which is nothing more than an integration by parts on e−βHe^{-\beta H}.
The core insight

Every appearance of equipartition — the 12kBT\tfrac12 k_BT per mode, the kinetic energy of a gas, the virial of forces, the pressure of an interacting fluid — is the single phase-space identity ⟨xi ∂H/∂xj⟩=δijkBT\langle x_i\,\partial H/\partial x_j\rangle=\delta_{ij}k_BT, which is just an integration by parts on the Boltzmann factor e−βHe^{-\beta H}.

Where this lives today

The generalized theorem is a working instrument, not a museum piece. In molecular-dynamics and Monte-Carlo simulations it is how "temperature" is defined and checked: a thermostat measures ⟨pi ∂H/∂pi⟩\langle p_i\,\partial H/\partial p_i\rangle over the trajectory and adjusts the dynamics until it equals kBTk_BT for every degree of freedom — the equipartition test is the standard sanity check that a simulation has equilibrated. In single-molecule biophysics, the coordinate-diagonal case calibrates force probes: 12κ⟨x2⟩=12kBT\tfrac12\kappa\langle x^2\rangle=\tfrac12 k_BT turns a measured positional variance into a trap stiffness for optical tweezers and AFM cantilevers, and the anharmonic kBT/nk_BT/n generalization corrects the calibration when the trap is not perfectly harmonic. In astrophysics, the degree-1 relativistic case sets the specific heat of degenerate and radiation-dominated matter in stellar interiors and the early universe. And the theorem's coordinate branch, summed into the virial, remains the fastest route from a microscopic pair potential to the equation of state of a real gas or liquid.

The physical picture

Picture the canonical probability cloud ρ∝e−βH\rho\propto e^{-\beta H} draped over phase space. Wherever HH is small the cloud is thick; wherever HH grows large the cloud thins to nothing. The generalized equipartition theorem is a statement about how this cloud is shaped: it says that the average of xix_i times the local slope ∂H/∂xj\partial H/\partial x_j of the energy is exactly δijkBT\delta_{ij}k_BT. When you probe a coordinate against its own energy-slope (i=ji=j) you always get kBTk_BT; when you probe one coordinate against another's slope (i≠ji\ne j) the independent Gaussian wings cancel and you get zero. The reason the coefficient of a mode never matters is geometric. A stiff parabola confines the cloud to a narrow sliver; a soft one lets it spread wide. A stiff mode stores more energy per unit displacement but explores less displacement, and the two effects cancel to the last decimal. This is the same "energy democracy" that gives 12kBT\tfrac12 k_BT per quadratic term — but now stated so generally that it survives anharmonic and relativistic energies, where the share becomes kBT/nk_BT/n for a term homogeneous of degree nn.

Figure
The Boltzmann cloud rho ∝ exp(−βH) over a stiff parabola (narrow) and a soft one (wide). Both give the same ⟨x ∂H/∂x⟩ = kT — a stiff mode stores more per displacement but explores less, and the two cancel.
stiff H narrow cloud · ⟨x ∂H/∂x⟩ = kT soft H wide cloud · ⟨x ∂H/∂x⟩ = kT

The second figure is the punchline: the share of thermal energy per mode depends only on the degree of the energy in that variable, not on any coefficient. A quadratic term (n=2n=2) gets 12kBT\tfrac12 k_BT; a linear relativistic energy (n=1n=1) gets the full kBTk_BT; an anharmonic quartic (n=4n=4) gets a stingy 14kBT\tfrac14 k_BT. The rule ⟨Hterm⟩=kBT/n\langle H_{\text{term}}\rangle=k_BT/n is the theorem's most compact fingerprint, and it puts the classical harmonic oscillator, the photon-like ultrarelativistic gas, and the quartic anharmonic trap on one curve.

Figure
Punchline: thermal energy per mode is kT/n for an energy homogeneous of degree n. Linear (n=1) gets kT, quadratic (n=2) gets ½kT, quartic (n=4) gets ¼kT. The coefficient never enters — only the degree.
degree n of the energy term → ⟨H_term⟩ / kT 1 1/2 1/4 n=1: kT (relativistic) n=2: ½kT (quadratic) n=4: ¼kT (quartic) ⟨H_term⟩ = kT / n

The core equations

The heart of the article is a single phase-space average. It is stated for the canonical ensemble, but by ensemble equivalence it holds microcanonically too in the thermodynamic limit. The claim is that pairing any coordinate xix_i with the energy-gradient ∂H/∂xj\partial H/\partial x_j gives a strikingly simple answer.

⟨xi ∂H∂xj⟩=δij kBT(1)\left\langle x_i\,\frac{\partial H}{\partial x_j}\right\rangle = \delta_{ij}\,k_BT \qquad (1)

where: xi,xjx_i,x_j — any of the 6N6N canonical phase-space variables (coordinates qq or momenta pp); ∂H/∂xj\partial H/\partial x_j — the energy gradient, which is p˙j\dot p_j or −q˙j-\dot q_j by Hamilton's equations; δij\delta_{ij} — the Kronecker delta, 11 if i=ji=j else 00; ⟨⋅⟩\langle\cdot\rangle — the equilibrium thermal average. Reading it: a coordinate probed against its own energy-slope always returns kBTk_BT; against any other slope it returns zero, because the corresponding phase-space integrals factorize into independent, mean-symmetric pieces. Specializing the diagonal case to a single term homogeneous of degree nn gives the compact energy-share rule.

⟨Hterm⟩=kBTnfor Hterm∝x n(2)\left\langle H_{\text{term}}\right\rangle = \frac{k_BT}{n}\qquad\text{for }H_{\text{term}}\propto x^{\,n} \qquad (2)

where: nn — the degree of homogeneity of that energy term in the variable xx. Quadratic (n=2n=2) gives 12kBT\tfrac12 k_BT; the linear ultrarelativistic energy c∣p∣c|\mathbf p| (n=1n=1) gives kBTk_BT per component; an anharmonic quartic bq4bq^4 (n=4n=4) gives 14kBT\tfrac14 k_BT. This follows from equation (1) because x ∂(xn)/∂x=n xnx\,\partial(x^n)/\partial x=n\,x^n, so ⟨n Hterm⟩=kBT\langle n\,H_{\text{term}}\rangle=k_BT. Summed over all ff quadratic degrees of freedom, equation (2) gives the total energy and the classical heat capacity — the working payoff for gases and solids.

⟨H⟩=f2kBT,CV=f2kB (per molecule)=f2R (per mole)(3)\langle H\rangle=\frac f2 k_BT,\qquad C_V=\frac f2 k_B\ (\text{per molecule})=\frac f2 R\ (\text{per mole}) \qquad (3)

where: ff — the number of active quadratic degrees of freedom (each momentum and each harmonic coordinate counts once); R=NAkB=8.314 J mol−1K−1R=N_Ak_B=8.314\,\mathrm{J\,mol^{-1}K^{-1}}. Reading it: monatomic gas f=3f=3 gives CV=32RC_V=\tfrac32 R; a solid (3N3N oscillators, each two quadratic terms) gives 3R3R (Dulong-Petit). Finally, summing the coordinate-diagonal case over all particles produces the statistical virial theorem — the bridge to the equation of state.

⟨∑krk⋅Fk⟩=−3NkBT(4)\left\langle\sum_{k}\mathbf r_k\cdot\mathbf F_k\right\rangle = -3Nk_BT \qquad (4)

where: Fk=−∇kU\mathbf F_k=-\nabla_k U is the total force on particle kk (walls plus interactions), and the left side is the Clausius virial. Splitting Fk\mathbf F_k into a wall part (which yields −3PV-3PV) and an interaction part gives PV=NkBT+(interaction virial)PV=Nk_BT+(\text{interaction virial}) — the seed of the virial equation of state.

Derivation AThe theorem from one integration by parts

The goal is to prove the master identity ⟨xi ∂H/∂xj⟩=δijkBT\langle x_i\,\partial H/\partial x_j\rangle=\delta_{ij}k_BT for an arbitrary confining Hamiltonian, using nothing but the canonical average and integration by parts. The strategy is to write the average as a phase-space integral, rewrite the factor (∂H/∂xj) e−βH(\partial H/\partial x_j)\,e^{-\beta H} as a derivative of the Boltzmann factor, integrate by parts, and use that e−βHe^{-\beta H} vanishes on the boundaries so the surface term dies. What remains is ∂xi/∂xj=δij\partial x_i/\partial x_j=\delta_{ij}, delivering the result with no assumption that HH be quadratic.

Step 1. Write the canonical average ⟨xi∂H∂xj⟩=1Z∫xi ∂H∂xj e−βH dΓ\left\langle x_i\dfrac{\partial H}{\partial x_j}\right\rangle=\dfrac1Z\displaystyle\int x_i\,\dfrac{\partial H}{\partial x_j}\,e^{-\beta H}\,d\Gamma, where dΓd\Gamma is the phase-space volume element and Z=∫e−βHdΓZ=\int e^{-\beta H}d\Gamma the partition function.

Step 2. Notice that ∂H∂xj e−βH=−1β∂∂xj e−βH\dfrac{\partial H}{\partial x_j}\,e^{-\beta H}=-\dfrac1\beta\dfrac{\partial}{\partial x_j}\,e^{-\beta H}. This is the key move — the energy gradient is (up to −1/β-1/\beta) the gradient of the Boltzmann factor itself.

Step 3. Substitute and integrate by parts in xjx_j: ⟨xi∂H∂xj⟩=−1βZ∫xi ∂∂xje−βH dΓ=1βZ∫∂xi∂xj e−βH dΓ−1βZ[xie−βH]boundary\left\langle x_i\dfrac{\partial H}{\partial x_j}\right\rangle=-\dfrac{1}{\beta Z}\displaystyle\int x_i\,\dfrac{\partial}{\partial x_j}e^{-\beta H}\,d\Gamma=\dfrac{1}{\beta Z}\displaystyle\int\dfrac{\partial x_i}{\partial x_j}\,e^{-\beta H}\,d\Gamma-\dfrac{1}{\beta Z}\Big[x_i e^{-\beta H}\Big]_{\text{boundary}}. Why the boundary term vanishes. At the edges of phase space H→∞H\to\infty (a confining potential, or ∣p∣→∞|p|\to\infty for kinetic energy), so e−βH→0e^{-\beta H}\to0 faster than xix_i grows. The surface term is exactly zero — this is the sole physical assumption, and it is what "confined system" means.

Step 4. Use ∂xi/∂xj=δij\partial x_i/\partial x_j=\delta_{ij} and ∫e−βHdΓ=Z\int e^{-\beta H}d\Gamma=Z: the remaining integral is δijβZ∫e−βHdΓ=δijβ=δijkBT\dfrac{\delta_{ij}}{\beta Z}\displaystyle\int e^{-\beta H}d\Gamma=\dfrac{\delta_{ij}}{\beta}=\delta_{ij}k_BT, which is equation (1). Nothing here assumed HH quadratic. Verified: the diagonal result ⟨q ∂H/∂q⟩=1/β=kBT\langle q\,\partial H/\partial q\rangle=1/\beta=k_BT for H=aq2H=aq^2 and for H=bq4H=bq^4 (degree-independent), and the off-diagonal ⟨q1 ∂H/∂q2⟩=0\langle q_1\,\partial H/\partial q_2\rangle=0 for a separable HH, are confirmed symbolically in verify_aq-sm-generalized-equipartition-theorem.py.

Go deeper · Derivation B · 1 minThe energy-share rule and the anharmonic and relativistic cases
Derivation BThe energy-share rule and the anharmonic and relativistic cases

The goal is to turn the master identity into the practical rule ⟨Hterm⟩=kBT/n\langle H_{\text{term}}\rangle=k_BT/n for an energy homogeneous of degree nn, and to apply it to the anharmonic quartic (n=4n=4) and the ultrarelativistic gas (n=1n=1). The strategy is Euler's theorem on homogeneous functions: if a term scales as xnx^n, then x ∂Hterm/∂x=n Htermx\,\partial H_{\text{term}}/\partial x=n\,H_{\text{term}}, and the master identity fixes the average.

Step 1. Let a single energy term be Hterm=c xnH_{\text{term}}=c\,x^{n} (homogeneous of degree nn in the variable xx). Then x ∂Hterm∂x=x⋅cn xn−1=n c xn=n Htermx\,\dfrac{\partial H_{\text{term}}}{\partial x}=x\cdot cn\,x^{n-1}=n\,c\,x^{n}=n\,H_{\text{term}}.

Step 2. Take the thermal average and apply equation (1) with i=ji=j: ⟨x ∂H/∂x⟩=kBT\langle x\,\partial H/\partial x\rangle=k_BT, so ⟨n Hterm⟩=kBT\langle n\,H_{\text{term}}\rangle=k_BT, giving ⟨Hterm⟩=kBT/n\langle H_{\text{term}}\rangle=k_BT/n. This is equation (2). Why the degree, not the coefficient, sets the share. The coefficient cc cancels in the average (rescale x→x/c1/nx\to x/c^{1/n} and it disappears from both HtermH_{\text{term}} and the measure), while the power nn survives because it counts how fast the energy climbs — a steeper climb means a smaller average.

Step 3. Quadratic (n=2n=2): ⟨12aq2⟩=12kBT\langle\tfrac12 aq^2\rangle=\tfrac12 k_BT, ordinary equipartition. Quartic (n=4n=4): an anharmonic term bq4bq^4 gives ⟨bq4⟩=14kBT\langle bq^4\rangle=\tfrac14 k_BT — a stiff quartic trap stores less than a harmonic one at the same temperature.

Step 4. Ultrarelativistic gas: H=c∣p∣H=c|\mathbf p| is homogeneous of degree 11 in each of the three components together, so ∑jpj ∂H/∂pj=H\sum_j p_j\,\partial H/\partial p_j=H (Euler). Averaging and applying equation (1) to each component: ⟨H⟩=∑j⟨pj ∂H/∂pj⟩=3kBT\langle H\rangle=\sum_j\langle p_j\,\partial H/\partial p_j\rangle=3k_BT per particle — twice the nonrelativistic 32kBT\tfrac32 k_BT, because a linear energy gives kBTk_BT per direction. Verified: ⟨bq4⟩=14kBT\langle bq^4\rangle=\tfrac14 k_BT, ⟨cq6⟩=16kBT\langle cq^6\rangle=\tfrac16 k_BT (the kBT/nk_BT/n rule), the kinetic ⟨p2/2m⟩=12kBT\langle p^2/2m\rangle=\tfrac12 k_BT, and the Euler relation ∑jpj∂jH=H\sum_j p_j\partial_j H=H for E=c∣p∣E=c|\mathbf p| giving ⟨E⟩=3kBT\langle E\rangle=3k_BT, are confirmed symbolically in the verify script.

Limiting cases

The generalized theorem is the classical, high-temperature limit of more complete results; each row is a specialization or a place where it breaks.

CaseResultMeaning
Quadratic term, xi=xjx_i=x_j⟨12ax2⟩=12kBT\langle\tfrac12 ax^2\rangle=\tfrac12 k_BTOrdinary equipartition; the coefficient aa cancels.
Off-diagonal, i≠ji\ne j⟨xi ∂H/∂xj⟩=0\langle x_i\,\partial H/\partial x_j\rangle=0Independent modes are uncorrelated; only self-slopes give kBTk_BT.
Degree-nn homogeneous⟨Hterm⟩=kBT/n\langle H_{\text{term}}\rangle=k_BT/nQuartic 14kBT\tfrac14 k_BT, linear (relativistic) kBTk_BT.
Coordinate-diagonal, summed⟨∑r⋅F⟩=−3NkBT\langle\sum\mathbf r\cdot\mathbf F\rangle=-3Nk_BTThe virial theorem; wall part →PV\to PV.
kBT≲ℏωk_BT\lesssim\hbar\omega (quantum)theorem failsPhase-space integral illegal; mode freezes out.

Worked examples

Example 1 — Heat capacity of an anharmonic trap versus a harmonic one (enumerate, apply, boundary number). A single particle sits in a one-dimensional trap. Compare its average potential energy for a harmonic trap U=12κx2U=\tfrac12\kappa x^2 and for a quartic trap U=bx4U=bx^4, both at temperature TT.

Step 1. Enumerate the energy terms. Harmonic: one quadratic potential term, degree n=2n=2. Quartic: one potential term, degree n=4n=4. In both cases the kinetic energy p2/2mp^2/2m is a separate quadratic term (degree 2).

Step 2. Apply the kBT/nk_BT/n rule. Harmonic potential: ⟨U⟩=12kBT\langle U\rangle=\tfrac12 k_BT; total ⟨E⟩=12kBT+12kBT=kBT\langle E\rangle=\tfrac12 k_BT+\tfrac12 k_BT=k_BT. Quartic potential: ⟨U⟩=14kBT\langle U\rangle=\tfrac14 k_BT; total ⟨E⟩=12kBT+14kBT=34kBT\langle E\rangle=\tfrac12 k_BT+\tfrac14 k_BT=\tfrac34 k_BT.

Step 3. Boundary number. The heat capacities are Charmonic=kBC_{\text{harmonic}}=k_B and Cquartic=34kBC_{\text{quartic}}=\tfrac34 k_B. A quartic trap has 75%75\% of the heat capacity of a harmonic one — a directly measurable classical signature of anharmonicity, and the reason real solids deviate from Dulong-Petit even before quantum freeze-out.

Example 2 — Kinetic energy of an ultrarelativistic electron gas. Consider electrons hot enough that kBT≫mec2k_BT\gg m_ec^2, so their energy is E≈c∣p∣E\approx c|\mathbf p| (linear dispersion).

Step 1. The energy is homogeneous of degree 11 in the momentum magnitude; there are three momentum directions.

Step 2. By the theorem, ⟨E⟩=3kBT\langle E\rangle=3k_BT per particle (each direction contributes kBTk_BT, not 12kBT\tfrac12 k_BT).

Step 3. Boundary number. At T=1010 KT=10^{10}\,\mathrm K (relativistic astrophysical plasma), kBT=1.38×10−13 Jk_BT=1.38\times10^{-13}\,\mathrm J, so ⟨E⟩=3kBT=4.14×10−13 J≈2.6 MeV\langle E\rangle=3k_BT=4.14\times10^{-13}\,\mathrm J\approx2.6\,\mathrm{MeV} per electron — well above the 0.511 MeV0.511\,\mathrm{MeV} rest energy, confirming the ultrarelativistic regime is self-consistent. The factor of 2 over the nonrelativistic 32kBT\tfrac32 k_BT raises the specific heat of relativistic matter, a fact that matters for the interiors of stars and the early universe.

Origins · 1 minenergy equipartition and how this was discovered
EE
energy equipartition
statistical-mechanics concept · Boltzmann 1868, Tolman 1918 general form

The generalized equipartition theorem ⟨xi ∂H/∂xj⟩=δijkBT\langle x_i\,\partial H/\partial x_j\rangle=\delta_{ij}k_BT extends Maxwell's and Boltzmann's quadratic equipartition to arbitrary Hamiltonians. Maxwell (1859) first argued that energy is shared equally among molecular degrees of freedom; Boltzmann (1868–1871) generalized it to any quadratic term and connected it to the virial. Richard Tolman gave the theorem its modern general phase-space form in the 1910s–1920s, showing that the single integration-by-parts identity subsumes kinetic equipartition, the virial theorem, and the pressure of interacting gases. The theorem's dramatic failures — the frozen heat capacities of diatomic gases and the ultraviolet catastrophe — were among the clearest classical anomalies driving the quantum revolution.

History
1859
— Maxwell argues energy is shared equally among translational and rotational degrees of freedom.
1868
— Boltzmann generalizes equipartition to arbitrary quadratic degrees of freedom and links it to the virial.
1870
— Clausius states the virial theorem, connecting time-averaged kinetic energy to the virial of the forces.
1900
— Rayleigh applies equipartition to blackbody radiation, exposing the ultraviolet catastrophe.
1918
— Tolman presents the general phase-space form of the equipartition theorem.

Going further

References. Pathria & Beale, Statistical Mechanics, 3rd ed., §3.7 (equipartition and virial theorems) · Reif, Fundamentals of Statistical and Thermal Physics, §7.5–7.7 · Kardar, Statistical Physics of Particles, §4.3 · Tolman, The Principles of Statistical Mechanics, Ch. 3 · Landau & Lifshitz, Statistical Physics Part 1, §28.

Provenance. The identity ⟨xi ∂H/∂xj⟩=δijkBT\langle x_i\,\partial H/\partial x_j\rangle=\delta_{ij}k_BT, the energy-share rule ⟨Hterm⟩=kBT/n\langle H_{\text{term}}\rangle=k_BT/n, and the virial specialization are standard (Pathria §3.7, Tolman Ch. 3). A verifier should confirm: (i) ⟨q ∂H/∂q⟩=1/β=kBT\langle q\,\partial H/\partial q\rangle=1/\beta=k_BT for H=aq2H=aq^2 and for H=bq4H=bq^4 (degree-independent); (ii) ⟨bq4⟩=14kBT\langle bq^4\rangle=\tfrac14 k_BT and ⟨cq6⟩=16kBT\langle cq^6\rangle=\tfrac16 k_BT (the kBT/nk_BT/n rule); (iii) the off-diagonal ⟨q1 ∂H/∂q2⟩=0\langle q_1\,\partial H/\partial q_2\rangle=0; (iv) ⟨p2/2m⟩=12kBT\langle p^2/2m\rangle=\tfrac12 k_BT; (v) ∑jpj ∂H/∂pj=H\sum_j p_j\,\partial H/\partial p_j=H for E=c∣p∣E=c|\mathbf p|, giving ⟨E⟩=3kBT\langle E\rangle=3k_BT. All checks are in verify_aq-sm-generalized-equipartition-theorem.py. Constants: kB=1.380649×10−23 J/Kk_B=1.380649\times10^{-23}\,\mathrm{J/K}, R=8.314 J mol−1K−1R=8.314\,\mathrm{J\,mol^{-1}K^{-1}}.

Builds on: Equipartition Theorem · Classical Ideal Gas · Maxwell-Boltzmann Velocity Distribution Leads to: Virial Theorem in Statistical Mechanics · Virial Equation of State · Classical Limit of Quantum Statistics

How is the "generalized" theorem different from ordinary equipartition?

Ordinary equipartition is a rule about quadratic terms: each contributes 12kBT\tfrac12 k_BT. The generalized theorem is the phase-space identity ⟨xi ∂H/∂xj⟩=δijkBT\langle x_i\,\partial H/\partial x_j\rangle=\delta_{ij}k_BT that holds for any confining Hamiltonian, quadratic or not. Ordinary equipartition is the special case xi=xj=qx_i=x_j=q with H=aq2H=aq^2. But the general form also handles anharmonic energies (a q4q^4 term gives 14kBT\tfrac14 k_BT), relativistic dispersion (c∣p∣c|\mathbf p| gives kBTk_BT per direction), and — through the coordinate-diagonal case summed over particles — the virial theorem and the pressure of an interacting gas. It is one identity that unifies several results that look unrelated in the elementary treatment.

Why does the coefficient of the energy term never appear in the average?

Because it cancels between the energy and the measure. For a term Hterm=c xnH_{\text{term}}=c\,x^n, rescaling x→x/c1/nx\to x/c^{1/n} removes cc from the energy entirely, appearing only as an overall constant in both the numerator and denominator of the thermal average — so it drops out. Physically, a larger coefficient makes the mode stiffer (more energy per unit xx) but also confines it to a smaller range of xx, and the two effects cancel exactly. Only the degree nn survives, giving the share kBT/nk_BT/n. This is why a stiff and a soft spring in the same bath store identical average energy.

What exactly is the "boundary term" and why must it vanish?

When you integrate by parts, you generate a surface term [xi e−βH][x_i\,e^{-\beta H}] evaluated at the edges of the integration region. For the theorem to hold, this must be zero. It vanishes because a physical Hamiltonian confines the system: as any coordinate or momentum runs to ±∞\pm\infty, the energy H→∞H\to\infty, so e−βHe^{-\beta H} decays to zero faster than the polynomial factor xix_i can grow. If a coordinate were not confined — say a free particle in an infinite box with no walls — the boundary term would not vanish, and that degree of freedom would not obey equipartition. The confining requirement is the theorem's only physical assumption.

How does the theorem give the virial theorem?

Take the diagonal case with a coordinate, ⟨qk ∂H/∂qk⟩=kBT\langle q_k\,\partial H/\partial q_k\rangle=k_BT, and note ∂H/∂qk=−Fk\partial H/\partial q_k=-F_k (the force). Summing over all 3N3N coordinates gives ⟨∑krk⋅Fk⟩=−3NkBT\langle\sum_k\mathbf r_k\cdot\mathbf F_k\rangle=-3Nk_BT, which is the Clausius virial. Splitting the force into the wall (container) part and the interparticle part, the wall part integrates to −3PV-3PV, giving PV=NkBT+13⟨∑pairsrij⋅Fij⟩PV=Nk_BT+\tfrac13\langle\sum_{\text{pairs}}\mathbf r_{ij}\cdot\mathbf F_{ij}\rangle. The interaction term is the configurational virial that generates the virial equation of state. So the virial theorem is literally the coordinate branch of the generalized equipartition identity.

Does the theorem hold in the microcanonical ensemble too?

Yes, in the thermodynamic limit. The cleanest derivation uses the canonical Boltzmann factor, but the result is ensemble-equivalent: the microcanonical and canonical averages of xi ∂H/∂xjx_i\,\partial H/\partial x_j agree to leading order in 1/N1/N, both giving δijkBT\delta_{ij}k_BT, with the microcanonical temperature defined by 1/T=∂S/∂E1/T=\partial S/\partial E. There is a subtlety — the microcanonical version is sometimes written with ∂S/∂E\partial S/\partial E replacing β\beta, and for small systems the two ensembles differ at order 1/N1/N — but for any macroscopic system the distinction is negligible and the theorem is robust.

Why does a relativistic gas have twice the energy per direction?

Because its energy is linear in momentum, not quadratic. For a nonrelativistic gas, E=p2/2mE=p^2/2m is homogeneous of degree 22, so each direction gives 12kBT\tfrac12 k_BT. For an ultrarelativistic gas, E=c∣p∣E=c|\mathbf p| is homogeneous of degree 11, and the rule kBT/nk_BT/n with n=1n=1 gives the full kBTk_BT per direction — total 3kBT3k_BT per particle in three dimensions. The physical reason: a linear energy climbs more gently away from the origin, so the Boltzmann cloud spreads wider and stores more thermal energy before the weight cuts it off. This doubling raises the heat capacity of radiation-dominated and relativistic matter.

Can I use the general theorem to spot when a mode is anharmonic experimentally?

Yes — measure the mode's contribution to the heat capacity and compare it to the harmonic prediction. A purely quadratic mode contributes kBk_B (kinetic + potential, 12kB\tfrac12 k_B each); a purely quartic potential contributes only 12kB+14kB=34kB\tfrac12 k_B+\tfrac14 k_B=\tfrac34 k_B. A measured heat capacity below the harmonic value (but above zero, so not frozen out) is a fingerprint of anharmonicity, encoded in the effective degree nn of the potential. This is exactly how the thermal expansion and specific-heat anomalies of strongly anharmonic crystals are read: the kBT/nk_BT/n share of a soft, anharmonic mode differs measurably from the harmonic 12kBT\tfrac12 k_BT.

Before this

Where this leads