Corrections to the Ideal Gas

The ideal-gas law PV=NkBTPV=Nk_BT is a beautiful lie. It says the pressure of a gas depends only on how many molecules you pack into a box and how hot they are — never on what the molecules are. Argon, nitrogen, and steam would all push on the walls identically at the same density and temperature. Real gases obey this only in the limit of vanishing density; the moment molecules are close enough to feel one another, two competing effects appear. Molecules take up room and cannot interpenetrate, a short-range repulsion that raises the pressure above ideal; and they attract one another across the intervening space, a longer-range pull that lowers it. This article is about the first honest correction to the fiction, and how much physics is already hiding in it. The organizing idea is that deviations from ideality are a power series in the number density n=N/Vn=N/V — the virial expansion P/kBT=n+B2(T) n2+B3(T) n3+⋯P/k_BT = n + B_2(T)\,n^2 + B_3(T)\,n^3 + \cdots. Each coefficient Bℓ(T)B_\ell(T) measures how a cluster of ℓ\ell molecules, feeling their mutual potential u(r)u(r), changes the equation of state. The leading coefficient B2(T)B_2(T) is a single, finite integral over the pair potential, and it alone reveals excluded volume, molecular attraction, and a special temperature — the Boyle temperature — where a real gas mimics an ideal one to first order in density. What makes this the gateway to the whole theory of interacting gases is that B2B_2 is both computable and measurable. Feed in a model potential like Lennard-Jones and you predict B2(T)B_2(T) from first principles; measure it from pressure-volume data and you test the potential. And when you resum the leading repulsive and attractive pieces, out drops the van der Waals equation — the first equation of state ever written that knows about liquids. This article states the problem and interprets B2B_2; the cluster machinery that produces it lives in the sibling articles it points to.

Key takeaways
  • Real gases deviate from PV=NkBTPV=Nk_BT because molecules have finite size (repulsion, raises pressure) and attract one another (lowers pressure); both vanish only as n→0n\to0.
  • The deviations are organized as a power series in the number density n=N/Vn=N/V: the virial expansion P/kBT=n+B2(T) n2+⋯P/k_BT = n + B_2(T)\,n^2 + \cdots.
  • The second virial coefficient B2(T)=−12∫f(r) d3rB_2(T) = -\tfrac12\int f(r)\,\mathrm d^3r (with the Mayer function f=e−βu−1f=e^{-\beta u}-1) is a single finite integral over the pair potential — positive when repulsion wins, negative when attraction wins.
  • For a hard core plus attraction it splits as B2=b−a/kBTB_2 = b - a/k_BT with excluded volume b=23πd3=4vmoleculeb=\tfrac23\pi d^3 = 4v_{\text{molecule}}; this reproduces the van der Waals equation.
  • The Boyle temperature TB=a/(bkB)T_B = a/(bk_B) is where B2=0B_2=0 and the gas is "accidentally ideal"; for argon TB≈410T_B\approx 410 K.
  • Key idea: every deviation from the ideal gas is governed by one small parameter — the density — and the leading coefficient B2(T)B_2(T) is a finite, computable integral over the pair potential that already encodes excluded volume, attraction, and the Boyle temperature.
The core insight

Deviations from ideal-gas behavior are governed by a single small parameter, the density nn, and the leading coefficient B2(T)=−12∫f(r) d3rB_2(T)=-\tfrac12\int f(r)\,\mathrm d^3r is a finite, computable integral over the pair potential that encodes excluded volume, molecular attraction, and the Boyle temperature all at once.

Where this lives today

The second virial coefficient is no longer merely a textbook correction — it underpins primary metrology. For helium, the pair (and even three-body) potentials can now be computed from first-principles quantum chemistry to extraordinary accuracy, and the resulting B2(T)B_2(T) and B3(T)B_3(T) are calculated with uncertainties smaller than any measurement. Acoustic and dielectric-constant gas thermometry exploits exactly these ab-initio virial coefficients to realize the kelvin and to help fix the value of the Boltzmann constant in the 2019 redefinition of the SI. A quantity introduced to fudge the ideal-gas law now helps define temperature itself. At the other end, the virial framework remains the backbone of engineering thermodynamics. Truncated virial series and their descendants — van der Waals, Redlich–Kwong, Peng–Robinson — are the working equations of state for gases and refrigerants, and the cluster expansion explains both why they succeed at moderate density and why they must fail near the critical point, where all virial coefficients contribute at once. The same density expansion, with the classical Mayer function replaced by its quantum analogue, gives the second virial coefficient of dilute Bose and Fermi gases and connects, through the scattering length, to the physics of ultracold atoms — the modern laboratory where the corrections to the ideal gas are measured one collision at a time.

