Fiveable

🎲Statistical Mechanics Unit 3 Review

QR code for Statistical Mechanics practice questions

3.2 Canonical ensemble

3.2 Canonical ensemble

Written by the Fiveable Content Team • Last updated August 2025
Written by the Fiveable Content Team • Last updated August 2025
🎲Statistical Mechanics
Unit & Topic Study Guides

The canonical ensemble describes systems that can exchange energy with a large heat bath at fixed temperature. It's one of the most practical tools in statistical mechanics because real experiments usually involve systems at controlled temperature rather than perfectly isolated ones. Through the partition function, the canonical ensemble connects microscopic energy levels to every thermodynamic quantity you'd want to calculate.

Definition of canonical ensemble

The canonical ensemble applies to a system in thermal equilibrium with a heat bath at fixed temperature TT. The system can exchange energy with its surroundings, so its energy fluctuates, but the average energy stays constant. This setup is the natural framework for calculating macroscopic properties from microscopic interactions.

System and heat bath

The "system" is whatever collection of particles you're studying. The "heat bath" (or thermal reservoir) is a much larger system whose temperature doesn't change when energy flows in or out, because its heat capacity is enormous compared to the system's.

  • Energy flows freely between system and bath until thermal equilibrium is reached
  • The system's temperature equals the bath temperature TT, which stays fixed
  • The system's energy is not fixed; only the temperature is constrained

Probability distribution function

The probability of finding the system in microstate ii with energy EiE_i follows the Boltzmann distribution:

Pi=1ZeβEiP_i = \frac{1}{Z} e^{-\beta E_i}

where β=1kBT\beta = \frac{1}{k_B T} is the inverse temperature, kBk_B is Boltzmann's constant, and ZZ is the partition function (defined below).

  • Higher-energy microstates are exponentially less probable than lower-energy ones
  • The factor eβEie^{-\beta E_i} is called the Boltzmann factor
  • The normalization condition iPi=1\sum_i P_i = 1 is what defines ZZ

Partition function

The partition function ZZ is the single most important quantity in the canonical ensemble. Once you have it, you can extract essentially all thermodynamic information about the system.

Derivation of partition function

Start from the normalization requirement on the Boltzmann distribution. Summing PiP_i over all microstates and setting the result equal to 1 gives:

Z=ieβEiZ = \sum_i e^{-\beta E_i}

For systems with a continuous energy spectrum, the sum becomes an integral weighted by the density of states g(E)g(E), which counts how many microstates exist at energy EE:

Z=g(E)eβEdEZ = \int g(E) \, e^{-\beta E} \, dE

Properties of partition function

  • ZZ depends on temperature, volume, and particle number, but not on which microstate the system happens to be in
  • The Helmholtz free energy follows directly: F=kBTlnZF = -k_B T \ln Z
  • Derivatives of lnZ\ln Z with respect to β\beta, VV, or other parameters generate thermodynamic quantities (internal energy, pressure, entropy, etc.)
  • ZZ acts as a generating function: taking successive derivatives produces ensemble averages and fluctuation measures

Thermodynamic quantities

All standard thermodynamic quantities can be derived from the partition function. The key relations are worth memorizing, since they come up constantly.

Internal energy

The internal energy UU is the ensemble average of the energy:

U=E=lnZβU = \langle E \rangle = -\frac{\partial \ln Z}{\partial \beta}

This includes all kinetic and potential energy contributions. As temperature rises, higher-energy microstates become more accessible, so UU generally increases with TT.

Entropy

Entropy in the canonical ensemble can be written in two equivalent ways. The Gibbs (or Shannon) form is:

S=kBiPilnPiS = -k_B \sum_i P_i \ln P_i

Substituting the Boltzmann distribution into this expression and simplifying gives the more practical formula:

S=kB(lnZ+βU)S = k_B (\ln Z + \beta U)

Entropy increases with temperature because more microstates become comparably probable at higher TT.

Helmholtz free energy

The Helmholtz free energy FF is the thermodynamic potential natural to the canonical ensemble (constant TT and VV):

F=UTS=kBTlnZF = U - TS = -k_B T \ln Z

