Ensembles
In the previous lesson, we saw that entropy counts microstates. But how do we actually compute thermodynamic quantities from microscopic physics? The answer is the ensemble: a collection of mental copies of a system, one for each possible microstate, weighted by probability. By averaging over the ensemble, we extract macroscopic physics from microscopic laws.
Different physical situations call for different ensembles. The choice depends on what the system can exchange with its environment: nothing, energy, or both energy and particles.
The Ensemble Idea
Instead of tracking one system over time, imagine a vast collection of identically prepared systems spanning all possible microstates. Thermodynamic quantities are averages over this ensemble. This approach, invented by Gibbs, is the foundation of modern statistical mechanics.
The Microcanonical Ensemble
What is an ensemble in physics?
An ensemble is not a physical object but a mental tool. Imagine millions of identical copies of your system, each in a different possible microstate. By computing averages over all these copies, we obtain measurable quantities like temperature or pressure. It is like predicting the average outcome of a die by considering all possible faces rather than rolling the die once.
The simplest case: an isolated system with fixed energy $E$, volume $V$, and particle number $N$. No exchange of anything with the outside world.
The fundamental postulate of statistical mechanics states that all microstates with the correct energy are equally probable:
$$P_i = \begin{cases} 1/\Omega(E) & \text{if } E_i = E \\ 0 & \text{otherwise} \end{cases}$$where $\Omega(E)$ is the number of microstates with energy $E$. The entropy is $S = k_B \ln \Omega(E)$, and all thermodynamics follows.
While conceptually simple, the microcanonical ensemble is often difficult to work with in practice because fixing the energy exactly is mathematically awkward. A much more powerful approach is to let the energy fluctuate.
The Canonical Ensemble
Consider a system in thermal contact with a large heat bath at temperature $T$. The system can exchange energy with the bath, but particle number and volume remain fixed. What is the probability of finding the system in microstate $i$ with energy $E_i$?
The Boltzmann Distribution
$$P_i = \frac{1}{Z} e^{-\beta E_i}$$where $\beta = 1/(k_B T)$ is the inverse temperature. States with lower energy are exponentially more probable. The normalization constant $Z$ is the partition function.
The derivation is elegant. If the system has energy $E_i$, the bath has energy $E_{\text{total}} - E_i$. The number of bath microstates is $\Omega_{\text{bath}}(E_{\text{total}} - E_i)$. Since all microstates of the combined system are equally likely:
$$P_i \propto \Omega_{\text{bath}}(E_{\text{total}} - E_i) = e^{S_{\text{bath}}(E_{\text{total}} - E_i)/k_B}$$Expanding the entropy for small $E_i$ compared to the bath energy:
$$S_{\text{bath}}(E_{\text{total}} - E_i) \approx S_{\text{bath}}(E_{\text{total}}) - \frac{\partial S_{\text{bath}}}{\partial E} E_i = \text{const} - \frac{E_i}{T}$$giving $P_i \propto e^{-E_i / k_B T} = e^{-\beta E_i}$.
The Partition Function
What is the partition function?
The partition function $Z$ is a single number that summarizes everything you need to know about a system at equilibrium. It adds up contributions from all possible microstates, giving more weight to lower-energy states. Think of it as a weighted catalog of all possible configurations. Once $Z$ is known, you can derive the average energy, pressure, entropy, and every other thermodynamic quantity from it.
The partition function $Z$ is the most powerful object in statistical mechanics. It is simply the sum of Boltzmann factors over all microstates:
The Partition Function
$$Z = \sum_i e^{-\beta E_i}$$For continuous systems: $Z = \int e^{-\beta H(q,p)} \, \frac{d^{3N}q \, d^{3N}p}{N! h^{3N}}$
Every equilibrium thermodynamic quantity can be derived from $Z$.
Why is $Z$ so powerful? Because derivatives of $\ln Z$ give thermodynamic quantities directly:
Average energy:
$$\langle E \rangle = -\frac{\partial \ln Z}{\partial \beta}$$Energy fluctuations:
$$\langle (\Delta E)^2 \rangle = \frac{\partial^2 \ln Z}{\partial \beta^2} = k_B T^2 C_V$$Entropy:
$$S = k_B \left(\ln Z + \beta \langle E \rangle\right)$$Pressure:
$$P = k_B T \frac{\partial \ln Z}{\partial V}$$Knowing $Z$ means knowing everything about the equilibrium thermodynamics of the system.
Example: The Two-Level System
Consider a single particle with two states: ground state (energy $0$) and excited state (energy $\epsilon$). The partition function is:
$$Z = 1 + e^{-\beta \epsilon}$$The average energy is:
$$\langle E \rangle = \frac{\epsilon \, e^{-\beta\epsilon}}{1 + e^{-\beta\epsilon}} = \frac{\epsilon}{e^{\beta\epsilon} + 1}$$At low temperature ($\beta\epsilon \gg 1$), $\langle E \rangle \to 0$: the particle is frozen in the ground state. At high temperature ($\beta\epsilon \ll 1$), $\langle E \rangle \to \epsilon/2$: both states are equally occupied.
Helmholtz Free Energy
The partition function is directly related to the Helmholtz free energy $F$:
Free Energy and the Partition Function
$$F = -k_B T \ln Z$$The Helmholtz free energy $F = E - TS$ is minimized at equilibrium for systems at constant $T$ and $V$. It plays the role that energy plays for isolated systems.
The relationship $F = -k_B T \ln Z$ is one of the most important equations in physics. It connects the microscopic (the partition function, summing over all microstates) to the macroscopic (free energy, a thermodynamic potential).
From $F$, all thermodynamic quantities follow:
$$S = -\frac{\partial F}{\partial T}\bigg|_V, \quad P = -\frac{\partial F}{\partial V}\bigg|_T, \quad E = F + TS$$The Grand Canonical Ensemble
When the system can exchange both energy and particles with a reservoir, we need the grand canonical ensemble. This is characterized by temperature $T$ and chemical potential $\mu$, which controls the average particle number.
The grand partition function sums over all particle numbers and all microstates for each:
Grand Canonical Ensemble
$$\Xi = \sum_{N=0}^{\infty} \sum_i e^{-\beta(E_i^{(N)} - \mu N)} = \sum_{N=0}^{\infty} e^{\beta\mu N} Z_N$$The probability of microstate $i$ with $N$ particles: $P_{i,N} = \frac{1}{\Xi} e^{-\beta(E_i^{(N)} - \mu N)}$
What is the chemical potential?
The chemical potential $\mu$ measures the "energy cost" of adding one more particle to the system. Just as temperature controls the flow of energy (from hot to cold), the chemical potential controls the flow of particles (from high chemical potential to low). When two systems can exchange particles, equilibrium is reached when their chemical potentials are equal.
The chemical potential $\mu$ controls the average number of particles, just as temperature controls the average energy. The associated thermodynamic potential is the grand potential:
$$\Phi = -k_B T \ln \Xi = F - \mu N = E - TS - \mu N$$For an ideal gas, $\Phi = -PV$, giving the equation of state directly.
Thermodynamic Potentials
Each ensemble naturally produces a different thermodynamic potential. These are related by Legendre transforms:
| Potential | Definition | Natural Variables | Ensemble |
|---|---|---|---|
| Energy $E$ | $E$ | $S, V, N$ | Microcanonical |
| Helmholtz $F$ | $E - TS$ | $T, V, N$ | Canonical |
| Gibbs $G$ | $E - TS + PV$ | $T, P, N$ | Isothermal-isobaric |
| Grand $\Phi$ | $E - TS - \mu N$ | $T, V, \mu$ | Grand canonical |
The Gibbs free energy $G$ is particularly important for chemistry and phase transitions, since laboratory experiments typically fix temperature and pressure. At equilibrium, $G$ is minimized. Chemical reactions proceed in the direction that lowers $G$.
The Equipartition Theorem
A beautiful consequence of the canonical ensemble: each quadratic degree of freedom in the energy contributes $\frac{1}{2}k_B T$ to the average energy.
Equipartition Theorem
If the energy contains a quadratic term $\alpha q_i^2$ (where $q_i$ is a coordinate or momentum), then:
$$\langle \alpha q_i^2 \rangle = \frac{1}{2} k_B T$$Each such degree of freedom contributes $\frac{1}{2}k_B T$ to energy and $\frac{1}{2}k_B$ to heat capacity.
For a monatomic ideal gas, each molecule has 3 translational degrees of freedom ($\frac{1}{2}mv_x^2 + \frac{1}{2}mv_y^2 + \frac{1}{2}mv_z^2$), giving:
$$\langle E \rangle = \frac{3}{2}Nk_B T, \quad C_V = \frac{3}{2}Nk_B$$For a diatomic gas, adding 2 rotational degrees of freedom gives $C_V = \frac{5}{2}Nk_B$. But experiments show that at very low temperatures, rotational modes "freeze out", a quantum effect that equipartition cannot explain. This was one of the early hints that classical statistical mechanics was incomplete.
Equivalence of Ensembles
A remarkable result: in the thermodynamic limit ($N \to \infty$), all ensembles give identical results for thermodynamic quantities. Energy fluctuations in the canonical ensemble are tiny:
$$\frac{\sqrt{\langle (\Delta E)^2 \rangle}}{\langle E \rangle} \sim \frac{1}{\sqrt{N}}$$For $N \sim 10^{23}$, relative fluctuations are $\sim 10^{-12}$: utterly negligible. The system effectively has a well-defined energy even though it can exchange energy with a bath. This is why choosing the most convenient ensemble is always safe for macroscopic systems.
Key Insights
- The microcanonical ensemble describes isolated systems where all microstates of given energy are equally probable
- The canonical ensemble describes systems at fixed temperature, with the Boltzmann distribution $P_i \propto e^{-\beta E_i}$
- The partition function $Z$ encodes all equilibrium thermodynamics via $F = -k_B T \ln Z$
- The grand canonical ensemble handles open systems with variable particle number
- Each ensemble has a natural thermodynamic potential: $E$, $F$, $G$, or $\Phi$
- Equipartition gives $\frac{1}{2}k_B T$ per quadratic degree of freedom (classically)
- All ensembles agree in the thermodynamic limit, fluctuations vanish as $1/\sqrt{N}$
Looking Ahead
The ensembles we've developed are built on classical physics. But at low temperatures or high densities, quantum effects become essential. In the next lesson we'll see how identical quantum particles, bosons and fermions, lead to fundamentally different statistics:
- Bose-Einstein statistics: particles that love to share quantum states
- Fermi-Dirac statistics: particles that obey the exclusion principle
- Dramatic consequences: superfluidity, metals, white dwarfs, and the blackbody spectrum
The partition function framework remains; only the counting of states changes.
- Statistical ensembles (microcanonical, canonical, grand canonical) provide systematic frameworks for computing thermodynamic quantities depending on what the system exchanges with its environment.
- The partition function $Z = \sum_i e^{-\beta E_i}$ encodes all equilibrium thermodynamics of a system, with the Helmholtz free energy given by $F = -k_B T \ln Z$.
- The Boltzmann distribution $P_i \propto e^{-E_i/k_BT}$ assigns exponentially higher probability to lower-energy states, with temperature controlling how steeply the probability falls.
- All ensembles give identical thermodynamic predictions in the thermodynamic limit ($N \to \infty$), because relative energy fluctuations vanish as $1/\sqrt{N}$.