---
title: The Canonical Ensemble and the Boltzmann Distribution
module: The Canonical Ensemble
moduleNumber: 4
lessonNumber: 1
order: 401
summary: >
  A system held at fixed temperature by contact with a heat reservoir is
  described by the canonical ensemble. Expanding the reservoir entropy to first
  order in the system energy gives the Boltzmann distribution
  $p_i\propto e^{-\beta E_i}$, and the same law follows from maximizing the Gibbs
  entropy at fixed mean energy. Both routes identify $\beta=1/k_BT$ and fix the
  probability of every microstate from the temperature alone.
topics: [The Canonical Ensemble]
sources:
  - book: Schroeder
    ref: "Ch. 6 — Boltzmann Statistics; §6.1 The Boltzmann Factor"
  - book: Reif
    ref: "Ch. 6 — Basic Methods and Results of Statistical Mechanics; §6.1–6.4"
  - book: Kardar (Statistical Physics of Particles)
    ref: "Ch. 4 — Classical Statistical Mechanics; §4.6 The Canonical Ensemble"
  - book: Pathria & Beale
    ref: "Ch. 3 — The Canonical Ensemble; §3.1–3.2"
draft: false
---

The microcanonical ensemble fixes the energy exactly and counts the microstates
consistent with it. That description is natural for an isolated system but
awkward for the systems actually met in a laboratory, which sit in thermal
contact with their surroundings and hold a fixed temperature rather than a fixed
energy. The canonical ensemble is the description adapted to that situation: the
system of interest exchanges energy freely with a large reservoir, its energy
fluctuates, and what is held constant is the temperature the reservoir imposes.
The central result is that the probability of finding the system in a definite
microstate depends on that microstate only through its energy, and does so
through a single exponential, the Boltzmann factor.

## System and reservoir

Let a system $S$ be in thermal contact with a reservoir $R$ much larger than
itself, the two enclosed by rigid adiabatic walls so that the combined system
$S\cup R$ is isolated with fixed total energy $E_{\rm tot}$. Energy passes freely
across the internal diathermal wall, so the system energy is not fixed; only the
sum $E_S + E_R = E_{\rm tot}$ is.[^reif-canonical] The reservoir is defined by
being so large that any energy the system draws from it changes its temperature
negligibly: $C_R \to \infty$, and $E_{\rm tot}\approx E_R$.

The combined system is isolated, so the microcanonical postulate applies to it:
every microstate of $S\cup R$ consistent with the total energy is equally likely.
Fix attention on one definite microstate $i$ of the system, with energy $E_i$.
The reservoir must then hold energy $E_{\rm tot}-E_i$, and the number of
combined microstates in which the system occupies exactly state $i$ equals the
number of reservoir microstates at that energy, $\Omega_R(E_{\rm tot}-E_i)$. By
equal a priori probability, the probability of the system microstate $i$ is
proportional to that reservoir count,

$$
p_i \;\propto\; \Omega_R(E_{\rm tot}-E_i).
$$

The system multiplicity does not appear: $i$ is a single specified microstate,
weighted only by how many ways the reservoir can supply the complementary energy.

$$
% caption: A small system exchanges energy with a large reservoir across a diathermal wall; the total energy is fixed, and each system microstate of energy $E_i$ is weighted by the reservoir's multiplicity at the complementary energy.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black,very thick] (-0.4,-0.4) rectangle (9.2,4.4);
\node[black] at (7.9,4.05) {isolated total};
\fill[black] (-0.4,-0.4) rectangle (9.2,4.4);
\draw[acc,very thick,fill=acc!12] (0.4,0.8) rectangle (3.2,3.4);
\node[acc] at (1.8,2.4) {system $S$};
\node[acc,font=\scriptsize] at (1.8,1.6) {energy $E_i$};
\node[black] at (6.6,3.7) {reservoir $R$};
\node[black,font=\scriptsize] at (6.6,0.15) {large heat bath at temperature $T$};
\draw[<->,black,very thick] (3.35,2.1)--(4.5,2.1) node[midway,above]{energy};
\end{tikzpicture}
$$

