Canonical Ensemble

Almost nothing in the real world is thermally isolated. A protein folding in a cell, a magnet in a lab, a cup of coffee on a desk — each is in constant thermal contact with a vast surrounding "reservoir" that fixes its temperature but lets its energy drift. This is the situation the canonical ensemble describes, and it is the workhorse of statistical mechanics precisely because it matches how experiments are actually done: you control the temperature, not the energy. The microcanonical ensemble (fixed energy, isolated system) is conceptually primary but practically awkward — energy is hard to hold fixed and the counting is combinatorially brutal. The canonical ensemble trades the rigid energy constraint for a fixed temperature, and the payoff is enormous: the probability of a microstate takes the astonishingly simple form pi=e−βEi/Zp_i = e^{-\beta E_i}/Z, the Boltzmann distribution, where β=1/kBT\beta=1/k_BT and ZZ is a normalizing sum. High-energy states are exponentially suppressed; the temperature sets the scale of how much energy the system can "afford." From this one distribution, everything flows. The mean energy is a derivative of ln⁡Z\ln Z; the entropy, free energy, pressure, and heat capacity all follow by differentiation; and the energy — though no longer fixed — is so sharply peaked (relative width ∼N−1/2\sim N^{-1/2}) that for a macroscopic system the canonical and microcanonical descriptions become indistinguishable. This article introduces the canonical ensemble, states the Boltzmann distribution and its consequences, solves the two-level system completely as a first concrete example, and sets up the partition function that the next articles turn into a complete thermodynamic engine.

Key takeaways
  • The canonical ensemble describes a system in thermal contact with a heat reservoir at fixed TT, VV, NN; its energy fluctuates while its temperature is fixed.
  • The probability of a microstate is the Boltzmann distribution pi=e−βEi/Zp_i = e^{-\beta E_i}/Z, with β=1/kBT\beta=1/k_BT and Z=∑ie−βEiZ=\sum_i e^{-\beta E_i}.
  • The mean energy is ⟨E⟩=−∂βln⁡Z\langle E\rangle = -\partial_\beta\ln Z — a derivative of the log of the normalizing sum.
  • Energy fluctuates but is sharply peaked: relative width ∼N−1/2\sim N^{-1/2}, so canonical ≈ microcanonical for large systems (ensemble equivalence).
  • The two-level system is the simplest nontrivial case: ⟨E⟩=ε/(eβε+1)\langle E\rangle = \varepsilon/(e^{\beta\varepsilon}+1), tending to ε/2\varepsilon/2 at high TT and 00 at low TT.
  • Key idea: fixing the temperature (not the energy) makes the microstate probability e−βEi/Ze^{-\beta E_i}/Z, from which all equilibrium thermodynamics follows by differentiating ln⁡Z\ln Z.
The core insight

The canonical ensemble replaces the fixed-energy constraint with a fixed temperature by coupling the system to a heat reservoir. The resulting microstate probability is the Boltzmann distribution pi=e−βEi/Zp_i=e^{-\beta E_i}/Z, and every equilibrium quantity — mean energy, entropy, free energy, fluctuations — follows from derivatives of the partition function Z=∑ie−βEiZ=\sum_i e^{-\beta E_i}.

Where this lives today

The canonical ensemble is the default framework for essentially all of equilibrium statistical mechanics and its computational offspring. Molecular dynamics and Monte Carlo simulations — the tools that predict protein structures, design drugs, and model materials — almost always run in the canonical (constant-temperature) ensemble, using thermostats to couple the simulated system to a virtual heat bath so that configurations are sampled with the Boltzmann weight e−βEe^{-\beta E}. The Metropolis algorithm, the most-used simulation method in physics and chemistry, is precisely a scheme for generating states with canonical probabilities. Beyond simulation, the Boltzmann distribution is a universal law that shows up wherever a system equilibrates with its surroundings. It sets the population of atomic and molecular energy levels (the basis of spectroscopy and of reading temperatures from starlight), the occupancy of vibrational modes in solids (heat capacity), the rate of thermally activated processes (the Arrhenius law ∝e−Ea/kBT\propto e^{-E_a/k_BT} that governs chemical reaction rates and diffusion), and even the firing statistics of model neurons and the weights in Boltzmann-machine neural networks, which borrow the distribution directly. The quantum version, ρ=e−βH^/Z\rho = e^{-\beta\hat H}/Z, is the starting point for computing the thermodynamics of everything from superconductors to the quark–gluon plasma. Few equations in physics are as ubiquitous as pi=e−βEi/Zp_i=e^{-\beta E_i}/Z.

