---
title: Energy Fluctuations and the Equivalence of Ensembles
module: The Canonical Ensemble
moduleNumber: 4
lessonNumber: 3
order: 403
summary: >
  In the canonical ensemble the energy fluctuates, and the second derivative of
  $\ln Z$ gives its variance. The fluctuation–response identity
  $\langle\Delta E^2\rangle = k_BT^2C_V$ ties the spread of the energy to the heat
  capacity, and the relative fluctuation falls as $1/\sqrt{N}$. In the
  thermodynamic limit the canonical energy distribution is a sharp spike, and the
  canonical and microcanonical ensembles predict the same thermodynamics.
topics: [The Canonical Ensemble]
sources:
  - book: Reif
    ref: "Ch. 6 — Basic Methods and Results of Statistical Mechanics; §6.6–6.8"
  - book: Schroeder
    ref: "Ch. 6 — Boltzmann Statistics; §6.3 Average Energy and Fluctuations"
  - book: Kardar (Statistical Physics of Particles)
    ref: "Ch. 4 — Classical Statistical Mechanics; §4.7 The Gibbs Canonical Ensemble"
  - book: Pathria & Beale
    ref: "Ch. 3 — The Canonical Ensemble; §3.6, and Ch. 4 §4.5"
draft: false
---

Fixing the temperature rather than the energy comes at a price: the energy is no
longer sharp. A canonical system exchanges energy with its reservoir, so its
energy fluctuates about the mean $U = \langle E\rangle$ from one instant to the
next. The size of those fluctuations is not a free parameter — it is set by the
same partition function that fixes the mean, through a second derivative of
$\ln Z$. The result ties the spread of the energy to a measurable response, the
heat capacity, and shows that for a macroscopic system the fluctuations are so
small that fixing the temperature is indistinguishable from fixing the energy.
This is the reason the canonical and microcanonical ensembles agree.

## The variance from a second derivative

The mean energy is $U = -\partial\ln Z/\partial\beta$. Differentiating once more
in $\beta$ reaches the variance. Start from $\langle E\rangle = Z^{-1}\sum_i E_i
e^{-\beta E_i}$ and differentiate with respect to $\beta$, remembering that $Z$
itself depends on $\beta$:

$$
\frac{\partial\langle E\rangle}{\partial\beta}
= -\frac{1}{Z}\sum_i E_i^2 e^{-\beta E_i}
+ \frac{1}{Z^2}\Big(\sum_i E_i e^{-\beta E_i}\Big)^2
= -\big(\langle E^2\rangle - \langle E\rangle^2\big).
$$

The right side is minus the variance of the energy. Equivalently, the variance is
the second logarithmic derivative,

$$
\langle\Delta E^2\rangle
\equiv \langle E^2\rangle - \langle E\rangle^2
= \frac{\partial^2\ln Z}{\partial\beta^2}
= -\frac{\partial\langle E\rangle}{\partial\beta}.
$$

The first derivative of $\ln Z$ gives the mean, the second gives the variance;
$\ln Z$ is the cumulant generating function of the energy, with $\beta$ as the
generating variable.[^reif-cumulant] Because the variance is a sum of squares it
is non-negative, which forces $\partial\langle E\rangle/\partial\beta\le 0$: the
mean energy always decreases as $\beta$ increases, that is, as temperature falls.

## The fluctuation–response identity

Convert the $\beta$-derivative to a temperature derivative. With
$\partial/\partial\beta = -k_B T^2\,\partial/\partial T$ and the heat capacity at
constant volume $C_V = (\partial U/\partial T)_V$,

$$
\langle\Delta E^2\rangle
= -\frac{\partial U}{\partial\beta}
= k_B T^2\frac{\partial U}{\partial T}
= k_B T^2 C_V.
$$

> **Theorem (Energy fluctuation–response identity).** The variance of the energy
> in the canonical ensemble is fixed by the heat capacity,
> $$\langle\Delta E^2\rangle = k_B T^2 C_V.$$
> A static equilibrium fluctuation (the spread of the energy) and a
> thermodynamic response (the heat absorbed per degree) are the same quantity.

