Statistical mechanics – from atoms to thermodynamics

A litre of air contains about $2.5\cdot10^{22}$ molecules. No one can follow them individually – but there is no need to. Statistical mechanics shows that pressure, temperature and entropy are averages and probabilities for unimaginably many particles, and that the laws of thermodynamics follow from the mechanics of atoms plus probability theory. It was created by Maxwell, Boltzmann and Gibbs at a time when many physicists did not believe in atoms. This page covers the basic ideas with two interactive figures.

Maxwell’s speed distribution

As early as 1738 Daniel Bernoulli explained the pressure of gases by molecules striking the walls of the container (see Bernoulli). Rudolf Clausius revived the idea in 1857 and introduced the concept of the mean free path. But it was James Clerk Maxwell who in 1860 took the decisive step: the molecules do not all have the same speed, but a distribution of speeds. From simple symmetry arguments he found

$$f(v) = 4\pi\left(\frac{m}{2\pi k_BT}\right)^{3/2} v^2\,e^{-mv^2/2k_BT}$$

The most probable speed is $v_p = \sqrt{2k_BT/m}$, the mean speed $\langle v\rangle = \sqrt{8k_BT/\pi m}$ and the root-mean-square speed $v_{\text{rms}} = \sqrt{3k_BT/m}$. The last shows directly that temperature is a measure of the average kinetic energy: $\tfrac12 m\langle v^2\rangle = \tfrac32k_BT$. The distribution was measured directly by Otto Stern in 1920 and precisely by Miller and Kusch in 1955 with rotating discs that let through only molecules with a particular speed.

Try it: Compare helium and xenon at the same temperature: they have the same average kinetic energy, but helium moves five times faster. The dashed line is the escape velocity from Earth divided by 6 – a rule of thumb for when a planet will lose a gas over billions of years from the top of the atmosphere (around 1000 K). That is why the Earth has almost no free helium or hydrogen.

From chaos to the Maxwell distribution (3D)

Try it: 300 hard spheres in a box collide elastically; the colour shows the speed (blue slow, red fast). However you start – all with the same speed, or a hot and a cold half – the histogram ends up on the Maxwell distribution (blue curve) for the same total energy. This is Boltzmann’s H-theorem in action: no force drives the gas towards equilibrium, it is simply by far the most probable state. With a hot and a cold half you also see heat conduction: the mixing happens by itself, but never the other way round.

Boltzmann’s entropy

In 1872, with his H-theorem, Ludwig Boltzmann showed how a gas of colliding molecules evolves towards Maxwell’s distribution. But Josef Loschmidt objected that the motions of the molecules can be reversed – so how can they give a direction of time? Boltzmann’s answer in 1877 was that the growth of entropy is statistical: there are far more disordered than ordered microstates, so a system goes almost certainly towards the most probable macrostates. He gave entropy the form

$$S = k_B\ln W$$

where $W$ is the number of microstates corresponding to the macrostate. The formula – which Planck later wrote in this form – is engraved on Boltzmann’s tombstone in Vienna. Boltzmann fought against sceptics such as Ernst Mach and Wilhelm Ostwald, who held that atoms were mere hypotheses. Tormented by depression, he took his own life at Duino in 1906 – two years before Jean Perrin’s measurements of Brownian motion convinced almost everyone that atoms exist. See also The arrow of time and Entropy.

A small example: distribute 100 molecules between the two halves of a box. There are $\binom{100}{50} \approx 10^{29}$ ways of having 50 in each half, but only one way of having all of them in one half. With $10^{23}$ molecules the difference is so astronomical that a spontaneous gathering in one half will never be observed.

Gibbs’ ensembles

In 1902 Josiah Willard Gibbs of Yale gave the subject its modern form in Elementary Principles in Statistical Mechanics. Instead of following one system in time, he considered an ensemble – an imagined collection of copies of the system, distributed over all possible microstates:

Microcanonical

Isolated system with fixed energy $E$. All accessible microstates are equally probable. The entropy is $S = k_B\ln W(E)$.

Canonical

System in contact with a heat bath at temperature $T$. The probability of a state with energy $E_i$ is the Boltzmann factor $p_i \propto e^{-E_i/k_BT}$.

Grand canonical

System that can also exchange particles with its surroundings. Determined by $T$ and the chemical potential $\mu$.

For large systems the three ensembles give the same thermodynamic results, because the fluctuations become vanishingly small – but one chooses the one that is easiest to calculate with.

The partition function

In the canonical ensemble everything is contained in the partition function

$$Z = \sum_i e^{-E_i/k_BT},\qquad F = -k_BT\ln Z,\qquad \langle E\rangle = k_BT^2\frac{\partial\ln Z}{\partial T},\qquad S = -\frac{\partial F}{\partial T}$$

If the energy levels of the system are known, $Z$ can be calculated, and all thermodynamic quantities follow by differentiation. For a system with only two levels (e.g. a spin in a magnetic field) separated by $\varepsilon$, this gives a heat capacity with a characteristic maximum at $k_BT \approx 0.42\,\varepsilon$ – the Schottky anomaly. For a harmonic oscillator it gives Planck’s and Einstein’s formula for the mean energy (see Solid state physics).