At constant temperature and volume, a system in equilibrium minimizes FF. This is the canonical ensemble's version of the second law.

System and heat bath, The First Law of Thermodynamics · Physics

Fluctuations in canonical ensemble

Because the system exchanges energy with the bath, its energy isn't perfectly sharp. These fluctuations carry physical meaning and connect directly to measurable response functions.

Energy fluctuations

The variance of the energy measures how broadly the energy is distributed around its mean:

(ΔE)2=E2E2\langle (\Delta E)^2 \rangle = \langle E^2 \rangle - \langle E \rangle^2

A powerful result links this variance to the heat capacity:

(ΔE)2=kBT2CV\langle (\Delta E)^2 \rangle = k_B T^2 C_V

The relative fluctuation (ΔE)2/U\sqrt{\langle (\Delta E)^2 \rangle} / U scales as 1/N1/\sqrt{N}, where NN is the number of particles. For macroscopic systems (N1023N \sim 10^{23}), relative fluctuations are negligibly small. This is why the canonical and microcanonical ensembles agree in the thermodynamic limit.

Specific heat

The heat capacity at constant volume is:

CV=(UT)VC_V = \left(\frac{\partial U}{\partial T}\right)_V

Equivalently, using the fluctuation relation:

CV=(ΔE)2kBT2C_V = \frac{\langle (\Delta E)^2 \rangle}{k_B T^2}