The physical picture

Imagine a small system in contact with an enormous heat bath — a droplet of ink in the ocean. Energy sloshes freely across the boundary, but because the bath is so much bigger, the temperature barely moves; the bath sets TT, and the small system equilibrates to it. The small system's energy is no longer fixed: at any instant, it might be a little above or below its mean, borrowing from or lending to the bath. What is fixed is the statistical distribution of its energy, and that distribution is the Boltzmann law.

Figure
System coupled to a large heat reservoir: energy flows across the boundary, the reservoir fixes T, and the system's microstate probability becomes e^{-βE}/Z.
reservoir (heat bath) at fixed T system E fluctuates energy in energy out p_i = e^{−βE_i} / Z β = 1/(k_B T) Z = Σ e^{−βE_i}

The Boltzmann factor e−βEie^{-\beta E_i} is at the heart of it: it says that a microstate with energy EiE_i is exponentially less likely the higher its energy, with the temperature setting the exponential's scale. At high temperature (β\beta small), the exponential is flat — all states are nearly equally likely, and the system samples widely. At low temperature (β\beta large), the exponential is steep — only the lowest-energy states survive, and the system freezes into its ground state. Temperature is the knob that controls how far up the energy ladder the system can afford to climb. Although the energy is not fixed, it is remarkably sharp. The distribution of the total energy of a macroscopic system is a narrow peak whose relative width shrinks as 1/N1/\sqrt{N} — for a mole of particles, the energy is defined to one part in 101210^{12}. This is why the canonical ensemble (fixed TT, fluctuating EE) and the microcanonical ensemble (fixed EE) agree for large systems: the fluctuating energy is, for all practical purposes, pinned at its mean. The punchline plot below shows this sharpening — the energy distribution narrows dramatically as NN grows, so "the energy at temperature TT" becomes a well-defined number.

Figure
The canonical energy distribution sharpens as N grows: relative width ~ 1/√N, so a macroscopic system's energy is effectively fixed — ensemble equivalence.
E/NP(E) ⟨E⟩/N small N: broad large N: sharp (width ~1/√N)

The core equations

The defining result of the canonical ensemble is the Boltzmann distribution for the probability of a microstate, together with its normalization:

pi=e−βEiZ,Z=∑ie−βEi,β=1kBT(1)p_i = \frac{e^{-\beta E_i}}{Z}, \qquad Z=\sum_i e^{-\beta E_i}, \qquad \beta=\frac1{k_BT} \qquad (1)

where: pip_i — probability of microstate ii of energy EiE_i; ZZ — canonical partition function (the normalizing sum); β\beta — inverse temperature. The exponential weight makes high-energy states exponentially rare; ZZ ensures ∑ipi=1\sum_i p_i=1. The mean energy is obtained by weighting each energy by its probability, and it collapses to a derivative of ln⁡Z\ln Z:

⟨E⟩=∑iEi pi=1Z∑iEie−βEi=−∂ln⁡Z∂β(2)\langle E\rangle = \sum_i E_i\,p_i = \frac{1}{Z}\sum_i E_i e^{-\beta E_i} = -\frac{\partial\ln Z}{\partial\beta} \qquad (2)

where: ⟨E⟩\langle E\rangle — the internal energy UU; the last equality holds because −∂β-\partial_\beta acting on ln⁡Z\ln Z pulls down a factor of EiE_i inside the sum and divides by ZZ — exactly the ensemble average. The ratio of probabilities of two states depends only on their energy difference — the Boltzmann factor in its purest form:

pipj=e−β(Ei−Ej)(3)\frac{p_i}{p_j} = e^{-\beta(E_i-E_j)} \qquad (3)

where: the reservoir and the normalization ZZ cancel, leaving only the energy gap. This is the most-used single fact in the subject: the relative population of two levels is set by their energy separation measured in units of kBTk_BT. For a system of MM energy levels with degeneracies gng_n, the partition function groups states by energy:

