---
title: The Three Ensembles and the Thermodynamic Web
module: Grand Canonical Ensemble
moduleNumber: 6
lessonNumber: 3
order: 603
summary: >
  The microcanonical, canonical, and grand canonical ensembles hold different
  variables fixed and generate different potentials — the entropy $S$, the
  Helmholtz free energy $F$, and the grand potential $\Phi$ — linked by Legendre
  transforms that trade each fixed variable for its conjugate. Each successive
  ensemble lets one more quantity fluctuate. In the thermodynamic limit the three
  agree, the relative fluctuations vanishing as $1/\sqrt{N}$; the ideal gas gives
  the same equation of state in all three. The choice of ensemble is a matter of
  convenience, set by which sum is easiest.
topics: [Grand Canonical Ensemble]
sources:
  - book: Kardar (Statistical Physics of Particles)
    ref: "Ch. 4 — Classical Statistical Mechanics; §4.9–4.10 Summary of Ensembles"
  - book: Reif
    ref: "Ch. 6–9 — synthesis of the microcanonical, canonical, and grand ensembles"
  - book: Pathria & Beale
    ref: "Ch. 4 — The Grand Canonical Ensemble; §4.5–4.6"
  - book: Schroeder
    ref: "Ch. 6–7 — synthesis of Boltzmann and Gibbs statistics"
draft: false
---

Three ensembles have been built, each from the same postulate of equal a priori
probabilities applied to an isolated compound of system plus surroundings. They
differ only in what the surroundings hold fixed: nothing (the isolated system),
the temperature (a heat bath), or the temperature and chemical potential (a heat
and particle bath). Each choice fixes a different set of variables, lets a
different set fluctuate, and generates a different thermodynamic potential. This
lesson assembles the three into one structure, shows that the potentials are
Legendre transforms of one another, and confirms by direct calculation that they
give the same physics for the ideal gas.

## The three ensembles side by side

The distinguishing data of each ensemble are the variables it fixes, the sum over
microstates that normalizes its distribution, and the thermodynamic potential
that logarithm produces.

- **Microcanonical ensemble** — an isolated system at fixed energy, volume, and
  particle number $(E,V,N)$. Every accessible microstate is equally probable. The
  count of accessible microstates $\Omega(E,V,N)$ generates the entropy
  $S=k_B\ln\Omega$.
- **Canonical ensemble** — a system at fixed $(T,V,N)$ in contact with a heat
  bath. Microstate $s$ has probability $Z^{-1}e^{-\beta E_s}$. The partition
  function $Z=\sum_s e^{-\beta E_s}$ generates the Helmholtz free energy
  $F=-k_BT\ln Z$.
- **Grand canonical ensemble** — a system at fixed $(T,V,\mu)$ in contact with a
  heat and particle bath. Microstate $s$ has probability
  $\Xi^{-1}e^{-\beta(E_s-\mu N_s)}$. The grand partition function
  $\Xi=\sum_s e^{-\beta(E_s-\mu N_s)}$ generates the grand potential
  $\Phi=-k_BT\ln\Xi=-PV$.

Each step down the list replaces one fixed extensive variable by its intensive
conjugate held by a larger reservoir: fixing $E$ becomes fixing its conjugate
$T$, and fixing $N$ becomes fixing its conjugate $\mu$. The quantity released from
constraint then fluctuates.

| Ensemble | Fixed | Fluctuating | Sum | Potential |
| --- | --- | --- | --- | --- |
| Microcanonical | $E,V,N$ | none | $\Omega(E,V,N)$ | $S=k_B\ln\Omega$ |
| Canonical | $T,V,N$ | $E$ | $Z=\sum_s e^{-\beta E_s}$ | $F=-k_BT\ln Z$ |
| Grand canonical | $T,V,\mu$ | $E,\,N$ | $\Xi=\sum_s e^{-\beta(E_s-\mu N_s)}$ | $\Phi=-k_BT\ln\Xi$ |