This second form is useful because it shows that CVC_V is always non-negative (it's a variance divided by positive quantities). Peaks or divergences in CVC_V signal phase transitions, since large energy fluctuations occur near critical points.

Applications of canonical ensemble

Ideal gas

For NN non-interacting particles in a box, the single-particle partition function factorizes into translational, rotational, and vibrational contributions. The translational part alone gives:

Z1=Vλ3Z_1 = \frac{V}{\lambda^3}

where λ=2π2mkBT\lambda = \sqrt{\frac{2\pi \hbar^2}{m k_B T}} is the thermal de Broglie wavelength. From the full NN-particle partition function (with the 1/N!1/N! Gibbs factor for indistinguishable particles), you recover the ideal gas law PV=NkBTPV = Nk_BT and the equipartition result: each quadratic degree of freedom contributes 12kBT\frac{1}{2}k_BT to the average energy.

Paramagnetism

Consider NN non-interacting spin-12\frac{1}{2} magnetic moments in an external field BB. Each spin has energy ±μB\pm \mu B, so the single-spin partition function is:

Z1=eβμB+eβμB=2cosh(βμB)Z_1 = e^{\beta \mu B} + e^{-\beta \mu B} = 2\cosh(\beta \mu B)

From this you can derive the average magnetization and the Curie law for the magnetic susceptibility:

χ=CT\chi = \frac{C}{T}

At low TT (large β\beta), spins align with the field. At high TT, thermal fluctuations randomize the spins and the magnetization vanishes.

Harmonic oscillator

The quantum harmonic oscillator has energy levels En=(n+12)ωE_n = (n + \frac{1}{2})\hbar\omega with n=0,1,2,n = 0, 1, 2, \ldots The partition function is a geometric series:

Z=eβω/21eβωZ = \frac{e^{-\beta \hbar \omega / 2}}{1 - e^{-\beta \hbar \omega}}

This result is central to modeling molecular vibrations and phonons in solids. At high temperature (kBTωk_BT \gg \hbar\omega), you recover the classical equipartition result E=kBT\langle E \rangle = k_BT. At low temperature, the system freezes into the ground state and the specific heat drops toward zero.

Canonical ensemble vs microcanonical ensemble

These two ensembles describe different physical setups. The microcanonical ensemble describes an isolated system at fixed energy EE. The canonical ensemble describes a system at fixed temperature TT in contact with a heat bath.

Equivalence in thermodynamic limit

As NN \to \infty, the two ensembles give identical predictions for all intensive thermodynamic quantities. This happens because relative energy fluctuations vanish as 1/N1/\sqrt{N}, so the canonical energy distribution becomes sharply peaked around the microcanonical energy. In practice, you can use whichever ensemble makes the calculation easier.

System and heat bath, The First Law of Thermodynamics · Physics

Practical differences

  • Canonical: fixes TT, allows energy fluctuations. Calculations are usually simpler because the partition function factorizes nicely for non-interacting systems.
  • Microcanonical: fixes EE, no fluctuations. More fundamental conceptually, but the combinatorial counting of microstates is often harder.
  • Most experimental setups correspond to the canonical ensemble (system in a thermostat), which is why it's used more frequently in practice.

Connection to statistical mechanics

Bridge to thermodynamics

The canonical ensemble provides explicit formulas connecting microscopic quantities to thermodynamic potentials:

  • F=kBTlnZF = -k_BT \ln Z gives the Helmholtz free energy
  • Differentiate FF to get entropy (S=F/TS = -\partial F / \partial T), pressure (P=F/VP = -\partial F / \partial V), and other response functions
  • The second law of thermodynamics emerges naturally: the equilibrium state maximizes entropy (or equivalently minimizes FF at constant T,VT, V)
  • Equations of state follow from appropriate derivatives of lnZ\ln Z

Boltzmann factor

The Boltzmann factor eβEie^{-\beta E_i} is the fundamental weight in the canonical ensemble. It can be derived by considering a small system in contact with a large reservoir and using the microcanonical ensemble for the combined (system + reservoir) setup. The key steps:

  1. The total system is isolated, so the combined system is microcanonical with total energy EtotE_{\text{tot}}

  2. The number of reservoir microstates when the system has energy EiE_i is ΩR(EtotEi)\Omega_R(E_{\text{tot}} - E_i)

  3. Expanding lnΩR\ln \Omega_R to first order in EiE_i (valid because EiEtotE_i \ll E_{\text{tot}}) yields PieβEiP_i \propto e^{-\beta E_i}

This derivation shows that temperature is fundamentally a statistical property, defined through β=lnΩ/E\beta = \partial \ln \Omega / \partial E of the reservoir.

Numerical methods

For systems with many interacting particles, the partition function can't be evaluated analytically. Numerical methods sample the Boltzmann distribution directly.

Monte Carlo simulations

Monte Carlo methods generate a sequence of configurations distributed according to PieβEiP_i \propto e^{-\beta E_i}. The most common algorithm is Metropolis-Hastings:

  1. Start from some configuration with energy EoldE_{\text{old}}

  2. Propose a random change (e.g., flip a spin, move a particle)

  3. Calculate the energy change ΔE=EnewEold\Delta E = E_{\text{new}} - E_{\text{old}}

  4. If ΔE0\Delta E \leq 0, accept the move

  5. If ΔE>0\Delta E > 0, accept with probability eβΔEe^{-\beta \Delta E}; otherwise reject

  6. Repeat; after many steps, the sampled configurations follow the Boltzmann distribution

This approach is widely used for the Ising model, lattice gases, polymers, and other systems where direct summation over microstates is impossible.

Molecular dynamics

Molecular dynamics (MD) solves Newton's equations of motion numerically for all particles. To sample the canonical ensemble rather than the microcanonical one, you couple the system to a thermostat (e.g., Nosé-Hoover). MD provides both equilibrium thermodynamic averages and dynamical information like diffusion coefficients and time correlation functions. Applications range from protein folding to materials science.

Limitations and extensions

Quantum canonical ensemble

When quantum effects matter (low temperatures, light particles, discrete energy spectra), the classical sum over states is replaced by a trace over the quantum Hamiltonian:

Z=Tr(eβH^)Z = \text{Tr}(e^{-\beta \hat{H}})

This naturally incorporates quantum statistics: bosons obey Bose-Einstein statistics and fermions obey Fermi-Dirac statistics. Zero-point energy is included automatically. The quantum canonical ensemble is essential for understanding phenomena like superconductivity, superfluidity, and quantum phase transitions.

Non-equilibrium considerations

The canonical ensemble strictly applies only to systems in thermal equilibrium. For systems driven out of equilibrium by external forces, temperature gradients, or time-dependent fields, extensions are needed. Fluctuation theorems (like the Jarzynski equality) generalize free energy relations to non-equilibrium processes. These results connect irreversible work measurements to equilibrium free energy differences and are actively applied to biological systems, active matter, and driven quantum systems.