The physical picture

Start with the ideal gas: NN point molecules, each roaming the full volume VV freely, oblivious to the others. Now give each molecule a small hard core so that no two centers can approach closer than a diameter dd. Every molecule now excludes a little volume around itself from all the others; the configuration space each one can explore shrinks, its entropy drops, and — since pressure is entropy's response to squeezing — the pressure climbs above the ideal value. This is the repulsive, positive contribution to B2B_2, and it is purely geometric: it depends on the size of the molecules, not on temperature. Now switch on a weak attraction between molecules at moderate separations, the kind that eventually condenses a gas into a liquid. A molecule near a neighbor sits in a shallow potential well, lowers its energy, and lingers — the gas is slightly more compressible than ideal, and the pressure falls. This attractive piece does depend on temperature: at high TT the fast-moving molecules barely notice the shallow well and only the hard core matters, so B2>0B_2>0; at low TT they dwell in the well and attraction wins, so B2<0B_2<0. The crossover, where the two exactly cancel to first order in density, is the Boyle temperature TBT_B — the temperature at which a real gas fakes being ideal over a surprisingly wide density range.

Figure
The compressibility factor Z = PV/Nk_BT versus temperature at fixed density: below the Boyle temperature T_B attraction dips Z below 1, above T_B excluded volume lifts Z above 1, and the curve crosses Z=1 exactly at T_B (argon ≈ 410 K)
Z = PV/Nk_BT T Z = 1 (ideal) T_B ≈ 410 K Z under 1: attraction B₂ negative Z over 1: excluded volume B₂ positive Z − 1 = B₂(T) n → sign flips at the Boyle temperature

The reason the density is the right expansion parameter — and not the strength of the interaction — is a matter of counting encounters. The relevant small number is n vintn\,v_{\text{int}}, the number of other molecules inside one molecule's interaction sphere of volume vintv_{\text{int}}. When this is small, a given molecule usually feels no one; occasionally it feels one partner (giving B2 n2B_2\,n^2); a simultaneous three-body encounter is rarer by another factor of n vintn\,v_{\text{int}} (giving B3 n3B_3\,n^3), and so on. Each virial coefficient carries one more power of density because it describes one more molecule crowding into the interaction volume. Crucially, each coefficient is exact in the coupling: even a violently strong potential contributes a finite B2B_2, because the object being integrated is not u(r)u(r) but the tame Mayer function.

Figure
The pair potential u(r) split into the repulsive core (r < d, contributing the excluded volume b) and the attractive tail (r > d, contributing −a/k_BT); the Mayer function f = exp(−βu)−1 saturates at −1 in the core and is bounded everywhere, which is why B₂ is finite even though u diverges
u(r) r d hard core: u → +∞ r inside d → excluded volume b attractive well: u negative r beyond d → attraction a/k_BT f = e^(−βu) − 1 f → −1 in the core (bounded!) B₂ = −½ ∫ f d³r is finite because f is bounded, even though u is not

The core equations

The reference against which every correction is measured is the ideal gas: at fixed density and temperature its pressure is set entirely by counting molecules, independent of their chemistry.

PVNkBT=1(ideal gas, exact as n→0)(1)\frac{PV}{Nk_BT}=1 \qquad\text{(ideal gas, exact as }n\to0) \qquad (1)

where: PP — pressure; VV — volume; NN — molecule number; TT — temperature; kBk_B — Boltzmann constant. The whole subject is the study of how the left-hand side departs from 11 as the density rises — a departure we call the compressibility factor Z=PV/NkBTZ=PV/Nk_BT. The systematic way to organize those departures is a power series in the number density. Because a molecule feels its neighbors more often the denser the gas, expanding in n=N/Vn=N/V arranges the corrections by how many molecules interact simultaneously.

PkBT=n+B2(T) n2+B3(T) n3+⋯(2)\frac{P}{k_BT}=n+B_2(T)\,n^2+B_3(T)\,n^3+\cdots \qquad (2)

