---
title: The Cluster Expansion and Virial Coefficients
module: Interacting Gases
moduleNumber: 10
lessonNumber: 1
order: 1001
summary: >
  A real gas departs from $PV=Nk_BT$ because its molecules interact. The
  configuration integral factors through the Mayer function
  $f_{ij}=e^{-\beta u_{ij}}-1$, and expanding it in powers of density produces
  the virial expansion $PV/Nk_BT = 1 + B_2(T)n + B_3(T)n^2 + \cdots$. The second
  virial coefficient $B_2(T)=-\tfrac12\int f\,\d^3r$ is a single integral over the
  pair potential; it is positive for a hard core, negative for an attractive well,
  and vanishes at the Boyle temperature where the two balance.
topics: [Interacting Gases]
sources:
  - book: Kardar (Statistical Physics of Particles)
    ref: "Ch. 5 — Interacting Particles; §5.1–5.3"
  - book: Pathria & Beale
    ref: "Ch. 10 — Statistical Mechanics of Interacting Systems: The Method of Cluster Expansions; §10.1–10.2"
  - book: Reif
    ref: "Ch. 10 — Systems of Interacting Particles; §10.3–10.5"
draft: false
---

Every result in the preceding modules assumed the gas particles ignore one
another. The ideal-gas law, the Sackur–Tetrode entropy, and the quantum
distributions all followed from a Hamiltonian with no interaction term. Real
molecules attract at long range and repel at short range, and the equation of
state acquires corrections that grow with density. The systematic way to
organize those corrections is the **virial expansion**, a power series in the
number density $n=N/V$,

$$
\frac{PV}{Nk_BT} = 1 + B_2(T)\,n + B_3(T)\,n^2 + \cdots,
$$

whose coefficients $B_\ell(T)$ are determined by the interactions among $\ell$
molecules at a time. This lesson derives the expansion from the configuration
integral, identifies $B_2(T)$ with a single integral over the pair potential,
and evaluates it for the hard-sphere, square-well, and Lennard-Jones models.

## The configuration integral

For $N$ identical classical particles with pairwise interactions, the
Hamiltonian separates into kinetic and potential parts,

$$
H = \sum_{i=1}^{N}\frac{\vec p_i\,^2}{2m} + U(\vec r_1,\dots,\vec r_N),
\qquad
U = \sum_{i<j} u(r_{ij}),
$$

with $r_{ij}=|\vec r_i-\vec r_j|$ the separation of particles $i$ and $j$ and
$u(r)$ the pair potential. The canonical partition function factors because the
momentum integrals are unaffected by $U$,

$$
Z_N = \frac{1}{N!\,\lambda^{3N}}\underbrace{\int \prod_{i=1}^{N}\d^3 r_i\;
e^{-\beta U}}_{Q_N},
\qquad
\lambda = \frac{h}{\sqrt{2\pi m k_B T}},
$$

where $\lambda$ is the thermal de Broglie wavelength from the momentum
Gaussians and $Q_N$ is the **configuration integral**. All deviation from
ideality lives in $Q_N$: for a non-interacting gas $U=0$ gives $Q_N=V^N$ and the
ideal partition function $Z_N = V^N/N!\lambda^{3N}$ returns. The free energy is

$$
F = -k_B T\ln Z_N = F_{\text{ideal}} - k_B T\ln\frac{Q_N}{V^N},
$$

so the interaction correction is the logarithm of $Q_N/V^N$, a dimensionless
ratio that equals $1$ for the ideal gas. Computing it exactly is impossible for
any realistic $u(r)$; the cluster expansion computes it order by order in
density.

## The Mayer function

The integrand $e^{-\beta U}=\prod_{i<j}e^{-\beta u(r_{ij})}$ is a product of
factors, each close to $1$ wherever the corresponding pair is far apart, since
$u(r)\to 0$ at large separation. Subtracting that background defines the
**Mayer function**

$$
f_{ij} \equiv e^{-\beta u(r_{ij})} - 1,
$$

which vanishes wherever the pair does not interact and is appreciable only when
the two particles are within range of one another. In terms of $f$ the Boltzmann
weight is an exact product,

$$
e^{-\beta U} = \prod_{i<j}\bigl(1 + f_{ij}\bigr).
$$