$$
% caption: The three ensembles fix progressively fewer extensive variables, trading $E$ for $T$ and $N$ for $\mu$; each generating sum has its logarithm as a thermodynamic potential, and each released variable fluctuates.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[thick] (0,0) rectangle (3.0,3.4);
\node at (1.5,3.05) {microcanonical};
\node at (1.5,2.35) {hold $E,V,N$};
\node at (1.5,1.65) {count states};
\node at (1.5,0.85) {entropy $S$};
\node[black,font=\scriptsize] at (1.5,0.3) {nothing varies};
\draw[thick] (3.6,0) rectangle (6.6,3.4);
\node at (5.1,3.05) {canonical};
\node at (5.1,2.35) {hold $T,V,N$};
\node at (5.1,1.65) {sum $Z$};
\node at (5.1,0.85) {free energy $F$};
\node[black,font=\scriptsize] at (5.1,0.3) {$E$ varies};
\draw[thick] (7.2,0) rectangle (10.2,3.4);
\node at (8.7,3.05) {grand canonical};
\node[align=center] at (8.7,2.35) {hold $T,V$ and\\chem. potential};
\node at (8.7,1.65) {grand sum};
\node[align=center] at (8.7,0.85) {grand\\potential};
\node[black,font=\scriptsize] at (8.7,0.3) {$E,N$ vary};
\draw[->,black,thick] (3.05,1.7)--(3.55,1.7);
\draw[->,black,thick] (6.65,1.7)--(7.15,1.7);
\end{tikzpicture}
$$

## The potentials as Legendre transforms

The three potentials are not independent functions; each follows from the one
before by a Legendre transform that swaps a fixed variable for its conjugate. The
fundamental relation in the energy representation is
$\d U=T\,\d S-P\,\d V+\mu\,\d N$, so the conjugate pairs are $(T,S)$ and
$(\mu,N)$. The microcanonical entropy $S(E,V,N)$ inverts to the energy
$U(S,V,N)$, the potential whose natural variables are all extensive. Trading the
entropy for the temperature gives the Helmholtz free energy, and trading the
particle number for the chemical potential gives the grand potential,

$$
F=U-TS,\qquad \Phi=F-\mu N=U-TS-\mu N.
$$

Each transform removes an extensive variable from the list of natural variables
and installs its intensive conjugate. The differentials record the swap:

$$
\d U=T\,\d S-P\,\d V+\mu\,\d N,
\quad
\d F=-S\,\d T-P\,\d V+\mu\,\d N,
\quad
\d\Phi=-S\,\d T-P\,\d V-N\,\d\mu.
$$

Reading the coefficients back off each differential recovers the state variables
by differentiation: $S$ and $P$ and $\mu$ from $F$, and $S$ and $P$ and $N$ from
$\Phi$. The ladder is the thermodynamic web in miniature — one fundamental
relation, three potentials, connected by two Legendre steps.

$$
% caption: The energy $U(S,V,N)$ sits at the top; a Legendre transform trading $S$ for $T$ gives the Helmholtz free energy $F$, and a further transform trading $N$ for $\mu$ gives the grand potential $\Phi$, each generated by its ensemble.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\node[draw,thick,minimum width=3.8cm,minimum height=0.95cm] (U) at (0,4) {energy $U(S,V,N)$};
\node[draw,thick,minimum width=3.8cm,minimum height=0.95cm] (F) at (0,2) {free energy $F(T,V,N)$};
\node[draw,thick,minimum width=3.8cm,minimum height=0.95cm,align=center] (G) at (0,0) {grand potential\\at $T,V$ and chem. pot.};
\draw[->,acc,thick] (U)--(F) node[midway,right,black!70,font=\scriptsize]{trade $S$ for $T$};
\draw[->,acc,thick] (F)--(G) node[midway,right,black!70,font=\scriptsize]{trade $N$ for chem. pot.};
\node[black,left,font=\scriptsize] at (-2.0,4) {microcanonical};
\node[black,left,font=\scriptsize] at (-2.0,2) {canonical};
\node[black,left,font=\scriptsize] at (-2.0,0) {grand canonical};
\end{tikzpicture}
$$

## Fixed versus fluctuating variables

The ensembles differ physically in what is allowed to fluctuate, and the size of
those fluctuations decides whether the distinction matters. In the microcanonical
ensemble the energy and particle number are both sharp by construction. The
canonical ensemble lets the energy fluctuate, with variance
$\langle\Delta E^2\rangle=k_BT^2C_V$ tied to the heat capacity. The grand ensemble
lets the particle number fluctuate as well, with variance
$\langle\Delta N^2\rangle=k_BT(\partial N/\partial\mu)_{T,V}$ tied to the
compressibility. Both variances are extensive, so both relative spreads scale as

$$
\frac{\sqrt{\langle\Delta E^2\rangle}}{\langle E\rangle}\sim\frac{1}{\sqrt N},
\qquad
\frac{\sqrt{\langle\Delta N^2\rangle}}{\langle N\rangle}\sim\frac{1}{\sqrt N}.
$$