where: n=N/Vn=N/V — number density, the expansion parameter; Bℓ(T)B_\ell(T) — the ℓ\ell-th virial coefficient, a function of temperature only. Equivalently Z=1+B2n+B3n2+⋯Z = 1 + B_2 n + B_3 n^2 + \cdots. The pair coefficient B2B_2 dominates at low density; each higher BℓB_\ell describes one more molecule joining the encounter and is suppressed by another power of nn. All the interaction physics enters through the configuration integral, the part of the partition function that knows about positions rather than momenta. For the ideal gas it is just VNV^N; interactions replace it by a Boltzmann-weighted integral over all arrangements.

ZN=QNN! λ3N,QN=∫e−β∑i<ju(rij) d3Nr(3)Z_N=\frac{Q_N}{N!\,\lambda^{3N}},\qquad Q_N=\int e^{-\beta\sum_{i<j}u(r_{ij})}\,\mathrm d^{3N}r \qquad (3)

where: ZNZ_N — canonical partition function; λ=h/2πmkBT\lambda=h/\sqrt{2\pi mk_BT} — thermal de Broglie wavelength; QNQ_N — configuration integral, QN=VNQ_N=V^N when u=0u=0; u(rij)u(r_{ij}) — pair potential; β=1/kBT\beta=1/k_BT. The full derivation of this factorization is owned by aq-sm-configuration-integral; here it is the input that isolates all non-ideality inside QN/VNQ_N/V^N. The trick that makes the many-body integral tractable is to expand the Boltzmann weight not in the potential uu — which diverges in the hard core — but in the Mayer function, which is bounded and short-ranged.

f(r)≡e−βu(r)−1(4)f(r)\equiv e^{-\beta u(r)}-1 \qquad (4)

where: f(r)f(r) — the Mayer function, f→−1f\to-1 where u→+∞u\to+\infty (the hard core), f→0f\to0 where u→0u\to0 (beyond the interaction range), and f>0f>0 inside a low-temperature attractive well. Because ff has compact support, every cluster integral built from it is finite. Its properties are owned by aq-sm-mayer-f-function; this article uses ff to interpret B2B_2. Carrying the cluster expansion to its lowest nontrivial order yields the leading correction as a single integral of ff — the second virial coefficient. This is the equation the whole article revolves around.

B2(T)=−12∫f(r) d3r=−12∫(e−βu(r)−1) d3r(5)B_2(T)=-\frac12\int f(r)\,\mathrm d^3r=-\frac12\int\bigl(e^{-\beta u(r)}-1\bigr)\,\mathrm d^3r \qquad (5)

where: B2(T)B_2(T) — the second virial coefficient, dimensions of volume; the factor −12-\tfrac12 comes from counting the (N2)≈N2/2\binom{N}{2}\approx N^2/2 interacting pairs. It is positive when repulsion dominates (hard core, f<0f<0 makes the integral negative, so B2>0B_2>0) and negative when attraction dominates (f>0f>0 in the well). One integral over the pair potential controls the entire leading deviation from ideality. For a realistic potential — a hard core of diameter dd plus a weak attractive tail — the integral splits into a temperature-independent excluded-volume piece and a temperature-dependent attractive piece, giving the two van der Waals constants.

B2(T)=b−akBT,b=23πd3=4vmolecule,a=−12∫r>du(r) d3r(6)B_2(T)=b-\frac{a}{k_BT},\qquad b=\frac{2}{3}\pi d^3=4v_{\text{molecule}},\qquad a=-\frac12\int_{r>d}u(r)\,\mathrm d^3r \qquad (6)

where: bb — the excluded-volume constant, equal to four times the volume of one molecule of diameter dd; a>0a>0 — the attraction constant (the tail has u<0u<0, so the integral of −u-u is positive). The high-temperature limit B2→bB_2\to b is pure excluded volume; the low-temperature limit is dominated by −a/kBT-a/k_BT. These are exactly the phenomenological constants of the van der Waals equation, now derived rather than fitted.

The core equations, resummed

Truncating the virial series at B2B_2 and resumming the repulsive part geometrically recovers the equation of state that first described a liquid.

(P+aN2V2)(V−Nb)=NkBT(7)\Bigl(P+\frac{aN^2}{V^2}\Bigr)(V-Nb)=Nk_BT \qquad (7)