The identity is the first instance of a general pattern: an equilibrium
fluctuation of a quantity equals the response of that quantity to its conjugate
field. Here the energy fluctuation equals the response of the energy to
temperature. The same structure recurs for particle-number fluctuations and the
compressibility, and for magnetization fluctuations and the susceptibility, in
later modules.[^kardar-fluc] Two consequences follow immediately. First, since
$\langle\Delta E^2\rangle\ge 0$, the heat capacity is non-negative, $C_V\ge 0$: a
stability condition derived here from statistics rather than assumed. Second, a
diverging heat capacity signals diverging energy fluctuations, the hallmark of a
continuous phase transition.

$$
% caption: The energy variance equals $k_BT^2C_V$; a wider canonical energy distribution corresponds to a larger heat capacity, tying the equilibrium spread directly to the thermal response.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(7.2,0) node[right,black]{$E$};
\draw[->,black] (0,0)--(0,3.9) node[above,black]{$P(E)$};
\draw[acc,very thick] plot[domain=0.6:6.4,samples=80] (\x,{3.4*exp(-(\x-2.4)*(\x-2.4)/0.5)});
\draw[black,very thick,dashed] plot[domain=0.6:6.6,samples=80] (\x,{2.1*exp(-(\x-4.2)*(\x-4.2)/2.2)});
\node[acc] at (2.4,3.7) {small $C_V$};
\node[black] at (5.2,2.55) {large $C_V$};
\draw[<->,black] (4.2-1.05,1.0)--(4.2+1.05,1.0) node[midway,below,black!70,font=\scriptsize]{wider spread};
\end{tikzpicture}
$$

## Relative fluctuations and the thermodynamic limit

The absolute variance grows with system size, but the physically relevant
quantity is the fluctuation relative to the mean. For a system of $N$ particles
both $U$ and $C_V$ are extensive, $U\sim N u$ and $C_V\sim N c_v$ with $u$ and
$c_v$ intensive. The relative spread of the energy is therefore

$$
\frac{\sqrt{\langle\Delta E^2\rangle}}{\langle E\rangle}
= \frac{\sqrt{k_B T^2 C_V}}{U}
\sim \frac{\sqrt{N k_B T^2 c_v}}{N u}
= \frac{1}{\sqrt{N}}\,\frac{\sqrt{k_B T^2 c_v}}{u}
\;\propto\; \frac{1}{\sqrt{N}}.
$$

The relative fluctuation shrinks as $1/\sqrt{N}$.[^schroeder-relfluc] For a
macroscopic sample with $N\sim 10^{23}$ it is of order $10^{-12}$: the energy of
a mole of gas at fixed temperature is constant to twelve significant figures. The
distinction between fixing the temperature and fixing the energy is undetectable
at that scale, which is the quantitative statement that the ensembles agree.

$$
% caption: The relative energy fluctuation falls as $1/\sqrt{N}$; a small system has a broad energy distribution, but by macroscopic $N$ the spread is negligible and the energy is effectively sharp.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(7.2,0) node[right,black]{$N$};
\draw[->,black] (0,0)--(0,3.9) node[above,black]{relative spread};
\draw[acc,very thick] plot[domain=0.3:6.8,samples=80] (\x,{3.2/sqrt(6*\x)});
\node[acc] at (4.6,1.7) {falls with $N$};
\draw[black,dashed] (0,0.35)--(6.8,0.35);
\node[black!70,font=\scriptsize] at (5.4,0.66) {negligible at macroscopic $N$};
\end{tikzpicture}
$$

## The sharpness of the energy distribution

The relative-fluctuation estimate can be sharpened into the full shape of the
energy distribution. The probability that the system has energy in a window about
$E$ is the number of microstates there times the Boltzmann factor,

$$
P(E) = \frac{g(E)\,e^{-\beta E}}{Z},
$$

with $g(E)$ the density of states. The two factors pull in opposite directions:
$g(E)$ rises steeply with energy — like $E^{3N/2}$ for an ideal gas — while
$e^{-\beta E}$ falls. Their product is sharply peaked at the energy $E^\ast$ where
the two rates balance, $\partial\ln g/\partial E = \beta$ — the same condition
$1/T = \partial S/\partial E$ that fixes the microcanonical energy.[^reif-peak]