For a macroscopic system both are of order $10^{-12}$. The fluctuating variables
are pinned to their means so tightly that a canonical system behaves as if its
energy were fixed and a grand-canonical system as if its particle number were
fixed. This is the quantitative content of ensemble equivalence: the three
descriptions of the same substance give identical intensive thermodynamics in the
limit $N\to\infty$.[^equiv]

The equivalence can fail where a fluctuation ceases to be small. At a first-order
phase transition the energy distribution becomes bimodal and $C_V$ diverges; near
a critical point the compressibility diverges and density fluctuations grow to
macroscopic scale. In those regimes the ensembles can give genuinely different
answers, and the choice of which variable is fixed becomes a physical statement
about the system rather than a computational convenience. Away from transitions,
and for any system with short-range interactions, the equivalence is exact in the
thermodynamic limit.

## The ideal gas three ways

The equivalence is best seen by computing one quantity in all three ensembles.
Take the equation of state of the classical monatomic ideal gas, with
single-particle partition function $z_1=V/\lambda^3$ and thermal wavelength
$\lambda=h/\sqrt{2\pi m k_BT}$.

> **Worked example.** _Microcanonical._ Counting the momentum-space volume of the
> energy shell gives the Sackur-Tetrode entropy
> $$S=Nk_B\Big[\ln\frac{V}{N\lambda^3}+\tfrac52\Big].$$
> The pressure follows from $P/T=(\partial S/\partial V)_{E,N}$. Only the $\ln V$
> term depends on volume, so $(\partial S/\partial V)_{E,N}=Nk_B/V$, giving
> $$P=T\Big(\frac{\partial S}{\partial V}\Big)_{E,N}=\frac{Nk_BT}{V}.$$
>
> _Canonical._ The partition function is $Z=z_1^N/N!=(V/\lambda^3)^N/N!$, so
> $F=-k_BT\ln Z=-k_BT[N\ln(V/\lambda^3)-\ln N!]$. The pressure is
> $$
> P=-\Big(\frac{\partial F}{\partial V}\Big)_{T,N}
> =k_BT\,\frac{\partial}{\partial V}\Big[N\ln V\Big]=\frac{Nk_BT}{V}.
> $$
>
> _Grand canonical._ Summing the canonical partition functions over $N$ with
> fugacity $z$ gives
> $$
> \Xi=\sum_{N=0}^{\infty}\frac{(z z_1)^N}{N!}=e^{z z_1},\qquad
> \ln\Xi=z z_1=\frac{zV}{\lambda^3}.
> $$
> The pressure comes straight from $PV=k_BT\ln\Xi$, and the density from
> $\langle N\rangle=z\,\partial\ln\Xi/\partial z=z z_1$. Eliminating $z z_1$
> between them,
> $$
> PV=k_BT\ln\Xi=k_BT\,z z_1=k_BT\,\langle N\rangle
> \quad\Longrightarrow\quad PV=\langle N\rangle k_BT.
> $$
> All three routes give $PV=Nk_BT$. The microcanonical calculation differentiates
> an entropy, the canonical differentiates a free energy, and the grand reads the
> pressure off $\ln\Xi$ directly; the grand ensemble is the shortest because the
> $N!$ that complicates the canonical sum becomes the exponential series.

$$
% caption: The same ideal-gas equation of state $PV=Nk_BT$ emerges from all three ensembles — as a volume derivative of the entropy, of the free energy, and directly from $\ln\Xi$ — confirming their equivalence.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\node[draw,thick,minimum width=3.3cm,minimum height=0.9cm,align=center] (M) at (0,2.4) {entropy $S$,\\then vary $V$};
\node[draw,thick,minimum width=3.3cm,minimum height=0.9cm,align=center] (C) at (0,1.05) {free energy $F$,\\then vary $V$};
\node[draw,thick,minimum width=3.3cm,minimum height=0.9cm,align=center] (G) at (0,-0.3) {grand sum\\gives $PV$};
\node[draw,acc,thick,fill=acc!10,minimum width=2.4cm,minimum height=1.0cm] (R) at (5.6,1.05) {$PV=Nk_BT$};
\draw[->,black,thick] (M)--(R);
\draw[->,black,thick] (C)--(R);
\draw[->,black,thick] (G)--(R);
\end{tikzpicture}
$$

## Choosing an ensemble

Because the three agree, the working rule is to pick the ensemble whose sum is
easiest for the system at hand.