Z=∑ngn e−βEn,⟨E⟩=∑ngnEne−βEn∑ngne−βEn(4)Z = \sum_n g_n\,e^{-\beta E_n},\qquad \langle E\rangle = \frac{\sum_n g_n E_n e^{-\beta E_n}}{\sum_n g_n e^{-\beta E_n}} \qquad (4)

where: gng_n — degeneracy of level nn (number of microstates with energy EnE_n). Summing over levels with their degeneracies is equivalent to summing over microstates — a common bookkeeping simplification.

Derivation AThe Boltzmann distribution from a system coupled to a reservoir

The goal is to derive the canonical probability pi∝e−βEip_i\propto e^{-\beta E_i} from first principles — starting from the microcanonical postulate applied to the combined system-plus-reservoir — and thereby to identify β\beta as the inverse temperature of the reservoir. The strategy is to treat system + reservoir as one isolated (microcanonical) whole with fixed total energy, and ask for the probability that the system sits in a specific microstate ii.

Step 1. Combine the small system SS and a large reservoir RR into an isolated total with fixed energy EtotE_{\text{tot}}. When SS is in a definite microstate ii of energy EiE_i, the reservoir has energy Etot−EiE_{\text{tot}}-E_i and can be in any of ΩR(Etot−Ei)\Omega_R(E_{\text{tot}}-E_i) microstates. Why: by the equal-a-priori postulate, every microstate of the isolated total is equally likely, so the probability of system-state ii is proportional to the number of reservoir states compatible with it.

Step 2. Thus pi∝ΩR(Etot−Ei)p_i \propto \Omega_R(E_{\text{tot}}-E_i). Since Ei≪EtotE_i\ll E_{\text{tot}}, expand the reservoir entropy (not ΩR\Omega_R itself) to first order: ln⁡ΩR(Etot−Ei)=ln⁡ΩR(Etot)−Ei∂ln⁡ΩR∂E∣Etot+⋯\ln\Omega_R(E_{\text{tot}}-E_i) = \ln\Omega_R(E_{\text{tot}}) - E_i\left.\frac{\partial\ln\Omega_R}{\partial E}\right|_{E_{\text{tot}}}+\cdots. Why: the entropy ln⁡ΩR\ln\Omega_R is extensive and smooth, so its Taylor expansion converges rapidly; expanding ΩR\Omega_R directly would fail because ΩR\Omega_R is astronomically steep.

Step 3. Identify the derivative as inverse temperature: ∂ln⁡ΩR∂E=1kB∂SR∂E=1kBT=β\frac{\partial\ln\Omega_R}{\partial E}=\frac{1}{k_B}\frac{\partial S_R}{\partial E}=\frac{1}{k_BT}=\beta. So ln⁡ΩR(Etot−Ei)=const−βEi\ln\Omega_R(E_{\text{tot}}-E_i)=\text{const}-\beta E_i, giving ΩR∝e−βEi\Omega_R\propto e^{-\beta E_i}. Why: the thermodynamic definition of temperature is 1/T=(∂S/∂E)1/T=(\partial S/\partial E), so the linear coefficient in the expansion is exactly β\beta — the reservoir imprints its temperature on the system.

Step 4. Normalize: pi=e−βEi/Zp_i = e^{-\beta E_i}/Z with Z=∑ie−βEiZ=\sum_i e^{-\beta E_i}. The second-order term in the expansion is suppressed by 1/NR→01/N_R\to0, so the exponential is exact for an infinite reservoir. Why: the reservoir's heat capacity is ∝NR\propto N_R, so the curvature correction to the linear expansion vanishes as the reservoir grows — the Boltzmann form is exact in the reservoir limit. *As a consistency check: the two-level ⟨E⟩=ε/(eβε+1)\langle E\rangle=\varepsilon/(e^{\beta\varepsilon}+1) and ⟨E⟩=−∂βln⁡Z\langle E\rangle=-\partial_\beta\ln Z agree symbolically, and ⟨E⟩\langle E\rangle computed from ∑Eipi\sum E_i p_i equals −∂βln⁡Z-\partial_\beta\ln Z for a 3-level system numerically.*

Go deeper · Derivation B · 1 minThe two-level system solved completely — the owned worked result
Derivation BThe two-level system solved completely — the owned worked result