Expanding $\ln P(E)$ about the peak gives a Gaussian,

$$
P(E) \approx P(E^\ast)\exp\!\left[-\frac{(E-E^\ast)^2}{2\langle\Delta E^2\rangle}\right],
$$

of width $\sqrt{\langle\Delta E^2\rangle} = \sqrt{k_B T^2 C_V}\sim\sqrt{N}$. The
peak position $E^\ast = U\sim N$ grows faster than the width, so the fractional
width $\sqrt{N}/N = N^{-1/2}$ vanishes in the thermodynamic limit. The canonical
energy distribution is a spike at $U$ with a relative width of order $N^{-1/2}$.

$$
% caption: The canonical energy distribution is the product of a steeply rising density of states $g(E)$ and a falling Boltzmann factor $e^{-\beta E}$; the two balance at $E^\ast$, giving a sharp peak whose relative width scales as $N^{-1/2}$.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(7.6,0) node[right,black]{$E$};
\draw[->,black] (0,0)--(0,4.2) node[above,black]{weight};
\draw[black,very thick,dashed] plot[domain=0.3:4.6,samples=70] (\x,{0.04*\x*\x*\x});
\node[black] at (5.4,2.65) {density of states};
\draw[black,very thick,densely dotted] plot[domain=0.3:7.2,samples=70] (\x,{3.6*exp(-0.42*\x)});
\node[black] at (1.8,3.15) {Boltzmann factor};
\draw[acc,very thick] plot[domain=1.6:5.6,samples=80] (\x,{3.7*exp(-(\x-3.5)*(\x-3.5)/0.5)});
\node[acc] at (3.5,4.0) {product $P(E)$};
\draw[black,dashed] (3.5,0)--(3.5,3.7);
\node[black!70,font=\scriptsize,below] at (3.5,0) {mean energy $U$};
\end{tikzpicture}
$$

## Equivalence of the canonical and microcanonical ensembles

The two ensembles describe the same physics because the canonical energy
distribution is concentrated at a single energy. In the microcanonical ensemble
the energy is fixed at $E$ and the entropy is $S(E) = k_B\ln g(E)$. In the
canonical ensemble the energy is distributed as $P(E)$, sharply peaked at
$E^\ast = U$; evaluating any thermodynamic quantity as a canonical average is the
same as evaluating it at the single energy $E^\ast$, because the distribution has
negligible weight anywhere else.[^kardar-equiv]

The correspondence can be made precise through the free energy. Writing
$P(E)\propto e^{[S(E)/k_B] - \beta E}$, the peak maximizes $S(E) - E/T$, so the
minimum of $E - TS(E)$ over $E$ is the Helmholtz free energy,

$$
F = \min_E\big[E - TS(E)\big] = U - TS(U).
$$

This is the Legendre transform connecting the microcanonical entropy $S(E)$ to
the canonical free energy $F(T)$. The transform is exact in the thermodynamic
limit precisely because the distribution is sharp: the saddle-point (Laplace)
evaluation of the sum $Z = \sum_E g(E)e^{-\beta E}$ is dominated by $E^\ast$ with
corrections of relative order $N^{-1/2}$.

> **Theorem (Ensemble equivalence).** For a system with short-range interactions
> and a well-defined thermodynamic limit, the canonical and microcanonical
> ensembles yield identical intensive thermodynamic quantities as $N\to\infty$.
> The canonical free energy is the Legendre transform of the microcanonical
> entropy, $F(T) = \min_E[E - TS(E)]$.

