JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

The Canonical Ensemble and the Partition Function

The workhorse of the whole subject. When a system sits in a heat bath at temperature T, its state probabilities follow the Boltzmann factor — and one magical sum, the partition function Z, encodes every thermodynamic property of the system.

From isolation to a heat bath

Real experiments almost never fix a system's energy. Far more often we fix its temperature by keeping it in contact with a large reservoir — the lab bench, the atmosphere, a water bath. Energy then flows freely back and forth, and the system's energy fluctuates around an average. The ensemble for this situation, the most useful one in all of physics, is the canonical ensemble: fixed T, V, N.

Here is the elegant derivation. Consider the system plus a huge heat bath, together isolated with total energy E_{\text{tot}}. When the system sits in one particular microstate of energy E_i, the bath must hold E_{\text{tot}}-E_i, and the number of ways the bath can do that is \Omega_{\text{bath}}(E_{\text{tot}}-E_i). By the fundamental postulate the probability of the system's microstate is proportional to that bath multiplicity.

Deriving the Boltzmann factor

Work with the log. Since E_i \ll E_{\text{tot}}, expand the bath's entropy S_{\text{bath}}=k_B\ln\Omega_{\text{bath}} to first order around E_{\text{tot}}: S_{\text{bath}}(E_{\text{tot}}-E_i)\approx S_{\text{bath}}(E_{\text{tot}}) - E_i\,(\partial S_{\text{bath}}/\partial E). But that derivative is exactly $1/T$. So \Omega_{\text{bath}}\propto e^{-E_i/k_BT}, and the probability of the system being in microstate i is the celebrated Boltzmann factor:

P_i = \frac{e^{-E_i/k_B T}}{Z} = \frac{e^{-\beta E_i}}{Z}, \qquad \beta \equiv \frac{1}{k_B T}

The probability of a microstate in the canonical ensemble. States of higher energy are exponentially less likely; the 'inverse temperature' \beta=1/k_BT sets the steepness. Z is the normalizing constant.

Occupation of energy levels following e^{-E/k_BT}. Raise the temperature and population spreads from the ground state up into excited states; lower it and everything crowds into the lowest levels. The partition function is what normalizes these weights.

The partition function Z

Normalization (\sum_i P_i = 1) forces the constant Z to be a sum over all microstates of their Boltzmann factors. This object — the partition function, Z for the German Zustandssumme, 'sum over states' — is the single most important quantity in statistical mechanics.

Z = \sum_i e^{-\beta E_i} = \sum_{\text{levels}} g_n\, e^{-\beta E_n}

The partition function: a sum over microstates, or equivalently over energy levels weighted by their degeneracy g_n. Once you can compute Z, you can compute everything.

Each energy level contributes a Boltzmann-weighted term; Z is their total. Low levels contribute near 1, high levels almost nothing. Z is roughly the effective number of thermally accessible states — it grows with temperature.

Extracting all of thermodynamics

Why is Z so powerful? Because thermodynamic quantities are its derivatives. The average energy is a single derivative of \ln Z:

\langle E\rangle = -\frac{\partial \ln Z}{\partial \beta} = k_B T^2\,\frac{\partial \ln Z}{\partial T}

The mean energy from the partition function. This turns a hard average over 10^{23} particles into a routine derivative of one function.

The true jewel is the bridge to free energy. Just as S=k_B\ln\Omega bridges the microcanonical ensemble, the canonical ensemble's bridge is to the Helmholtz free energy F=E-TS:

F = -k_B T \ln Z \;\Longrightarrow\; S = -\left(\frac{\partial F}{\partial T}\right)_{V,N},\quad P = -\left(\frac{\partial F}{\partial V}\right)_{T,N},\quad \mu = \left(\frac{\partial F}{\partial N}\right)_{T,V}

The master formula. Compute Z, take F=-k_BT\ln Z, then differentiate to get entropy, pressure and chemical potential — the entire thermodynamics of the system.

Fluctuations and heat capacity

The canonical energy is not sharp — it fluctuates. A second derivative of \ln Z gives the size of those fluctuations, and remarkably it is tied to a measurable response, the heat capacity:

\langle (\Delta E)^2\rangle = \frac{\partial^2 \ln Z}{\partial \beta^2} = k_B T^2\, C_V

Energy fluctuations equal k_BT^2 times the heat capacity — a fluctuation–dissipation relation. The relative spread scales as 1/\sqrt{N}, so for macroscopic N the energy is effectively sharp.

This is profound and practical at once. It says the spontaneous jiggling of a system's energy (fluctuation) is controlled by how much energy it absorbs when heated (response). And because C_V\sim N while \langle E\rangle\sim N, the relative fluctuation \Delta E/\langle E\rangle\sim 1/\sqrt{N} vanishes for macroscopic systems — which is why the fixed-energy microcanonical and fixed-temperature canonical ensembles give identical thermodynamics. We will make that equivalence explicit in the final guide.