- **Microcanonical** — natural when the energy is genuinely conserved and the
  microstate count is tractable: isolated systems, small models with a
  combinatorial multiplicity, and the definition of entropy itself. The
  constrained sum over a fixed-energy shell is usually the hardest to perform.
- **Canonical** — the default for a system at a set temperature. Fixing $T$
  removes the energy constraint and turns the shell sum into an unrestricted sum
  of Boltzmann factors, which factorizes over independent degrees of freedom.
  Most equilibrium calculations start here.
- **Grand canonical** — the choice when the particle-number constraint is the
  obstruction. For indistinguishable quantum particles, fixing $N$ couples the
  mode occupations through $\sum_i n_i=N$; releasing $N$ factorizes $\Xi$ over
  single-particle modes and delivers the Bose-Einstein and Fermi-Dirac
  distributions directly. It is also the natural setting for open systems,
  adsorption, chemical and phase equilibrium, and density fluctuations.

$$
% caption: A practical guide: fix the temperature unless the energy is conserved and easily counted, and release the particle number whenever the fixed-$N$ constraint blocks the sum, as it does for quantum gases.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\node[draw,black,thick,fill=black!5,minimum width=3.0cm,minimum height=0.9cm] (Q1) at (0,4) {energy conserved?};
\node[draw,acc,thick,fill=acc!10,minimum width=2.8cm,minimum height=0.9cm] (MC) at (-3.4,2.4) {microcanonical};
\node[draw,black,thick,fill=black!5,minimum width=3.2cm,minimum height=0.9cm] (Q2) at (1.6,2.4) {particle number set?};
\node[draw,acc,thick,fill=acc!10,minimum width=2.6cm,minimum height=0.9cm] (CA) at (-0.6,0.6) {canonical};
\node[draw,acc,thick,fill=acc!10,minimum width=2.8cm,minimum height=0.9cm] (GC) at (3.6,0.6) {grand canonical};
\draw[->,black,thick] (Q1)--(MC) node[midway,above,font=\scriptsize,black!70]{yes, countable};
\draw[->,black,thick] (Q1)--(Q2) node[midway,above right,font=\scriptsize,black!70]{no};
\draw[->,black,thick] (Q2)--(CA) node[midway,left,font=\scriptsize,black!70]{yes};
\draw[->,black,thick] (Q2)--(GC) node[midway,right,font=\scriptsize,black!70]{no};
\end{tikzpicture}
$$

## Summary

- The three ensembles apply the equal-probability postulate to an isolated
  compound; they differ in what the reservoir fixes — nothing, $T$, or $(T,\mu)$
  — and generate $S=k_B\ln\Omega$, $F=-k_BT\ln Z$, and $\Phi=-k_BT\ln\Xi=-PV$.
- The potentials are Legendre transforms along the chain $U\to F\to\Phi$: each
  step trades a fixed extensive variable ($S$, then $N$) for its intensive
  conjugate ($T$, then $\mu$), as recorded by the differentials
  $\d F=-S\,\d T-P\,\d V+\mu\,\d N$ and $\d\Phi=-S\,\d T-P\,\d V-N\,\d\mu$.
- Each ensemble releases one more variable to fluctuate, with relative spreads
  $\langle\Delta E^2\rangle^{1/2}/\langle E\rangle$ and
  $\langle\Delta N^2\rangle^{1/2}/\langle N\rangle$ of order $1/\sqrt N$; the
  three give identical intensive thermodynamics as $N\to\infty$ and can differ
  only where a fluctuation diverges, at a phase transition.
- The ideal gas yields $PV=Nk_BT$ in all three ensembles. The choice among them
  is set by which sum is easiest: canonical by default, microcanonical when the
  energy count is simple, grand canonical when the fixed-$N$ constraint blocks the
  sum, as for quantum gases.

[^equiv]: The $1/\sqrt N$ suppression of relative fluctuations and the resulting
equivalence of the canonical and microcanonical ensembles are established in the
[energy-fluctuations and ensemble-equivalence lesson](/statistical-mechanics/canonical/energy-fluctuations-and-ensemble-equivalence);
the number-fluctuation analogue is in the [chemical potential and number-fluctuations lesson](/statistical-mechanics/grand-canonical/chemical-potential-fugacity-and-number-fluctuations).
**Kardar**, _Statistical Physics of Particles_, §4.9–4.10; MIT OCW 8.333,
<https://ocw.mit.edu/courses/8-333-statistical-mechanics-i-statistical-mechanics-of-particles-fall-2013/>.
**Pathria & Beale**, _Statistical Mechanics_ (4th ed.), §4.5–4.6.