$$
% caption: The microcanonical shell fixes the energy at $E$ with entropy $S(E)=k_B\ln g(E)$; the canonical peak at $E^\ast=U$ has relative width $N^{-1/2}$, so the two overlap and the ensembles agree in the thermodynamic limit.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(7.6,0) node[right,black]{$E$};
\draw[->,black] (0,0)--(0,4.0) node[above,black]{$P(E)$};
\draw[acc,very thick] plot[domain=2.3:5.1,samples=80] (\x,{3.6*exp(-(\x-3.7)*(\x-3.7)/0.28)});
\node[acc] at (2.0,2.7) {canonical peak};
\draw[black,very thick] (3.55,0)--(3.55,3.7);
\draw[black,very thick] (3.85,0)--(3.85,3.7);
\node[black,align=center,font=\scriptsize] at (5.8,3.4) {microcanonical\\shell at $E$};
\draw[black,->] (5.0,3.1)--(3.9,2.6);
\draw[black,dashed] (3.7,0)--(3.7,3.6);
\node[black!70,font=\scriptsize,below] at (3.7,0) {mean energy $U$};
\end{tikzpicture}
$$

## Breakdown at phase transitions

The equivalence rests on the energy distribution having a single sharp peak.
Where that fails, the ensembles can disagree. At a first-order phase transition
the density of states develops structure such that $P(E)$ becomes bimodal — two
peaks at the energies of the coexisting phases, separated by a suppressed region.
The canonical ensemble at the transition temperature averages over both peaks,
giving an energy intermediate between the two phases, while the microcanonical
ensemble at an energy between the peaks describes a genuine two-phase mixture with
its own properties. The heat capacity, which measures the width, diverges as the
two peaks merge at a continuous transition. These are the cases where the choice
of ensemble matters, and they are taken up in the phase-transition module; away
from them, and for any system with short-range interactions in the thermodynamic
limit, the canonical and microcanonical descriptions coincide.[^pathria-break]

## Summary

- The energy variance in the canonical ensemble is the second logarithmic
  derivative of the partition function, $\langle\Delta E^2\rangle =
  \partial^2\ln Z/\partial\beta^2 = -\partial U/\partial\beta$; $\ln Z$ generates
  the energy cumulants.
- The **fluctuation–response identity** $\langle\Delta E^2\rangle = k_B T^2 C_V$
  ties the equilibrium energy spread to the heat capacity and forces $C_V\ge 0$.
- The relative fluctuation scales as $1/\sqrt{N}$, of order $10^{-12}$ for a mole,
  so the canonical energy distribution is a Gaussian spike at $U$ with relative
  width $N^{-1/2}$, peaked where $\partial\ln g/\partial E = \beta$.
- Because the peak is sharp, the canonical and microcanonical ensembles give the
  same intensive thermodynamics as $N\to\infty$, related by the Legendre
  transform $F(T) = \min_E[E - TS(E)]$; the equivalence breaks only where $P(E)$
  loses its single sharp peak, at phase transitions.

[^reif-cumulant]: **Reif**, _Fundamentals of Statistical and Thermal Physics_, §6.6 — the mean and dispersion of the energy in the canonical ensemble as first and second derivatives of $\ln Z$.
[^kardar-fluc]: **Kardar**, _Statistical Physics of Particles_, §4.7 — the general fluctuation–response relations of the canonical ensemble, and the identification of energy fluctuations with the heat capacity. MIT OCW 8.333, <https://ocw.mit.edu/courses/8-333-statistical-mechanics-i-statistical-mechanics-of-particles-fall-2013/>.
[^schroeder-relfluc]: **Schroeder**, _An Introduction to Thermal Physics_, §6.3 — the variance of the energy, the identity $\langle\Delta E^2\rangle = k_B T^2 C_V$, and the $1/\sqrt{N}$ scaling of the relative fluctuation. Companion material at <https://physics.weber.edu/schroeder/thermal/>.
[^reif-peak]: **Reif**, _Fundamentals of Statistical and Thermal Physics_, §6.7–6.8 — the sharply peaked energy probability $P(E)\propto g(E)e^{-\beta E}$ and its Gaussian width.
[^kardar-equiv]: **Kardar**, _Statistical Physics of Particles_, §4.7, and **Pathria & Beale**, _Statistical Mechanics_ (4th ed.), §3.6 — the equivalence of the canonical and microcanonical ensembles in the thermodynamic limit and the saddle-point evaluation of the partition function.
[^pathria-break]: **Pathria & Beale**, _Statistical Mechanics_ (4th ed.), §3.6 and Ch. 4 §4.5 — the sharpness of the canonical energy distribution and the circumstances (phase coexistence) under which ensemble equivalence fails.