Expanding the product generates a sum over all sets of pairs: the term $1$, the
single-bond terms $\sum_{i<j}f_{ij}$, the two-bond terms $\sum f_{ij}f_{k\ell}$,
and so on. Because each $f$ is short-ranged, a term with several bonds
contributes only when the bonded particles are simultaneously close, an event
whose probability falls with density. Ordering the expansion by the number of
bonds is therefore an ordering in powers of $n$.

The Mayer function encodes the shape of the potential. Inside the repulsive core
$u\to+\infty$ forces $f\to-1$; in the attractive well $u<0$ makes $e^{-\beta u}>1$
so $f>0$; far outside, $f\to 0$. Its sign changes where $u$ changes sign, and its
magnitude is set by the competition between $|u|$ and $k_B T$.

$$
% caption: The Lennard-Jones pair potential $u(r)=4\varepsilon[(\sigma/r)^{12}-(\sigma/r)^{6}]$: a steep repulsive core inside $r=\sigma$, a minimum of depth $\varepsilon$ at $r=2^{1/6}\sigma$, and a $-r^{-6}$ attractive tail.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(6.2,0) node[right,black]{$r$};
\draw[->,black] (0.95,-2.0)--(0.95,3.0) node[above,black]{$u(r)$};
\draw[black,dashed] (0.95,0)--(6.0,0);
\draw[acc,very thick] plot[domain=0.92:2.85,samples=120] (\x*2.05,{4*((1/\x)^12-(1/\x)^6)*1.1});
\filldraw[black!70] (1.122*2.05,{-1*1.1}) circle (2pt);
\node[black!70,below right] at (1.122*2.05,{-1*1.1}) {minimum};
\draw[black,dashed] (2.05,0)--(2.05,-1.3);
\node[black,below] at (2.05,-1.35) {$u=0$};
\node[acc] at (5.1,0.55) {attractive tail};
\node[acc] at (1.7,2.4) {repulsive core};
\end{tikzpicture}
$$

$$
% caption: The Mayer function $f(r)=e^{-\beta u(r)}-1$ for the same potential at $k_BT=1.5\,\varepsilon$: it saturates at $-1$ inside the core (the pair is forbidden), rises to a positive bump in the attractive well, and decays to zero at large $r$.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(6.2,0) node[right,black]{$r$};
\draw[->,black] (0.6,-2.0)--(0.6,1.6) node[above,black]{$f(r)$};
\draw[black,dashed] (0.6,0)--(6.0,0);
\draw[black,dashed] (0.6,-1.6)--(6.0,-1.6) node[right,black]{limit};
\draw[acc,very thick] plot[domain=0.92:2.85,samples=120] (\x*2.05,{(exp(-(1/1.5)*4*((1/\x)^12-(1/\x)^6))-1)*1.6});
\node[acc] at (3.2,0.95) {well: $f>0$};
\node[acc] at (1.9,-1.35) {core: $f<0$};
\end{tikzpicture}
$$

## The second virial coefficient

Keep only the single-bond terms, which dominate at low density. Their
contribution to the configuration integral is

$$
Q_N = \int \prod_i \d^3 r_i\left(1 + \sum_{i<j}f_{ij} + \cdots\right)
= V^N + \sum_{i<j}\int \prod_i \d^3 r_i\; f_{ij} + \cdots.
$$

Each pair term integrates the $N-2$ spectator coordinates freely, giving
$V^{N-2}$, and the two bonded coordinates over $f_{ij}$. Shifting to the
relative coordinate $\vec r = \vec r_i-\vec r_j$ leaves one free center-of-mass
integration worth $V$,

$$
\int \d^3 r_i\,\d^3 r_j\; f_{ij} = V\int \d^3 r\; f(r).
$$

There are $\binom{N}{2}=\tfrac12 N(N-1)$ pairs, so

$$
Q_N = V^N\left[1 + \frac{N(N-1)}{2V}\int \d^3 r\, f(r) + \cdots\right]
\approx V^N\left[1 + \frac{N^2}{2V}\int \d^3 r\, f(r)\right].
$$

Taking the logarithm with $\ln(1+x)\approx x$ and forming the pressure
$P=-\partial F/\partial V$ from $F=F_{\text{ideal}}-k_BT\ln(Q_N/V^N)$ gives