where: a,ba,b — the constants identified from B2B_2; V−NbV-Nb — the volume actually available after excluded volume is removed; aN2/V2aN^2/V^2 — the internal-pressure reduction from attraction. The full derivation and the coexistence (Maxwell) construction are forwarded to aq-sm-van-der-waals-equation and aq-sm-maxwell-construction; this article shows only that B2B_2 is their microscopic parent.

Derivation AThe second virial coefficient from the configuration integral

The goal is to see exactly where B2=−12∫f d3rB_2=-\tfrac12\int f\,\mathrm d^3r comes from, so that its sign and its factor of one-half are not mysterious. We start from the configuration integral of NN interacting molecules, keep only the lowest-order correction in density (a single interacting pair), compute the resulting free energy and pressure, and match to the virial series to read off the coefficient of n2n^2. The one thing to watch is the pair counting: there are (N2)≈N2/2\binom{N}{2}\approx N^2/2 ways to pick the interacting pair, and it is that combinatorial factor that produces the −12-\tfrac12. The machinery of higher clusters is not needed here and is owned by aq-sm-mayer-cluster-expansion.

Step 1. Factorize the Boltzmann weight over pairs and keep the leading term: e−β∑i<juij=∏i<j(1+fij)≈1+∑i<jfije^{-\beta\sum_{i<j}u_{ij}}=\prod_{i<j}(1+f_{ij})\approx 1+\sum_{i<j}f_{ij}. Why: at low density it is unlikely for more than one pair to be within range at once, so the single-ff term dominates and every higher product is suppressed by another power of nn.

Step 2. Insert into the configuration integral. Integrating one pair's ff over its center of mass gives a factor VV, and there are (N2)\binom{N}{2} pairs, so QN≈VN[1+N22V∫f d3r]Q_N\approx V^N\bigl[1+\tfrac{N^2}{2V}\int f\,\mathrm d^3r\bigr]. Why: translation invariance turns the six-dimensional pair integral into VV times the intensive radial integral ∫f d3r\int f\,\mathrm d^3r, and (N2)≈N2/2\binom{N}{2}\approx N^2/2 counts the pairs.

Step 3. Take the free energy with ln⁡(1+x)≈x\ln(1+x)\approx x: F=−kBTln⁡ZN=Fideal−kBT N22V∫f d3rF=-k_BT\ln Z_N=F_{\text{ideal}}-k_BT\,\tfrac{N^2}{2V}\int f\,\mathrm d^3r. Why: the correction is small at low density, so the logarithm linearizes; the ideal part is the usual −kBTln⁡(VN/N!λ3N)-k_BT\ln(V^N/N!\lambda^{3N}) and carries no interaction information.

Step 4. Differentiate to get the pressure: P=−∂F/∂V=NkBTV−kBT N22V2∫f d3rP=-\partial F/\partial V=\tfrac{Nk_BT}{V}-k_BT\,\tfrac{N^2}{2V^2}\int f\,\mathrm d^3r. Dividing by kBTk_BT and writing n=N/Vn=N/V gives P/kBT=n+[−12∫f d3r]n2P/k_BT=n+\bigl[-\tfrac12\int f\,\mathrm d^3r\bigr]n^2. Why: only the volume-dependent correction survives differentiation; comparing with the virial expansion P/kBT=n+B2n2+⋯P/k_BT=n+B_2 n^2+\cdots identifies the bracket as B2B_2. *Verified: the sign and the factor −12-\tfrac12 of B2=−12∫f d3rB_2=-\tfrac12\int f\,\mathrm d^3r are checked symbolically in verify_corrections-to-ideal-gas.py, reproducing Pathria & Beale Ch. 9 and Kardar §5.2.*

Go deeper · Derivation B · 1 minThe van der Waals split and the Boyle temperature
Derivation BThe van der Waals split and the Boyle temperature

Here the goal is to evaluate B2B_2 for a hard-core-plus-attraction potential, obtain the van der Waals constants bb and aa explicitly, and locate the Boyle temperature where B2B_2 vanishes. The route is to split the B2B_2 integral at the hard-core radius dd: inside the core the Mayer function is exactly −1-1, and outside it the attractive tail is weak enough to linearize the exponential. The subtle point is that the excluded-volume constant bb is four times the molecular volume, not one — a factor that trips up almost everyone the first time. The full resummation into the van der Waals equation is forwarded to aq-sm-van-der-waals-equation.

