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
The question for today
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 and a much larger isolated reservoir. Their weak interaction permits energy exchange while contributing negligibly to their equilibrium energies. The reservoir has energy . Expand its entropy to first order around the unperturbed energy. Its entropy slope is , so the probability for state is proportional to . 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.
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.
A finite spectrum produces a heat-capacity peak
For one nondegenerate ground state at zero and one excited state at , the excited probability is . At low positive temperature excitation is exponentially rare. At very high temperature the two states become equally probable, so the energy approaches 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 by one common exponential, shifting and 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.
Work it through
A gap equal to a logarithmic thermal scale
A nondegenerate two-level object has gap and . Compute its excited-state probability, energy variance, and heat capacity.
The Boltzmann factor is , so and the excited probability is .
The mean energy is and the second moment is . Subtraction gives .
Use to obtain . The mean energy is not an allowed single-measurement outcome, which is either zero or .
The same normalized two-state distribution determines both energy fluctuations and the response to changing bath temperature.
The living notebook
Explore the model
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.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
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.
Pause & reason
Check your understanding
Your turn
Try it yourself
Keep a ground-state degeneracy of one but give the excited energy a degeneracy of two. At , 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 . The total excited probability is . Consequently and . Each individual excited eigenstate has probability ; confusing state probability with level probability would miss the degeneracy.
Keep the idea
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.