$$
P = \frac{Nk_BT}{V}\left[1 - \frac{N}{2V}\int \d^3 r\, f(r)\right]
= \frac{Nk_BT}{V}\bigl[1 + B_2(T)\,n\bigr],
$$

which identifies the **second virial coefficient**

$$
B_2(T) = -\frac12\int \d^3 r\; f(r)
= -\frac12\int \d^3 r\;\bigl(e^{-\beta u(r)}-1\bigr)
= -2\pi\int_0^\infty \bigl(e^{-\beta u(r)}-1\bigr)\,r^2\,\d r,
$$

the angular integration having produced the $4\pi r^2$ shell factor. The sign of
$B_2$ follows the sign of $f$: a repulsive potential makes $f<0$ and $B_2>0$
(pressure above ideal), while an attractive potential makes $f>0$ and $B_2<0$
(pressure below ideal). The connection to the [virial theorem](/statistical-mechanics/classical-gas/equipartition-and-the-virial-theorem)
of the previous module is direct — both express the leading interaction
correction to $PV=Nk_BT$ through an integral over the intermolecular force.

## The cluster expansion and higher coefficients

The single-bond truncation is the first term of a systematic hierarchy. Grouping
the terms of $\prod_{i<j}(1+f_{ij})$ by connected sets of bonds, the logarithm
$\ln Q_N$ becomes a sum of **cluster integrals**: a diagram is a set of particles
(points) joined by $f$-bonds, and each connected diagram contributes an integral
over the positions of its points. The systematic bookkeeping is cleanest in the
grand canonical ensemble, where $\ln\Xi$ equals the sum of all connected
clusters and the pressure follows from $PV=k_BT\ln\Xi$.[^mayer]

[^mayer]: **Mayer & Mayer**'s cluster expansion is developed in **Pathria &
Beale**, _Statistical Mechanics_ (4th ed.), §10.1–10.2, and **Kardar**,
_Statistical Physics of Particles_, §5.2; MIT OCW 8.333,
<https://ocw.mit.edu/courses/8-333-statistical-mechanics-i-statistical-mechanics-of-particles-fall-2013/>.
The grand-canonical route expresses $\ln\Xi$ as a sum over connected clusters,
and the linked-cluster theorem removes the disconnected pieces that plague the
canonical sum.

$$
% caption: The lowest cluster diagrams. A single $f$-bond between two points gives $B_2$; among the three-point diagrams only the fully connected triangle (three $f$-bonds) survives in $B_3$, while the open chain is reducible and cancels.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
% pair
\filldraw[black] (0,0) circle (2.6pt) node[below,black]{1};
\filldraw[black] (1.6,0) circle (2.6pt) node[below,black]{2};
\draw[black,thick] (0,0)--(1.6,0);
\node[black] at (0.8,0.9) {pair};
\node[black] at (0.8,-0.9) {$B_2$};
% triangle
\begin{scope}[xshift=4.0cm]
\filldraw[acc] (0,0) circle (2.6pt) node[below,black]{1};
\filldraw[acc] (1.6,0) circle (2.6pt) node[below,black]{2};
\filldraw[acc] (0.8,1.35) circle (2.6pt) node[above,black]{3};
\draw[acc,thick] (0,0)--(1.6,0)--(0.8,1.35)--cycle;
\node[black] at (0.8,-0.9) {$B_3$ (irreducible)};
\end{scope}
% chain
\begin{scope}[xshift=8.0cm]
\filldraw[black] (0,0) circle (2.6pt) node[below,black]{1};
\filldraw[black] (1.1,0) circle (2.6pt) node[below,black]{2};
\filldraw[black] (2.2,0) circle (2.6pt) node[below,black]{3};
\draw[black,thick] (0,0)--(1.1,0)--(2.2,0);
\node[black] at (1.1,-0.9) {chain: cancels};
\end{scope}
\end{tikzpicture}
$$

Not every diagram contributes to a virial coefficient. The virial coefficients
are given by the **irreducible** clusters alone — the diagrams that remain
connected after any single point is removed. The three-particle chain
$f_{12}f_{23}$ is reducible (deleting point $2$ disconnects it) and its
contribution is cancelled by disconnected pieces, so the third virial coefficient
comes only from the triangle,