Step 1. Split the integral: B2=−12∫r<d(−1) d3r−12∫r>d(e−βu−1)d3rB_2=-\tfrac12\int_{r<d}(-1)\,\mathrm d^3r-\tfrac12\int_{r>d}\bigl(e^{-\beta u}-1\bigr)\mathrm d^3r. Why: inside the hard core u=+∞u=+\infty so f=−1f=-1 exactly; outside, uu is a weak attraction and we can treat the exponential to first order.

Step 2. Evaluate the core piece: −12∫r<d(−1) d3r=12⋅43πd3=23πd3≡b-\tfrac12\int_{r<d}(-1)\,\mathrm d^3r=\tfrac12\cdot\tfrac43\pi d^3=\tfrac23\pi d^3\equiv b. This is the excluded volume. Notice b=23πd3=4⋅43π(d/2)3=4vmoleculeb=\tfrac23\pi d^3=4\cdot\tfrac43\pi(d/2)^3=4v_{\text{molecule}} — four times the volume of one molecule. Why: two hard spheres of diameter dd cannot approach closer than dd center-to-center, so the volume excluded to a pair is a sphere of radius dd (eight molecular volumes), shared between two particles, giving four per molecule.

Step 3. Evaluate the tail piece with e−βu−1≈−βue^{-\beta u}-1\approx-\beta u: −12∫r>d(−βu) d3r=β2∫r>du d3r=−akBT-\tfrac12\int_{r>d}(-\beta u)\,\mathrm d^3r=\tfrac{\beta}{2}\int_{r>d}u\,\mathrm d^3r=-\frac{a}{k_BT}, where a=−12∫r>du d3r>0a=-\tfrac12\int_{r>d}u\,\mathrm d^3r>0 because u<0u<0 in the well. Why: the shallow attractive tail satisfies β∣u∣≪1\beta|u|\ll1 for the temperatures of interest, so linearizing is accurate, and the negative uu makes aa positive.

Step 4. Assemble and find the Boyle temperature: B2(T)=b−a/kBTB_2(T)=b-a/k_BT, which vanishes at TB=a/(bkB)T_B=a/(bk_B). Above TBT_B excluded volume wins (B2>0B_2>0, Z>1Z>1); below TBT_B attraction wins (B2<0B_2<0, Z<1Z<1). Why: the two constants have opposite temperature dependence, so their difference must cross zero exactly once — that crossing is the temperature where the gas is ideal to first order in density. *Verified: the split B2=b−a/kBTB_2=b-a/k_BT, the excluded-volume factor b=23πd3=4vmoleculeb=\tfrac23\pi d^3=4v_{\text{molecule}}, the reduction of the truncated virial series to the van der Waals form, and the Boyle temperature TB=a/(bkB)T_B=a/(bk_B) are all checked in verify_corrections-to-ideal-gas.py.*

Limiting cases

The behavior of the leading correction B2(T)B_2(T) across physically transparent regimes:

CaseResultMeaning
Dilute / ideal (n vint→0n\,v_{\text{int}}\to0)P/kBT=n [1+O(n)]P/k_BT=n\,[1+\mathcal O(n)]Interaction volume per molecule negligible; PV=NkBTPV=Nk_BT recovered exactly.
High temperatureB2→b=23πd3  (>0)B_2\to b=\tfrac23\pi d^3\;(>0)The attractive tail is thermally washed out; only excluded volume survives, so Z>1Z>1.
Low temperatureB2≈b−a/kBT<0B_2\approx b-a/k_BT<0The attractive well dominates; the gas is more compressible than ideal, Z<1Z<1.
Boyle temperatureB2(TB)=0, kBTB=a/bB_2(T_B)=0,\ k_BT_B=a/bRepulsion and attraction cancel to first order; the gas tracks the ideal isotherm over an extended density range.
Hard spheres (no attraction)B2=23πd3=4vmoleculeB_2=\tfrac23\pi d^3=4v_{\text{molecule}}, TT-independentPure excluded volume; Z>1Z>1 at all temperatures, the classic factor-of-four result.

Worked examples

1 · The excluded volume of a hard-sphere gas (confidence builder)

We compute B2B_2 for hard spheres of diameter dd directly and recover the famous factor of four.

