advanced29 min studyLesson 32 in Physics

The canonical ensemble and partition function

Derive Boltzmann weights from a reservoir and extract energy, free energy, heat capacity, and fluctuations from one finite sum.

On this page

What you’ll understand

  • Derive canonical probabilities from a large weakly coupled reservoir.
  • Differentiate the partition function to obtain energy and its variance.
  • Compute the temperature response of a two-level system without treating its energy as fixed.

An object in a heat bath exchanges energy, so assigning it one exact energy shell is no longer the useful description. The canonical ensemble replaces that constraint with a reservoir temperature. Every energy eigenstate remains possible, but its probability is weighted by the number of bath states left available. A partition function normalizes those weights and also packages the measurable response. We will use a two-level object to distinguish a probability distribution, a mean energy, and the energy of one individual measurement.

The bath explains the exponential

Consider a small system with energy eigenvalue EiE_i and a much larger isolated reservoir. Their weak interaction permits energy exchange while contributing negligibly to their equilibrium energies. The reservoir has energy Etot−EiE_{\mathrm{tot}}-E_i. Expand its entropy to first order around the unperturbed energy. Its entropy slope is 1/T1/T, so the probability for state ii is proportional to e−Ei/(kBT)e^{-E_i/(k_BT)}. A constant reservoir term cancels during normalization.

The approximation requires that transferring an appreciable system energy does not significantly alter the reservoir temperature. It also assumes equilibration and a coupling weak enough that the chosen isolated-system energy spectrum is meaningful. A strongly coupled subsystem can require an effective Hamiltonian of mean force instead. Sum over states, including degeneracies: two distinct excited states with the same energy contribute two exponential terms, rather than being silently merged into one state.

β=1kBT,Z(β)=∑ie−βEi,pi=e−βEiZ,F=−kBTln⁡Z\beta=\frac1{k_BT},\qquad Z(\beta)=\sum_i e^{-\beta E_i},\qquad p_i=\frac{e^{-\beta E_i}}{Z},\qquad F=-k_BT\ln Z
Z normalizes probabilities; F is the Helmholtz free energy for fixed volume and particle number. The chosen energy levels are held fixed when differentiating with respect to β.↔ Scroll wide equations horizontally.

Derivatives become observables

Differentiate the logarithm of the partition function. One derivative inserts an energy factor and produces minus the mean energy. A second derivative produces the mean square minus the square of the mean: the variance. This identity is exact for a finite canonical sum with temperature-independent levels. Applying the chain rule then relates that variance to heat capacity at fixed volume and particle number. The result makes equilibrium fluctuations a quantitative response diagnostic.

A small system can have a broad energy distribution even though the bath temperature is sharply controlled. For many weakly correlated degrees of freedom away from criticality, energy variance often grows as system size while mean energy grows as size, suppressing relative fluctuations as the inverse square root of size. This scaling can fail near a transition or under long-range correlations. Canonical and microcanonical ensembles may agree on bulk observables in suitable limits without becoming identical finite probability distributions.

U=−∂ln⁡Z∂β,Var⁡(E)=∂2ln⁡Z∂β2,CV=Var⁡(E)kBT2U=-\frac{\partial\ln Z}{\partial\beta},\qquad \operatorname{Var}(E)=\frac{\partial^2\ln Z}{\partial\beta^2},\qquad C_V=\frac{\operatorname{Var}(E)}{k_BT^2}
The canonical heat capacity is nonnegative for this fixed-spectrum equilibrium model. Temperature-dependent effective energy levels need additional derivative terms.↔ Scroll wide equations horizontally.

A finite spectrum produces a heat-capacity peak

For one nondegenerate ground state at zero and one excited state at ϵ>0\epsilon>0, the excited probability is 1/(1+eβϵ)1/(1+e^{\beta\epsilon}). At low positive temperature excitation is exponentially rare. At very high temperature the two states become equally probable, so the energy approaches ϵ/2\epsilon/2 rather than growing without bound. Heat capacity becomes small in both limits and develops an intermediate Schottky peak. A bounded two-level spectrum cannot obey classical equipartition at every temperature.

Adding a constant to every energy multiplies ZZ by one common exponential, shifting UU and FF but leaving probabilities, entropy, variance, and heat capacity unchanged. By contrast, changing the gap alters the relative weights and measurable response. For independent units the total partition function factorizes and the logarithm adds. Finite systems have smooth partition sums for positive temperature; a genuine nonanalytic phase transition generally requires a thermodynamic limit rather than a sharp-looking plot from a few levels.

A gap equal to a logarithmic thermal scale

A nondegenerate two-level object has gap ϵ\epsilon and βϵ=ln⁡3\beta\epsilon=\ln3. Compute its excited-state probability, energy variance, and heat capacity.

  1. The Boltzmann factor is e−βϵ=1/3e^{-\beta\epsilon}=1/3, so Z=4/3Z=4/3 and the excited probability is (1/3)/(4/3)=1/4(1/3)/(4/3)=1/4.

  2. The mean energy is ϵ/4\epsilon/4 and the second moment is ϵ2/4\epsilon^2/4. Subtraction gives Var⁡(E)=3ϵ2/16\operatorname{Var}(E)=3\epsilon^2/16.

  3. Use ϵ/(kBT)=ln⁡3\epsilon/(k_BT)=\ln3 to obtain CV/kB=3(ln⁡3)2/16≈0.226303C_V/k_B=3(\ln3)^2/16\approx0.226303. The mean energy is not an allowed single-measurement outcome, which is either zero or ϵ\epsilon.

The result

The same normalized two-state distribution determines both energy fluctuations and the response to changing bath temperature.

Explore the model

Interactive lab

Interactive lab · probability

Independent thermal excitations

Set p to the canonical excited probability and let n count identical independent two-level objects. The exact binomial distribution gives the total excitation count; multiplying that count by the common gap gives total energy.

Independent thermal excitationsThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forThis mapping assumes noninteracting distinguishable objects with a fixed common gap and an ideal reservoir. The controls set probability directly; the lab does not infer temperature, model bath dynamics, or include correlated excitations.

Check your understanding

A constant a is added to every energy level. What happens to the canonical energy variance at the same temperature?

Try it yourself

Keep a ground-state degeneracy of one but give the excited energy ϵ\epsilon a degeneracy of two. At βϵ=ln⁡3\beta\epsilon=\ln3, find the total excited probability, mean energy, and variance.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Count both excited states in Z, then use a Bernoulli variable for whether the object is excited at all.

Compare with the solution

The partition function is Z=1+2/3=5/3Z=1+2/3=5/3. The total excited probability is (2/3)/(5/3)=2/5(2/3)/(5/3)=2/5. Consequently U=2ϵ/5U=2\epsilon/5 and Var⁡(E)=ϵ2(2/5)(3/5)=6ϵ2/25\operatorname{Var}(E)=\epsilon^2(2/5)(3/5)=6\epsilon^2/25. Each individual excited eigenstate has probability 1/51/5; confusing state probability with level probability would miss the degeneracy.

Take it with you

  • Boltzmann weights follow from a reservoir entropy expansion with controlled weak-coupling assumptions.
  • Logarithmic partition-function derivatives generate energy and its fluctuations.
  • Finite spectra, degeneracy, and correlations determine when simple extensive or equipartition arguments apply.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.