See also: Course-wide Conventions & Notation
Run the code: Notebook for Section 2.1, in which you can change and rerun the Python cells of this section in your browser.
The course map shows where this module sits in the course and which relations connect the microscopic and macroscopic descriptions. Select a module to unfold its sections.

Overview and Learning Objectives¶
Statistical mechanics bridges microscopic states and macroscopic thermodynamics by treating measurable quantities as ensemble averages. This section introduces expected values, defines the common ensembles (microcanonical, canonical, and grand canonical), and states the fundamental postulate for an isolated system.
Learning objectives:
Distinguish an arithmetic average (sample mean) from an ensemble (expected) average .
Define microstates, macrostates, and an ensemble, and identify the constraints defining the microcanonical, canonical, and grand canonical ensembles.
State the fundamental postulate of statistical mechanics for the microcanonical ensemble.
Compute microcanonical probabilities and simple expected values from a discrete distribution.
Core Ideas and Derivations¶
Macroscopic Properties as Expected Values of Microscopic Properties¶
A core principle of statistical mechanics is that macroscopic thermodynamic properties are statistical averages (expected values) of microscopic properties.
Arithmetic Average vs. Expected Value¶
In basic statistics, the arithmetic average (sample mean) of a dataset of values, , is:
In statistical mechanics, we typically work with an expected value, which weights each outcome by its probability. For a discrete random variable that takes values with probabilities , the expected value is
where is the probability of the -th outcome (microstate), and the sum runs over the microstates included in the ensemble.
Table 2.1.1:Statistical Variables and Their Definitions
Symbol | Meaning |
|---|---|
Number of possible microstates (outcomes) | |
Index of a microstate | |
Value of a microscopic property in microstate | |
Expected (ensemble) average of | |
Probability of finding the system in microstate |
In thermodynamics, typical choices of include the internal energy, enthalpy, or other measurable properties. We will compute such quantities by specifying the probabilities appropriate to the ensemble of interest.
Ensembles of Microstates¶
- Microstate
- A complete specification of the microscopic state of a system: the positions and momenta of all particles in classical mechanics, or the quantum state of the system in quantum mechanics.
- Macrostate
- The thermodynamic state of a system, specified by a small number of macroscopic variables such as . Many microstates are usually consistent with one macrostate.
- Ensemble
- The set of microstates consistent with specified macroscopic constraints. An ensemble can be pictured as a very large collection of copies of the system, each in one of these microstates; is then the fraction of copies in microstate .
- Microcanonical ensemble
- Microstates are sampled at fixed .
- Canonical ensemble
- Microstates are sampled at fixed .
- Grand canonical ensemble
- Microstates are sampled at fixed .
Figure 2.1.1 shows the system and its surroundings in each of the three ensembles.
Source
import sys
import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch
sys.path.append("..") # the book folder, which holds figstyle
import figstyle as fs
def draw_ensemble(ax, c, fixed, bath=None, energy=False, matter=False):
"""Sketch of a system in its surroundings for one ensemble, with the exchanges that its boundary allows."""
if bath:
ax.add_patch(FancyBboxPatch((0.05, 0.17), 0.90, 0.72, boxstyle="round,pad=0.03,rounding_size=0.06",
fc=c.fill, ec="none"))
ax.text(0.5, 0.83, bath or "Surroundings", ha="center", va="center", color=c.note)
ax.add_patch(FancyBboxPatch((0.36, 0.34), 0.28, 0.32, boxstyle="round,pad=0.03,rounding_size=0.06",
fc=c.ground, ec=c.ink, lw=1.6))
ax.text(0.5, 0.59, "System", ha="center", va="center")
if energy:
ax.annotate("", xy=(0.09, 0.42), xytext=(0.45, 0.42),
arrowprops=dict(arrowstyle="<|-|>", color=c.vermilion, lw=1.6, mutation_scale=12))
ax.text(0.20, 0.46, "Energy", ha="center", va="bottom", color=c.vermilion)
if matter:
ax.annotate("", xy=(0.55, 0.42), xytext=(0.91, 0.42),
arrowprops=dict(arrowstyle="<|-|>", color=c.blue, lw=1.6, mutation_scale=12))
ax.text(0.80, 0.46, "Matter", ha="center", va="bottom", color=c.blue)
ax.text(0.5, 0.05, fixed, ha="center", va="center")
ax.set(xlim=(0, 1), ylim=(0, 0.95), aspect="equal")
ax.axis("off")
def draw(c):
fig, axes = plt.subplots(1, 3, figsize=(fs.WIDTH, 2.55), constrained_layout=True)
draw_ensemble(axes[0], c, "$N$, $V$, $E$ fixed")
draw_ensemble(axes[1], c, "$N$, $V$, $T$ fixed", bath="Heat bath at $T$", energy=True)
draw_ensemble(axes[2], c, r"$\mu$, $V$, $T$ fixed", bath=r"Reservoir at $T$ and $\mu$", energy=True, matter=True)
for ax, letter, title in zip(axes, "abc", ["Microcanonical", "Canonical", "Grand canonical"]):
fs.panel(ax, letter, title)
return fig
fs.show(draw, alt="Three sketches of a system, drawn as a box. In panel a, the microcanonical ensemble, nothing crosses "
"the boundary, and N, V, and E are fixed. In panel b, the canonical ensemble, the system sits in a "
"heat bath at temperature T, a two-headed arrow labeled energy crosses the boundary, and N, V, and T "
"are fixed. In panel c, the grand canonical ensemble, the system sits in a reservoir at temperature "
"T and chemical potential mu, two-headed arrows labeled energy and matter cross the boundary, "
"and mu, V, and T are fixed.")Figure 2.1.1:The three ensembles. (a) Microcanonical ensemble: an isolated system, with , , and fixed. (b) Canonical ensemble: a closed system that exchanges energy with a heat bath at temperature , with , , and fixed. (c) Grand canonical ensemble: an open system that exchanges energy and matter with a reservoir at temperature and chemical potential , with , , and fixed.
Probability of a Microstate in the Microcanonical Ensemble¶
For an isolated system—one that exchanges neither energy nor matter with its surroundings—the appropriate statistical description is the microcanonical ensemble (panel (a) of Figure 2.1.1).
Fundamental Postulate of Statistical Mechanics¶
Therefore, the probability of finding the system in the -th microstate is
where is the total number of accessible microstates compatible with .
Worked Example¶
Expected value vs. arithmetic mean (die rolls)¶
A fair die is rolled times. Let if the -th outcome is a six and otherwise.
One roll
Linearity of expectation
The expected total number of sixes is the sum of the individual expected values:
Arithmetic means from simulated rolls
In five simulated sets of 300 rolls, the number of sixes was 56, 42, 49, 43, and 41. The arithmetic mean of in each set, , was therefore 0.187, 0.140, 0.163, 0.143, and 0.137, compared with .
Result. The expected number of sixes in 300 rolls is 50; the five simulated sets gave between 41 and 56.
Concept Checks¶
In what sense is “temperature” absent from the microcanonical ensemble description?
Why is the expected value more informative than the arithmetic mean of a single dataset when predicting thermodynamic properties?
What physical meaning does “accessible microstate” carry in the fundamental postulate?
How would you modify the probability assignment if only a subset of the nominal microstates were accessible?
Key Takeaways¶
Macroscopic properties are computed as expected values over microstates.
An ensemble is the set of microstates consistent with specified macroscopic constraints, together with their probabilities .
In the microcanonical ensemble, each accessible microstate has equal probability: .
Choosing the right ensemble is choosing the right constraints: , , or .