Step 1. For hard spheres, u=+∞u=+\infty for r<dr<d and u=0u=0 for r>dr>d, so the Mayer function is f=−1f=-1 for r<dr<d and f=0f=0 for r>dr>d. The integral is ∫f d3r=−∫0d4πr2 dr=−43πd3\int f\,\mathrm d^3r=-\int_0^d 4\pi r^2\,\mathrm dr=-\tfrac43\pi d^3.

Step 2. The second virial coefficient is B2=−12∫f d3r=+12⋅43πd3=23πd3B_2=-\tfrac12\int f\,\mathrm d^3r=+\tfrac12\cdot\tfrac43\pi d^3=\tfrac23\pi d^3. It is positive and temperature-independent, as expected for pure repulsion.

Step 3. Compare with molecular volume. One molecule modeled as a sphere of diameter dd (radius d/2d/2) has volume vmolecule=43π(d/2)3=16πd3v_{\text{molecule}}=\tfrac43\pi(d/2)^3=\tfrac16\pi d^3. Therefore B2=23πd3=4 vmoleculeB_2=\tfrac23\pi d^3=\mathbf{4\,v_{\text{molecule}}} — the excluded-volume constant is four times the molecular volume.

Step 4. The factor of four is geometric, not a mistake. The volume excluded to the center of one sphere by another is a sphere of radius dd (diameter 2d2d), which is 23=82^3=8 molecular volumes; shared between the two partners of the pair, this gives 8/2=48/2=4 per molecule. This is exactly the van der Waals constant bb, derived here from a single cluster integral rather than fitted to data.

2 · The second virial coefficient and Boyle temperature of argon (exam level)

We compute B2B_2 for Lennard-Jones argon, compare with experiment, and locate the Boyle temperature.

Step 1. Model argon by the Lennard-Jones potential u(r)=4ε[(σ/r)12−(σ/r)6]u(r)=4\varepsilon[(\sigma/r)^{12}-(\sigma/r)^6] with ε/kB=120\varepsilon/k_B=120 K and σ=0.34\sigma=0.34 nm. At T=300T=300 K, numerically integrate B2=−12∫(e−βu−1) 4πr2 drB_2=-\tfrac12\int(e^{-\beta u}-1)\,4\pi r^2\,\mathrm dr. The integral gives ∫f d3r≈+5.5×10−29 m3\int f\,\mathrm d^3r\approx+5.5\times10^{-29}\ \mathrm{m^3} per pair.

Step 2. Convert to molar units: B2=−12×5.5×10−29 m3×NA×106=−16.5 cm3/molB_2=-\tfrac12\times5.5\times10^{-29}\ \mathrm{m^3}\times N_A\times10^6=\mathbf{-16.5\ cm^3/mol}. The measured second virial coefficient of argon at 300 K is about −16-16 cm³/mol — excellent agreement. The negative sign says attraction wins at room temperature: argon is slightly more compressible than an ideal gas, so Z<1Z<1.

Step 3. Find the Boyle temperature by locating where B2(T)=0B_2(T)=0. Repeating the integral at increasing temperature, B2B_2 rises through zero; numerically the crossing sits at TB≈420 KT_B\approx\mathbf{420\ K} for these Lennard-Jones parameters. This matches the reduced-Boyle-temperature rule kBTB≈3.4 εk_BT_B\approx3.4\,\varepsilon, giving TB≈3.4×120 K≈408T_B\approx3.4\times120\ \mathrm{K}\approx408 K.

Step 4. Interpret the crossing. Below TBT_B the shallow attractive well dominates and the gas is easier to compress than ideal; above TBT_B the molecules move too fast to be caught by the well, only their finite size matters, and the gas is stiffer than ideal. At TB≈420T_B\approx420 K argon obeys PV=NkBTPV=Nk_BT to first order in density over a wide range — a single microscopic potential has predicted both the room-temperature compressibility and the temperature of accidental ideality.

Origins · 1 minPerturbation theory and how this was discovered
PT
Perturbation theory
the method of solving a hard problem by expanding around a solvable one — here the interacting gas around the ideal gas, order by order in density (Clausius; van der Waals, 1873; Kamerlingh Onnes, 1901) · the first correction is the second virial coefficient