This is the article's owned structural result: the simplest nontrivial canonical system — a single particle (or spin) with two energy levels 00 and ε\varepsilon — solved from end to end, giving the mean energy, its high- and low-temperature limits, and the population ratio, all in closed form. It is the base from which paramagnetism, the Schottky heat-capacity anomaly, and two-state chemical kinetics are built. The goal is to compute ZZ, ⟨E⟩\langle E\rangle, and the level populations exactly. The strategy is direct summation over the two states.

Step 1. Partition function: with levels E0=0E_0=0 and E1=εE_1=\varepsilon, Z=e−β⋅0+e−βε=1+e−βεZ = e^{-\beta\cdot0}+e^{-\beta\varepsilon}=1+e^{-\beta\varepsilon}. Why: only two terms contribute; the ground state carries weight 11 and the excited state the Boltzmann factor e−βεe^{-\beta\varepsilon}.

Step 2. Populations: p0=1/(1+e−βε)p_0 = 1/(1+e^{-\beta\varepsilon}) and p1=e−βε/(1+e−βε)p_1 = e^{-\beta\varepsilon}/(1+e^{-\beta\varepsilon}), so the population ratio is p1/p0=e−βεp_1/p_0 = e^{-\beta\varepsilon} — the excited state is exponentially depleted by the factor e−ε/kBTe^{-\varepsilon/k_BT}. Why: this is Equation (3) applied to the two levels; the ratio depends only on ε/kBT\varepsilon/k_BT, the gap in thermal units.

Step 3. Mean energy: ⟨E⟩=0⋅p0+ε⋅p1=ε e−βε1+e−βε=εeβε+1\langle E\rangle = 0\cdot p_0 + \varepsilon\cdot p_1 = \dfrac{\varepsilon\,e^{-\beta\varepsilon}}{1+e^{-\beta\varepsilon}} = \dfrac{\varepsilon}{e^{\beta\varepsilon}+1}. This equals −∂βln⁡Z-\partial_\beta\ln Z, confirming Equation (2). Why: only the excited state contributes energy ε\varepsilon; dividing top and bottom by e−βεe^{-\beta\varepsilon} gives the tidy Fermi-like form ε/(eβε+1)\varepsilon/(e^{\beta\varepsilon}+1).

Step 4. Limits. High TT (β→0\beta\to0): ⟨E⟩→ε/2\langle E\rangle\to\varepsilon/2 — both levels equally populated, mean energy is the average of 00 and ε\varepsilon. Low TT (β→∞\beta\to\infty): ⟨E⟩→0\langle E\rangle\to0 — the system is frozen in the ground state. Why: at high temperature thermal energy overwhelms the gap and the states equilibrate to equal population; at low temperature the gap dominates and only the ground state survives. *As a consistency check: Z=1+e−βεZ=1+e^{-\beta\varepsilon}, ⟨E⟩=ε/(eβε+1)\langle E\rangle=\varepsilon/(e^{\beta\varepsilon}+1), high-TT limit ε/2\varepsilon/2, low-TT limit 00, and at βε=1\beta\varepsilon=1 the excited population p1=0.2689p_1=0.2689.*

Limiting cases

The canonical description across regimes:

CaseResultMeaning
High temperatureβ→0\beta\to0: all states equally likelyThe Boltzmann factor flattens; the system samples every microstate.
Low temperatureβ→∞\beta\to\infty: only the ground stateOnly the lowest level(s) survive; Z→g0Z\to g_0, the ground degeneracy.
Large systemrelative fluctuations ∼N−1/2\sim N^{-1/2}Energy effectively fixed; canonical ≈ microcanonical (ensemble equivalence).
Two-level system⟨E⟩=ε/(eβε+1)\langle E\rangle = \varepsilon/(e^{\beta\varepsilon}+1)The building block for paramagnetism and the Schottky anomaly.
Degenerate levelsZ=∑ngne−βEnZ=\sum_n g_n e^{-\beta E_n}Weight each energy by its degeneracy gng_n.

Worked examples

1 · A two-level system, populations and energy (a real computation)

Consider NN non-interacting two-level systems, each with a ground state at 00 and an excited state at ε=25 meV\varepsilon = 25\ \mathrm{meV} (about kBTk_BT at room temperature). At T=300 KT=300\ \mathrm{K} (kBT=25.85 meVk_BT=25.85\ \mathrm{meV}), find the fraction of systems in the excited state and the mean energy per system.