## Expanding the reservoir entropy

The reservoir count is enormous and varies rapidly with energy, so it is the
logarithm that is well-behaved. Write it through the reservoir entropy,
$k_B\ln\Omega_R(E_R) = S_R(E_R)$, and expand $S_R$ about the full energy
$E_{\rm tot}$ in powers of the small system energy $E_i$:

$$
\ln\Omega_R(E_{\rm tot}-E_i)
= \frac{1}{k_B}\,S_R(E_{\rm tot}-E_i)
= \frac{1}{k_B}\left[
S_R(E_{\rm tot})
- E_i\left(\frac{\partial S_R}{\partial E_R}\right)
+ \tfrac{1}{2}E_i^2\left(\frac{\partial^2 S_R}{\partial E_R^2}\right)
- \cdots\right].
$$

The first derivative is the reservoir's inverse temperature, by the
thermodynamic definition established in the microcanonical ensemble,

$$
\left(\frac{\partial S_R}{\partial E_R}\right)_{E_{\rm tot}} = \frac{1}{T}.
$$

The second derivative measures how the reservoir temperature responds to energy
loss: $\partial^2 S_R/\partial E_R^2 = -1/(T^2 C_R)$, where $C_R$ is the
reservoir heat capacity. For a reservoir this term and all higher ones scale as
inverse powers of $C_R$ and vanish in the limit $C_R\to\infty$.[^reif-expand]
The expansion collapses to its linear term,

$$
\ln\Omega_R(E_{\rm tot}-E_i)
= \frac{S_R(E_{\rm tot})}{k_B} - \frac{E_i}{k_B T} + O\!\left(\frac{1}{C_R}\right).
$$

Exponentiating, the constant $S_R(E_{\rm tot})$ produces an $E_i$-independent
prefactor absorbed into normalization, and the probability of system microstate
$i$ is

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

> **Definition (Boltzmann distribution).** For a system in equilibrium with a
> heat reservoir at temperature $T$, the probability of a definite microstate
> $i$ of energy $E_i$ is $p_i = e^{-\beta E_i}/Z$, with $\beta = 1/k_B T$ and the
> normalizing sum $Z = \sum_i e^{-\beta E_i}$ taken over all microstates. The
> exponential $e^{-\beta E_i}$ is the **Boltzmann factor**.

The distribution is a statement about microstates, not energy levels. If several
microstates share an energy $E$ — a degeneracy $g(E)$ — the probability that the
system has that energy is $g(E)e^{-\beta E}/Z$, the Boltzmann factor weighted by
the number of states carrying it. This distinction between a single microstate
and an energy level with its degeneracy is the source of every entropy term that
follows.

The linearization is the entire physical content. Only the first derivative of
the reservoir entropy survives, and that derivative is the temperature; the
reservoir influences the system through one number. The ratio of probabilities
of two microstates,

$$
\frac{p_i}{p_j} = e^{-\beta(E_i - E_j)},
$$

depends only on their energy difference and the temperature, never on the
reservoir's internal structure or on $E_{\rm tot}$.

$$
% caption: The reservoir entropy $S_R(E_{\rm tot}-E_i)$ is nearly linear in the small system energy $E_i$; the slope $-1/T$ sets the Boltzmann factor, and the curvature scales as $1/C_R$ and vanishes for a large reservoir.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(7.0,0) node[right,black]{$E_i$};
\draw[->,black] (0,0)--(0,4.4) node[above,black]{reservoir entropy};
\draw[acc,very thick] plot[domain=0.2:6.4,samples=60] (\x,{3.9-0.42*\x-0.018*\x*\x});
\draw[black,very thick,dashed] (0.2,{3.9-0.42*0.2})--(6.4,{3.9-0.42*6.4});
\node[black] at (4.3,1.0) {linear tangent};
\node[acc] at (4.7,3.0) {true curve};
\filldraw[black] (0.2,{3.9-0.42*0.2-0.018*0.04}) circle (1.6pt) node[above right,black!70]{$E_i=0$};
\end{tikzpicture}
$$