The corrections to the ideal gas are the physicist's archetype of perturbation theory: take a problem you can solve exactly — non-interacting point molecules — and expand systematically in a small parameter that measures the departure from it. Here the small parameter is the density, and the expansion is the virial series. The idea has deep roots. Rudolf Clausius and others recognized in the mid-nineteenth century that real gases deviate from the ideal law, but it was Johannes Diderik van der Waals, in his 1873 doctoral thesis, who first captured excluded volume and attraction in a single equation of state — the earliest mean-field theory in physics, and the reason a gas can condense into a liquid. Heike Kamerlingh Onnes, who would later liquefy helium and discover superconductivity, put the corrections into the systematic power-series form we still use, coining the name "virial expansion" in 1901. The microscopic justification — that each coefficient is a finite cluster integral over the pair potential — came with the cluster expansion of Ursell (1927) and Mayer (1937). What began as an engineer's correction factor became a rigorous, order-by-order theory connecting the shape of the intermolecular potential to every measurable deviation from ideality.

History
1857
— Clausius formulates the kinetic theory of gases and notes deviations from the ideal law.
1873
— van der Waals derives his equation of state, capturing excluded volume and attraction — the first mean-field theory.
1881
— van der Waals states the law of corresponding states, unifying real-gas behavior across substances.
1901
— Kamerlingh Onnes writes the empirical virial expansion and names the virial coefficients.
1927
— Ursell introduces cluster functions, the mathematical seed of the systematic expansion.
1937
— Mayer develops the cluster expansion, proving each virial coefficient is a finite cluster integral of the potential.

Going further

Texts. Pathria & Beale, Statistical Mechanics, 3rd ed., Ch. 9 (Statistical Mechanics of Interacting Systems: The Method of Cluster Expansions). Kardar, Statistical Physics of Particles, §5.1–5.3. Reif, Fundamentals of Statistical and Thermal Physics, Ch. 10. Landau & Lifshitz, Statistical Physics Part 1, §74–76. Hansen & McDonald, Theory of Simple Liquids (for the correlation-function route).

Provenance. Base article: AllQFT track `sm`, "Corrections to the Ideal Gas" (STAT.INTER.CORIG.1262); source Pathria & Beale, Statistical Mechanics, 3rd ed., Ch. 9. All numeric and symbolic claims re-verified here in verify_corrections-to-ideal-gas.py: the sign and factor −12-\tfrac12 of B2=−12∫f d3rB_2=-\tfrac12\int f\,\mathrm d^3r, the hard-sphere B2=23πd3=4vmoleculeB_2=\tfrac23\pi d^3=4v_{\text{molecule}}, the van der Waals split B2=b−a/kBTB_2=b-a/k_BT reducing to the vdW equation to O(n)\mathcal O(n), the Boyle temperature TB=a/(bkB)T_B=a/(bk_B), and the numeric Lennard-Jones argon B2(300 K)≈−16B_2(300\,\mathrm K)\approx-16 cm³/mol (matching experiment and the sibling article aq-sm-mayer-cluster-expansion) with TB≈420T_B\approx420 K. No base physics error found; the base's formulas are all correct.

Prerequisites. Classical ideal gas · Canonical and grand canonical ensembles · Intermolecular potential u(r)u(r).

Leads to. Configuration integral · The Mayer f-function · Virial expansion · Second virial coefficient · Van der Waals equation of state.

Why does B₂ change sign as temperature rises?

Because B2B_2 is a competition between two effects with opposite temperature dependence. The excluded-volume (hard-core) contribution bb is purely geometric and temperature-independent; it always pushes B2B_2 positive. The attractive contribution −a/kBT-a/k_BT grows in magnitude as TT falls, because slower molecules dwell longer in the potential well. At low temperature the attractive term wins and B2<0B_2<0; at high temperature the molecules move too fast to feel the shallow well, only their size matters, and B2→b>0B_2\to b>0. The crossover — the Boyle temperature TB=a/(bkB)T_B=a/(bk_B) — is where the two exactly cancel. So the sign of B2B_2 is a thermometer for which part of the intermolecular potential the gas is currently sampling.

What is the difference between the compressibility factor Z and the second virial coefficient B₂?