Step 1. Enumerate the states and compute βε\beta\varepsilon: with ε=25 meV\varepsilon=25\ \mathrm{meV} and kBT=25.85 meVk_BT=25.85\ \mathrm{meV}, βε=25/25.85=0.967\beta\varepsilon = 25/25.85 = 0.967.

Step 2. Partition function: Z=1+e−0.967=1+0.380=1.380Z = 1 + e^{-0.967} = 1 + 0.380 = 1.380.

Step 3. Excited-state fraction: p1=e−0.967/1.380=0.380/1.380=0.275p_1 = e^{-0.967}/1.380 = 0.380/1.380 = \mathbf{0.275} — about 27.5%27.5\% of the systems are excited. (At exactly βε=1\beta\varepsilon=1 this would be e−1/(1+e−1)=0.269e^{-1}/(1+e^{-1})=0.269.)

Step 4. Mean energy per system: ⟨E⟩=ε p1=25 meV×0.275=6.9 meV\langle E\rangle = \varepsilon\,p_1 = 25\ \mathrm{meV}\times0.275 = \mathbf{6.9\ meV}. The boundary check: at T→∞T\to\infty this would rise to ε/2=12.5\varepsilon/2=12.5 meV (equal populations), and at T→0T\to0 it would fall to 00 — our 6.96.9 meV sits sensibly between, closer to the low-TT end because kBT≈εk_BT\approx\varepsilon.

2 · Reading a temperature off a population ratio (exam level)

A spectroscopic measurement of a gas finds that the population of an excited atomic level lying ε=0.10 eV\varepsilon = 0.10\ \mathrm{eV} above the ground state is 150\tfrac{1}{50} of the ground-state population. Both levels are non-degenerate. What is the temperature?

Step 1. Population ratio from the Boltzmann factor: p1/p0=e−βε=1/50=0.02p_1/p_0 = e^{-\beta\varepsilon} = 1/50 = 0.02.

Step 2. Take logs: −βε=ln⁡(0.02)=−3.912-\beta\varepsilon = \ln(0.02) = -3.912, so βε=3.912\beta\varepsilon = 3.912, meaning the gap is about four kBTk_BT's.

Step 3. Solve for TT: β=3.912/ε\beta = 3.912/\varepsilon, so kBT=ε/3.912=0.10 eV/3.912=0.02557 eVk_BT = \varepsilon/3.912 = 0.10\ \mathrm{eV}/3.912 = 0.02557\ \mathrm{eV}. Converting, T=0.02557 eV/(8.617×10−5 eV/K)=297 KT = 0.02557\ \mathrm{eV}/(8.617\times10^{-5}\ \mathrm{eV/K}) = \mathbf{297\ K}.

Step 4. Sanity check: kBT≈25.6 meVk_BT\approx25.6\ \mathrm{meV} corresponds to T≈297 KT\approx297\ \mathrm{K} — room temperature, and ε≈4kBT\varepsilon\approx4k_BT, consistent with a modest but not tiny population ratio of 1/501/50. This is exactly how astronomers read stellar temperatures from spectral line ratios: the Boltzmann distribution turns a population ratio into a thermometer.

Origins · 1 mincanonical ensemble and how this was discovered
CE
canonical ensemble
statistical-mechanics concept · Gibbs 1902

The canonical ensemble — Gibbs's term, introduced in his 1902 Elementary Principles in Statistical Mechanics — is the collection of infinitely many identical copies of a system, each in contact with a heat reservoir at temperature TT, with microstate probabilities weighted by e−βEe^{-\beta E}. Gibbs called it "canonical" because it is the natural, standard-form distribution (from the Greek kanon, a rule or standard) that maximizes entropy subject to a fixed mean energy. It is the ensemble that matches almost every real experiment, where temperature rather than energy is controlled. Boltzmann had earlier obtained the e−E/kBTe^{-E/k_BT} weighting from his transport and combinatorial arguments; Gibbs gave it the clean ensemble formulation and showed how the partition function ZZ generates all thermodynamics. The canonical ensemble is the conceptual and computational center of equilibrium statistical mechanics — the microcanonical is more fundamental, the grand canonical more general, but the canonical is where almost all calculations actually live.