## Maximum entropy at fixed mean energy

A second derivation reaches the same distribution without invoking a reservoir at
all, by asking which probability assignment over microstates is least committal
given a known mean energy. This is the maximum-entropy route, and it exposes
$\beta$ as the multiplier enforcing the energy constraint.[^kardar-maxent]

Take the Gibbs entropy of an arbitrary distribution $\{p_i\}$ over the system
microstates,

$$
S = -k_B\sum_i p_i\ln p_i,
$$

and maximize it subject to two constraints: normalization $\sum_i p_i = 1$ and a
fixed mean energy $\sum_i p_i E_i = \langle E\rangle$. Introduce Lagrange
multipliers $\alpha$ and $\beta$ for the two constraints and extremize the
functional

$$
\mathcal{L} = -k_B\sum_i p_i\ln p_i
- k_B\alpha\Big(\sum_i p_i - 1\Big)
- k_B\beta\Big(\sum_i p_i E_i - \langle E\rangle\Big).
$$

Setting $\partial\mathcal{L}/\partial p_i = 0$ gives, for each microstate,

$$
-\ln p_i - 1 - \alpha - \beta E_i = 0
\;\Longrightarrow\;
p_i = e^{-1-\alpha}\,e^{-\beta E_i}.
$$

Normalization fixes the prefactor, $e^{-1-\alpha} = 1/Z$ with
$Z = \sum_i e^{-\beta E_i}$, so $p_i = e^{-\beta E_i}/Z$: the Boltzmann
distribution again. The extremum is a maximum because $-\sum_i p_i\ln p_i$ is
concave in $\{p_i\}$, so the stationary point is unique and is the global
maximum.

The second multiplier $\beta$ is fixed by matching to thermodynamics. The maximum
value of the Gibbs entropy, evaluated on the Boltzmann distribution, obeys
$\d S = k_B\beta\,\d\langle E\rangle$ at fixed constraints, and comparison with
the thermodynamic relation $\d S = \d U/T$ at constant volume gives
$\beta = 1/k_B T$.[^schroeder-beta] The two derivations agree: the reservoir
imposes the same distribution that maximum-entropy inference selects, and in both
$\beta$ is the inverse temperature in energy units.

> **Theorem (Boltzmann distribution as maximum entropy).** Among all
> probability distributions over the microstates of a system with prescribed mean
> energy $\langle E\rangle$, the Gibbs entropy $-k_B\sum_i p_i\ln p_i$ is
> maximized uniquely by $p_i = e^{-\beta E_i}/Z$, where $\beta$ is fixed by the
> value of $\langle E\rangle$. The canonical distribution is therefore the least
> biased assignment consistent with the known mean energy.

$$
% caption: The Gibbs entropy of a two-microstate system, $-k_B[p\ln p+(1-p)\ln(1-p)]$, is concave with a single maximum; a fixed mean energy shifts the extremum to the Boltzmann weights rather than the equal-probability peak.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(7.0,0) node[right,black]{$p_1$};
\draw[->,black] (0,0)--(0,4.2) node[above,black]{entropy $S$};
\draw[acc,very thick] plot[domain=0.02:0.98,samples=80] (\x*6.4,{-3.8*((\x)*ln(\x)+(1-\x)*ln(1-\x))});
\draw[black,dashed] (3.2,0)--(3.2,{3.8*0.6931});
\filldraw[black] (3.2,{3.8*0.6931}) circle (1.6pt) node[above,black!70]{max at equal weights};
\node[acc] at (5.2,1.1) {concave in $p_1$};
\end{tikzpicture}
$$

## The temperature scale of the exponential