The compressibility factor Z=PV/NkBTZ=PV/Nk_BT is the measurable ratio of the real pressure to the ideal pressure; Z=1Z=1 is ideal. The second virial coefficient B2B_2 is the leading coefficient in the expansion of ZZ in density: Z=1+B2n+B3n2+⋯Z=1+B_2 n+B_3 n^2+\cdots. So ZZ is the full deviation and B2B_2 is its first slope. At low density Z−1≈B2nZ-1\approx B_2 n, so a plot of (Z−1)/n(Z-1)/n extrapolated to n→0n\to0 is B2(T)B_2(T) — this is precisely how B2B_2 is measured from pressure-volume data.

Why must the integral defining B₂ converge even though u(r) blows up in the hard core?

Because the integrand is the Mayer function f=e−βu−1f=e^{-\beta u}-1, not uu itself. Where u→+∞u\to+\infty, the exponential e−βu→0e^{-\beta u}\to0, so f→−1f\to-1 — a perfectly finite value. Where u→0u\to0 at large separation, f→0f\to0. So ff is bounded between −1-1 and a modest positive value in the attractive well, and it has compact support (it vanishes beyond the interaction range). Integrating a bounded function over a finite effective volume gives a finite B2B_2, even though the raw potential is infinite. This is the whole reason the cluster expansion works: replacing uu by ff tames the divergence.

Is B₂ = b − a/k_BT exact, or an approximation?

It is an approximation valid for a specific model and regime. The exact statement is B2(T)=−12∫(e−βu−1) d3rB_2(T)=-\tfrac12\int(e^{-\beta u}-1)\,\mathrm d^3r for any pair potential. The split B2=b−a/kBTB_2=b-a/k_BT follows only if you model the potential as a hard core plus a weak attractive tail and linearize the tail's Boltzmann factor as e−βu−1≈−βue^{-\beta u}-1\approx-\beta u, which requires β∣utail∣≪1\beta|u_{\text{tail}}|\ll1. For a real potential like Lennard-Jones, B2(T)B_2(T) is a smooth curve that the two-constant form only approximates near and above the Boyle temperature; at very low temperature the linearization fails and you must integrate numerically, as in the argon worked example.

How is B₂ connected to the van der Waals equation?

Truncate the virial series at the second coefficient with a hard-core-plus-attraction potential: P/kBT=n+(b−a/kBT)n2P/k_BT=n+(b-a/k_BT)n^2. Now resum the repulsive part. The excluded-volume terms n+bn2+b2n3+⋯n+bn^2+b^2n^3+\cdots form a geometric series that sums to n/(1−bn)n/(1-bn), the physical statement that the available volume is reduced from VV to V−NbV-Nb. Keeping the attractive term as −an2/kBT-an^2/k_BT and rearranging gives exactly (P+aN2/V2)(V−Nb)=NkBT(P+aN^2/V^2)(V-Nb)=Nk_BT. So van der Waals is the virial series kept to first order in density and dressed up with an excluded-volume resummation — the microscopic justification for the equation you first met in chemistry lives in B2B_2.

Does the same density expansion work for quantum gases?

Yes, with a twist. For a dilute Bose or Fermi gas there are two sources of the second virial coefficient: the interaction (via a quantum analogue of the Mayer function built from the two-body scattering) and the quantum statistics themselves. Remarkably, even a non-interacting quantum gas has a nonzero B2B_2 — the exchange contribution B2quantum=∓λ3/25/2B_2^{\text{quantum}}=\mp\lambda^3/2^{5/2} (attractive for bosons, repulsive for fermions), where λ\lambda is the thermal wavelength. So quantum statistics act like an effective potential. At low temperature and density the interaction part reduces to the s-wave scattering length, which is the language of ultracold-atom physics. The classical virial framework of this article is the λ→0\lambda\to0 limit of that richer story.

Why is the density the natural expansion parameter and not, say, the pressure?

Because the physics that causes deviations — molecules encountering one another — is controlled by how close together they are, which is set by the density n=N/Vn=N/V, not directly by the pressure. Microscopically, the probability that a given molecule has a partner within interaction range is ∼n vint\sim n\,v_{\text{int}}, and the cluster expansion is literally an expansion in the number of molecules simultaneously within range. The pressure is an output of the theory, not the natural control knob; expressing the equation of state as P=P(n,T)P=P(n,T) with P/kBTP/k_BT a power series in nn keeps each term tied to a definite number of interacting molecules. You can invert to get n(P)n(P) afterward, but the clean bookkeeping is in density.

Before this

Where this leads