History
1868
— Boltzmann derives the exponential energy distribution e^{−E/kT} for a system in a heat bath.
1877
— Boltzmann's statistical formulation links entropy to the logarithm of the number of microstates.
1902
— Gibbs's Elementary Principles in Statistical Mechanics defines and names the canonical ensemble.
1912
— Sackur and Tetrode apply canonical/microcanonical methods to compute the absolute entropy of a gas.
1931
— von Neumann formulates the quantum canonical ensemble via the density matrix ρ = e^{−βĤ}/Z.

Going further

References. Pathria & Beale, Statistical Mechanics, 3rd ed., Ch. 3 · Kardar, Statistical Physics of Particles, Ch. 4 · Reif, Fundamentals of Statistical and Thermal Physics, Ch. 6 · Sethna, Statistical Mechanics, Ch. 6 · Landau & Lifshitz, Statistical Physics Part 1, Ch. III · Gibbs, Elementary Principles in Statistical Mechanics (1902). Key results: the two-level Z=1+e−βεZ=1+e^{-\beta\varepsilon}, ⟨E⟩=ε/(eβε+1)\langle E\rangle=\varepsilon/(e^{\beta\varepsilon}+1), with high-/low-TT limits ε/2\varepsilon/2 and 00; the identity ⟨E⟩=∑Eipi=−∂βln⁡Z\langle E\rangle=\sum E_i p_i=-\partial_\beta\ln Z (confirmed on a 3-level system); and the ratio pi/pj=e−β(Ei−Ej)p_i/p_j=e^{-\beta(E_i-E_j)}. Numerical instances: two-level at βε=1\beta\varepsilon=1 gives p1=0.269p_1=0.269; the room-temperature ε=25\varepsilon=25 meV example and the population-ratio thermometer give T≈297T\approx297 K. kB=8.617×10−5 eV/Kk_B=8.617\times10^{-5}\ \mathrm{eV/K} (CODATA).

Builds on: Boltzmann Factor · Derivation of the Canonical Distribution from the Microcanonical Ensemble · The Microcanonical Ensemble and the Postulate of Equal a Priori Probabilities. Leads to: Canonical Partition Function · Helmholtz Free Energy from the Partition Function · Energy Fluctuations in the Canonical Ensemble · Grand Canonical Ensemble.

Why is the canonical ensemble more useful than the microcanonical one if the microcanonical is more fundamental?

Because it matches how experiments and calculations are actually done, and because its mathematics is far friendlier. Almost no real system has a precisely fixed energy — instead it sits in a laboratory at a controlled temperature, exchanging energy freely with its surroundings. That is exactly the canonical setup. Computationally, the microcanonical ensemble requires counting the microstates at exactly one energy, a delta-function constraint that is combinatorially painful; the canonical ensemble replaces it with a smooth exponential weight e−βEe^{-\beta E} and an unconstrained sum Z=∑ie−βEiZ=\sum_i e^{-\beta E_i}, which factorizes for independent degrees of freedom and yields everything by differentiation. And because the energy fluctuations are negligible (∼N−1/2\sim N^{-1/2}) for large systems, the two ensembles agree on all thermodynamics — so you get the same physics with much less pain. The microcanonical is the logical foundation; the canonical is the practical tool.

If the energy fluctuates, in what sense does the system have a definite temperature?

The temperature is a property of the reservoir, and it is imposed on the system by thermal contact — the system does not "have" a temperature independent of the bath, it equilibrates to the bath's temperature. What fluctuates is the system's energy, not its temperature. The distinction is like a small object floating in a huge tank of water at 20∘20^\circC: the object's energy jiggles as molecules exchange energy with the water, but its temperature is simply 20∘20^\circC, fixed by the tank. For a macroscopic system the energy fluctuations are so small (relative width ∼N−1/2\sim N^{-1/2}) that even the energy is effectively definite; for a small system the energy genuinely wanders, but the temperature — set by the bath — remains sharp. Temperature and energy play complementary roles: the canonical ensemble fixes one and lets the other fluctuate, the microcanonical does the reverse.

Why is the microstate probability e^{−βE}, and not something else like e^{−E²} or 1/E?