The Boltzmann factor sets an energy scale $k_B T$ against which every level gap is
measured. States with $E_i - E_0 \ll k_B T$ above the ground state are populated
nearly as heavily as the ground state; states with $E_i - E_0 \gg k_B T$ are
exponentially suppressed. Temperature is the width of the accessible band: raising
$T$ flattens the exponential and spreads probability up the spectrum, lowering it
concentrates the system into its lowest states.

$$
% caption: The Boltzmann factor $e^{-\beta E}$ against microstate energy at two temperatures; the higher temperature (shallower curve) spreads probability up the spectrum, the lower temperature concentrates it near the ground state.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(7.0,0) node[right,black]{$E$};
\draw[->,black] (0,0)--(0,4.4) node[above,black]{Boltzmann factor};
\draw[acc,very thick] plot[domain=0:6.6,samples=70] (\x,{4.0*exp(-0.75*\x)});
\draw[black,very thick,dashed] plot[domain=0:6.6,samples=70] (\x,{4.0*exp(-0.25*\x)});
\node[acc] at (2.1,2.9) {low $T$ (steep)};
\node[black] at (4.9,2.35) {high $T$ (shallow)};
\filldraw[black] (0,4.0) circle (1.6pt);
\node[black!70,font=\scriptsize] at (0.9,4.1) {ground state};
\end{tikzpicture}
$$

The Boltzmann distribution built here is the working tool of the rest of the
module. The normalizing sum $Z$, treated so far as a bookkeeping constant, turns
out to encode all of the thermodynamics: differentiating it produces the mean
energy, entropy, pressure, and the free energy, which is the subject of the next
lesson.

## Summary

- A system in thermal contact with a large reservoir at temperature $T$ is
  described by the **canonical ensemble**: the total $S\cup R$ is isolated, so
  each system microstate $i$ is weighted by the reservoir multiplicity
  $\Omega_R(E_{\rm tot}-E_i)$.
- Expanding the reservoir entropy to first order in $E_i$ keeps only the slope
  $\partial S_R/\partial E_R = 1/T$; higher terms scale as $1/C_R$ and vanish for
  a large reservoir, giving $p_i = e^{-\beta E_i}/Z$ with $\beta = 1/k_B T$.
- Maximizing the Gibbs entropy $-k_B\sum_i p_i\ln p_i$ at fixed mean energy yields
  the same distribution, with $\beta$ the Lagrange multiplier for the energy
  constraint; the canonical distribution is the least biased one consistent with
  a known $\langle E\rangle$.
- The Boltzmann factor measures every level gap against the energy scale $k_B T$:
  states within $k_B T$ of the ground state are appreciably populated, states far
  above it are exponentially rare, and raising $T$ spreads probability up the
  spectrum.

[^reif-canonical]: **Reif**, _Fundamentals of Statistical and Thermal Physics_, §6.1–6.2 — the ensemble of a system in contact with a heat bath, and the derivation of the canonical distribution from the microcanonical postulate applied to the combined system. Full text via the Waveland reprint (2009).
[^reif-expand]: **Reif**, _Fundamentals of Statistical and Thermal Physics_, §6.2, and **Kardar**, _Statistical Physics of Particles_, §4.6 — the Taylor expansion of the reservoir entropy and the argument that curvature terms are suppressed by the reservoir heat capacity. Kardar's treatment: MIT OCW 8.333, <https://ocw.mit.edu/courses/8-333-statistical-mechanics-i-statistical-mechanics-of-particles-fall-2013/>.
[^kardar-maxent]: **Kardar**, _Statistical Physics of Particles_, §4.6, and **Pathria & Beale**, _Statistical Mechanics_ (4th ed.), §3.2 — the canonical distribution as the maximum-entropy assignment at fixed mean energy, with $\beta$ the multiplier conjugate to the energy constraint.
[^schroeder-beta]: **Schroeder**, _An Introduction to Thermal Physics_, §6.1 — the Boltzmann factor from the multiplicity of the reservoir, and the identification $\beta = 1/k_B T$ by matching to the thermodynamic definition of temperature. Companion material at <https://physics.weber.edu/schroeder/thermal/>.