$$
B_3(T) = -\frac13\int \d^3 r_2\,\d^3 r_3\; f_{12}\,f_{13}\,f_{23},
$$

with particle $1$ fixed at the origin. Each successive $B_\ell$ is an integral
over the irreducible $\ell$-point clusters, and these coefficients assemble the
density expansion of the pressure — the virial series. In practice $B_2$ carries most of the
low-density physics and is the only coefficient with a simple closed form for
realistic potentials.

## Hard spheres and the excluded volume

The hard-sphere potential is the sharpest model of a repulsive core:

$$
u(r) = \begin{cases}\infty, & r<\sigma\\[2pt] 0, & r>\sigma,\end{cases}
\qquad
f(r) = \begin{cases}-1, & r<\sigma\\[2pt] 0, & r>\sigma.\end{cases}
$$

The integral is elementary,

$$
B_2 = -\frac12\int_{r<\sigma}(-1)\,\d^3 r = \frac12\cdot\frac{4\pi}{3}\sigma^3
= \frac{2\pi}{3}\sigma^3,
$$

independent of temperature. This is four times the volume of a single sphere:
with molecular volume $v_0 = \tfrac{4}{3}\pi(\sigma/2)^3 = \tfrac{\pi}{6}\sigma^3$,
one has $B_2 = 4v_0$. The factor of four is geometric — two impenetrable spheres
of diameter $\sigma$ cannot approach closer than $\sigma$ center to center, so
each pair excludes a sphere of radius $\sigma$, whose volume is eight times a
molecule's and is shared between the two particles.

$$
% caption: Excluded volume for hard spheres. The center of a second sphere is barred from the shaded ball of radius $\sigma$ (the contact diameter) around the first; that excluded region has volume $\tfrac{4}{3}\pi\sigma^3$, and $B_2$ is half of it.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\fill[acc!15] (0,0) circle (2.0);
\draw[acc,thick,dashed] (0,0) circle (2.0);
\filldraw[black!8,draw=black,thick] (0,0) circle (1.0);
\filldraw[black!8,draw=black,thick] (2.0,0) circle (1.0);
\draw[<->,black] (0,0)--(2.0,0);
\node[black,fill=white,inner sep=1pt] at (1.0,0) {contact};
\node[black] at (0,-1.35) {sphere 1};
\node[black] at (2.0,-1.35) {sphere 2};
\node[acc] at (0,2.4) {excluded ball};
\end{tikzpicture}
$$

## The square well and the Boyle temperature

A hard core alone gives a temperature-independent $B_2$; attraction introduces
temperature dependence. The **square-well** potential adds a finite attractive
shell to the hard core,

$$
u(r) = \begin{cases}
\infty, & r<\sigma\\
-\varepsilon, & \sigma<r<R\sigma\\
0, & r>R\sigma,
\end{cases}
$$

with well depth $\varepsilon$ and range $R\sigma$. The Mayer function is $-1$
inside the core, $e^{\beta\varepsilon}-1>0$ in the well, and $0$ outside, so

$$
B_2(T) = \frac{2\pi}{3}\sigma^3\Bigl[1 - (R^3-1)\bigl(e^{\beta\varepsilon}-1\bigr)\Bigr].
$$

At high temperature $\beta\varepsilon\to 0$ the bracket approaches $1$ and $B_2$
tends to the hard-sphere value $\tfrac{2\pi}{3}\sigma^3>0$: the fast molecules
barely feel the shallow well and the repulsive core dominates. At low temperature
the exponential grows, the bracket turns negative, and $B_2<0$: the attraction
dominates and lowers the pressure below ideal. Between the two limits $B_2$ passes
through zero at the **Boyle temperature** $T_B$, defined by $B_2(T_B)=0$.

> **Definition (Boyle temperature).** The temperature $T_B$ at which the second
> virial coefficient vanishes, $B_2(T_B)=0$. There the repulsive and attractive
> contributions to $B_2$ cancel and the gas obeys $PV=Nk_BT$ to first order in
> density; deviations appear only at order $n^2$. For the square well,
> $e^{\varepsilon/k_BT_B} = 1 + (R^3-1)^{-1}$.