Because it is forced by the physics of coupling to a large reservoir, plus the equal-a-priori postulate. When the system is in a microstate of energy EE, the reservoir has energy Etot−EE_{\text{tot}}-E and can be in ΩR(Etot−E)\Omega_R(E_{\text{tot}}-E) equally-likely microstates, so the system-state probability is proportional to ΩR(Etot−E)\Omega_R(E_{\text{tot}}-E). Expanding the reservoir's entropy (which is smooth and extensive) to first order in the small energy EE gives ln⁡ΩR≈const−βE\ln\Omega_R \approx \text{const} - \beta E, so ΩR∝e−βE\Omega_R\propto e^{-\beta E} — the exponential. The linear coefficient β\beta is exactly 1/kBT1/k_BT, the reservoir's inverse temperature. No other functional form survives: the exponential is the unique consequence of expanding a large, smooth entropy to leading order. Equivalently, e−βEe^{-\beta E} is the distribution that maximizes entropy for a fixed mean energy — the two viewpoints (reservoir expansion and maximum entropy) give the same answer.

Do I sum over microstates or over energy levels in the partition function?

Either, as long as you are consistent — but the safe default is to sum over microstates. The partition function is Z=∑microstates ie−βEiZ=\sum_{\text{microstates } i} e^{-\beta E_i}. If several distinct microstates share the same energy (a degenerate level), you can group them: Z=∑levels ngne−βEnZ=\sum_{\text{levels } n} g_n e^{-\beta E_n}, where gng_n is the degeneracy (number of microstates at energy EnE_n). Both give the same ZZ. The common mistake is to sum over energy levels while forgetting the degeneracies gng_n — that undercounts and gives wrong thermodynamics. Likewise, the Boltzmann probability pi=e−βEi/Zp_i=e^{-\beta E_i}/Z is the probability of a specific microstate; the probability of finding the system at energy EnE_n is gne−βEn/Zg_n e^{-\beta E_n}/Z, which includes the degeneracy factor. Keeping straight whether you mean a microstate or a level is one of the most common sources of error in canonical calculations.

How does the canonical ensemble connect to the ideal gas law or to real thermodynamics?

Through the partition function and its derivatives, which is the subject of the next few articles. Once you have Z(T,V,N)=∑ie−βEiZ(T,V,N)=\sum_i e^{-\beta E_i}, every thermodynamic quantity follows: the internal energy is U=−∂βln⁡ZU=-\partial_\beta\ln Z, the Helmholtz free energy is F=−kBTln⁡ZF=-k_BT\ln Z, the pressure is p=kBT ∂Vln⁡Zp=k_BT\,\partial_V\ln Z, the entropy is S=−∂TFS=-\partial_T F, and the heat capacity is CV=∂TUC_V=\partial_T U. For the ideal gas, ZZ factorizes into single-particle pieces, the momentum integrals are Gaussian, and out drops pV=NkBTpV=Nk_BT together with the Sackur–Tetrode entropy and U=32NkBTU=\tfrac32 Nk_BT — the entire thermodynamics of the ideal gas from one sum. So the canonical ensemble is not an abstract construction: it is the machine that turns a microscopic energy spectrum into a full thermodynamic description, and the ideal gas law is one of its simplest outputs.

Is the Boltzmann distribution the same as the Maxwell–Boltzmann velocity distribution?

They are closely related but not identical. The Boltzmann distribution pi∝e−βEip_i\propto e^{-\beta E_i} is completely general — it gives the probability of any microstate of any system (spins, oscillators, whatever) in thermal equilibrium. The Maxwell–Boltzmann velocity distribution is the special case you get when you apply the Boltzmann distribution to the kinetic energy of a classical gas particle, E=12mv2E=\tfrac12 m v^2: the probability of a velocity v\mathbf v is ∝e−βmv2/2\propto e^{-\beta m v^2/2}, a Gaussian in each velocity component, which gives the familiar bell-shaped speed distribution. So Maxwell–Boltzmann is the Boltzmann distribution specialized to translational kinetic energy. The general Boltzmann law also governs internal degrees of freedom (rotations, vibrations, electronic levels) and lattice or spin systems, none of which are described by the velocity distribution. Historically Maxwell derived the velocity distribution first (1860), and Boltzmann generalized it to arbitrary energies.

Before this

Where this leads