Equipartition – and its breakdown

Classical statistical mechanics says that each quadratic degree of freedom in the energy has the mean energy $\tfrac12k_BT$. A monatomic gas has three (translation), a diatomic molecule five (three translation, two rotation) and at high temperatures seven (plus vibration). This explains why $C_V$ is $\tfrac32R$ for helium and $\tfrac52R$ for air at room temperature.

But why do the vibrations not contribute at room temperature? And why do the electrons in a metal hardly contribute? In 1900 Lord Kelvin spoke of “two clouds” over physics; one of them was precisely the failure of equipartition. The other was the Michelson–Morley experiment. The first led to quantum mechanics, the second to relativity. When energy is quantised, a degree of freedom “freezes out” once $k_BT$ is smaller than the spacing between the levels.

Quantum statistics

Identical quantum particles cannot be told apart. That changes the counting of states fundamentally. In 1924 Satyendra Nath Bose sent Einstein a new derivation of Planck’s radiation law based on this idea, and Einstein extended it to atoms. In 1926 Enrico Fermi and Paul Dirac found the corresponding statistics for particles obeying Pauli’s exclusion principle:

$$\langle n_i\rangle_{\text{BE}} = \frac{1}{e^{(E_i-\mu)/k_BT} - 1},\qquad \langle n_i\rangle_{\text{FD}} = \frac{1}{e^{(E_i-\mu)/k_BT} + 1}$$

Bose–Einstein statistics predicts that at low temperatures bosons collect in the lowest state – Bose–Einstein condensation, observed in 1995. Fermi–Dirac statistics explains the electrons in metals, white dwarfs and neutron stars. At high temperatures and low densities both go over into Maxwell–Boltzmann statistics. See Superconductivity and superfluidity, Fermi and Chandrasekhar.

Fluctuations and Brownian motion

In 1827 the botanist Robert Brown saw pollen grains in water dancing irregularly under the microscope. In 1905 Einstein showed that the motion is caused by impacts from water molecules, and that the displacement grows with the square root of time:

$$\langle x^2\rangle = 2Dt,\qquad D = \frac{k_BT}{6\pi\eta r}$$

By measuring $D$ one could determine Boltzmann’s constant – and hence Avogadro’s number. Jean Perrin did so in 1908 with an accuracy that convinced even Ostwald. Perrin received the Nobel Prize in 1926. Einstein’s relation is the first example of the fluctuation–dissipation theorem: the same molecular impacts that make the particle jitter also give the friction that slows it down.

In general the relative fluctuations in a system of $N$ particles are of order $1/\sqrt N$. For $N = 10^{22}$ that is $10^{-11}$ – which is why thermodynamics is so precise.

The Ising model and phase transitions

How can abrupt phase transitions arise from smooth Boltzmann factors? In 1920 Wilhelm Lenz gave his student Ernst Ising a simple model of a magnet: spins on a lattice that can only point up ($s = +1$) or down ($s = -1$), and that prefer to point the same way as their neighbours:

$$E = -J\sum_{\langle ij\rangle} s_is_j - h\sum_i s_i$$

Ising solved the one-dimensional model in 1925 and found no phase transition. He wrongly concluded that the model does not work in more dimensions either. Rudolf Peierls showed in 1936 that the two-dimensional model does have a transition, and in 1944 Lars Onsager found the exact solution – one of the most famous calculations in theoretical physics. The critical temperature is

$$k_BT_c = \frac{2J}{\ln\left(1+\sqrt2\right)} \approx 2.269\,J$$

Below $T_c$ the spins order themselves in large domains with a net magnetisation; above $T_c$ they are disordered. Close to $T_c$ there are regions of all sizes, and many quantities follow power laws whose exponents are the same for very different systems – universality. Kenneth Wilson explained this with the renormalisation group and received the Nobel Prize in 1982.

Try it: The simulation uses the Metropolis algorithm (1953) on a lattice of 120 × 120 spins. Start at high temperature and cool slowly: below $T_c \approx 2.27$ the domains grow, and the magnetisation (graph on the right) tends to ±1. Right at $T_c$ you see domains of all sizes. Switch on a small external field and see how it picks the direction.

Information and Maxwell’s demon

In 1867 Maxwell imagined a tiny being that opens and closes a trapdoor between two containers and lets fast molecules through only one way. Then one chamber would become hot and the other cold without any work being done – in violation of the second law. In 1929 Leó Szilárd showed that the demon must measure and remember the speeds of the molecules, and that the information has an entropy cost. In 1948 Claude Shannon defined information entropy with the same form as Gibbs’ entropy. In 1961 Rolf Landauer showed that it is the erasure of information that costs: at least $k_BT\ln 2$ per bit. This was confirmed experimentally in 2012. See Schrödinger’s cat – an information paradigm and The machine that learns.

$$S = -k_B\sum_i p_i\ln p_i,\qquad E_{\text{erase}} \ge k_BT\ln 2$$

Further reading