$$
% caption: The square-well second virial coefficient $B_2/b$ with $b=\tfrac{2\pi}{3}\sigma^3$ and range $R=1.5$, versus reduced temperature $k_BT/\varepsilon$. It is large and negative at low $T$ (attraction dominant), rises through zero at the Boyle temperature $k_BT_B/\varepsilon\approx 2.85$, and approaches the hard-sphere value $1$ from below at high $T$.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(6.4,0) node[right,black]{$k_BT$};
\draw[->,black] (0,-3.3)--(0,1.6) node[above,black]{$B_2$};
\draw[black,dashed] (0,1.2)--(6.2,1.2) node[right,black]{$1$};
\draw[black,dashed] (0,0)--(6.2,0);
\draw[acc,very thick] plot[domain=1.08:6.0,samples=120]
  ({\x},{1.2*(1-2.375*(exp(1/\x)-1))});
\filldraw[black!70] (2.85,0) circle (2.4pt);
\node[black!70,above right] at (2.85,0.05) {Boyle temperature};
\end{tikzpicture}
$$

## The Lennard-Jones gas

Real molecules interact through a smooth potential, and the **Lennard-Jones**
form combines a $r^{-12}$ repulsion with a $r^{-6}$ dispersion attraction,

$$
u(r) = 4\varepsilon\left[\left(\frac{\sigma}{r}\right)^{12}
- \left(\frac{\sigma}{r}\right)^{6}\right],
$$

with $u(\sigma)=0$, a minimum of depth $\varepsilon$ at $r_{\min}=2^{1/6}\sigma$,
and the $-r^{-6}$ tail fixed by the van der Waals dispersion force between induced
dipoles. Its second virial coefficient has no elementary closed form, but the
qualitative behavior matches the square well: positive and tending to a constant
at high temperature, negative at low temperature, crossing zero at a Boyle
temperature $k_BT_B\approx 3.42\,\varepsilon$.[^ljboyle] Written in reduced units
$T^\ast = k_BT/\varepsilon$ and $B_2^\ast = B_2/(\tfrac{2}{3}\pi\sigma^3)$, the
curve is the same for every substance obeying a Lennard-Jones law, and measured
$B_2(T)$ data for the noble gases collapse onto it once $\sigma$ and $\varepsilon$
are fitted — an early instance of the corresponding-states idea developed in the
next lesson.

[^ljboyle]: The reduced Boyle temperature $k_BT_B/\varepsilon\simeq 3.418$ for
the Lennard-Jones potential is tabulated in **Reif**, _Fundamentals of
Statistical and Thermal Physics_, §10.5, and **Pathria & Beale**, _Statistical
Mechanics_ (4th ed.), §10.2.

The two competing pieces of $B_2$ carry distinct physical content. The positive,
repulsive piece is the excluded volume $b\sim\sigma^3$, weakly dependent on
temperature and set by molecular size. The negative, attractive piece scales as
$-\varepsilon/k_BT$ times a volume, growing as the gas cools. Isolating these two
terms produces the van der Waals equation, whose constants $a$
and $b$ are the attractive and repulsive contributions to $B_2$.

## Summary

- Interactions live entirely in the configuration integral
  $Q_N=\int\prod_i\d^3r_i\,e^{-\beta U}$; the free energy correction is
  $-k_BT\ln(Q_N/V^N)$, which equals $1$ inside the log for an ideal gas.
- The Mayer function $f_{ij}=e^{-\beta u_{ij}}-1$ is short-ranged and turns the
  Boltzmann weight into $\prod_{i<j}(1+f_{ij})$; expanding by number of bonds is
  an expansion in density.
- The virial expansion $PV/Nk_BT = 1 + B_2 n + B_3 n^2 + \cdots$ has coefficients
  fixed by irreducible clusters:
  $B_2=-\tfrac12\int f\,\d^3r$ and
  $B_3=-\tfrac13\int f_{12}f_{13}f_{23}\,\d^3r_2\,\d^3r_3$.
- Hard spheres give $B_2=\tfrac{2\pi}{3}\sigma^3=4v_0$, the temperature-independent
  excluded volume. The square well adds an attractive term
  $-(R^3-1)(e^{\beta\varepsilon}-1)$ that makes $B_2$ negative at low $T$.
- $B_2(T)$ crosses zero at the Boyle temperature, where repulsion and attraction
  cancel and the gas is ideal to first order in density; for Lennard-Jones,
  $k_BT_B\approx 3.42\,\varepsilon$.
