Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Introduction to Statistical Physics

Updated: 26 May 2026

In this part we introduce the foundations of Statistical Physics. We begin with a simple but deep question: how can the behaviour of a gas, a magnet, or a liquid — each made of an astronomically large number of atoms — be understood from the microscopic rules governing each individual particle?

The central idea is that we do not need to track every atom. Instead, we use probability and statistics to extract the macroscopic behaviour that emerges when enormously many particles interact together. The key concepts developed here are the microstate, the macrostate, the fundamental postulate of equal probabilities, and the celebrated Boltzmann entropy S=kBlnΩS = k_B \ln \Omega.

From these foundations, the familiar quantities of thermodynamics — temperature, pressure, energy, and entropy — are given deep microscopic meaning for the first time. Special attention is given to the classical ideal gas as the paradigmatic application, which lets us derive the ideal gas law and the equipartition theorem from scratch.

This part aims to build physical intuition first, introducing mathematical tools only when they genuinely illuminate the physics, and preparing the reader for the study of the canonical and grand-canonical ensembles.

Introduction to Statistical Physics

Imagine you have a bottle of air sitting on your desk. Inside that bottle are roughly 1022 molecules — nitrogen, oxygen, a little argon — all flying around, bouncing off each other and off the walls, changing direction billions of times per second. If you tried to write down the position and velocity of every single molecule and track how each one evolves according to Newton’s laws, you would need more computer memory than exists on Earth, and more time than the age of the universe.

And yet, with just three numbers — temperature, pressure, and volume — you can describe that bottle of air with extraordinary precision. How is that possible?

The answer is statistical physics: the art of extracting exact macroscopic predictions from microscopic chaos, not despite the enormous number of particles, but because of it. When 1022 particles are involved, statistical fluctuations become negligibly small, and average behaviour becomes essentially certain. This is the deep reason thermodynamics works so well.

This chapter introduces the ideas, vocabulary, and first results of statistical physics. We will:

  1. Understand the difference between microstates and macrostates.

  2. State and explore the fundamental postulate of statistical mechanics.

  3. Introduce phase space as the arena where statistical mechanics lives.

  4. Define the Boltzmann entropy and understand what it really means.

  5. Derive temperature, pressure, and the first law from statistics alone.

  6. Apply everything to the classical ideal gas.

  7. Resolve the Gibbs paradox and understand why particles must be treated as indistinguishable.

Microstates and Macrostates

The Gap Between Micro and Macro

The most fundamental distinction in statistical physics is the difference between a microstate and a macrostate.

A microstate is the complete, precise description of a system at the atomic level — the exact position and velocity of every single particle, at every instant. For a gas of NN particles in three dimensions, this is a list of 6N6N numbers: three position coordinates and three momentum components per particle. The microstate changes billions of times per second as particles collide and move.

A macrostate is what we actually measure in the lab — quantities like temperature TT, pressure PP, volume VV, and total energy EE. A macrostate is specified by just a handful of numbers, regardless of whether the system contains 10 or 1023 particles.

A Warm-Up: Coins and Counting

Before diving into atoms and gases, let us build intuition with the simplest possible example: flipping coins.

Imagine you flip N=4N = 4 coins. Each coin can be Heads (H) or Tails (T). The microstate is the full outcome of every coin — something like HHTH. There are 24=162^4 = 16 equally probable microstates in total.

Now suppose you only care about the total number of heads — this is the macrostate. There are only 5 possible macrostates: 0, 1, 2, 3, or 4 heads.

How many microstates correspond to each macrostate?

Macrostate (# heads)Number of microstatesExample microstates
01TTTT
14HTTT, THTT, TTHT, TTTH
26HHTT, HTHT, HTTH, THHT, THTH, TTHH
34HHHT, HHTH, HTHH, THHH
41HHHH

The macrostate with 2 heads is 6 times more likely than the macrostate with 0 heads, simply because it has 6 times as many corresponding microstates. If we observed the system at a random moment, we would almost certainly find it in the most probable macrostate.

Now scale this up: for N=100N = 100 coins, the number of microstates for 50 heads is roughly 1029, while 100 heads has just 1. For N=1023N = 10^{23} coins (the scale of real physics), the most probable macrostate is so overwhelmingly more likely than any other that it is, for all practical purposes, the only macrostate we ever observe. This is why thermodynamics is so precise.

The Fundamental Postulate

All Microstates Are Equally Likely

The entire edifice of statistical mechanics rests on one foundational assumption:

This might seem like a very bold claim. Why should we believe it? There are several reasons:

It is the most unbiased assumption. If we have no information that distinguishes one microstate from another, it is logically most honest to assign them equal probability. Any other choice would require us to explain why some microstates are preferred.

It is consistent with the equations of motion. Liouville’s theorem in classical mechanics — and its quantum analogue — shows that the density of phase-space trajectories is conserved as the system evolves. A uniform distribution over accessible microstates is therefore a stationary (time-independent) distribution, consistent with equilibrium.

It works. Every prediction derived from this postulate agrees with experiment to extraordinary precision. That is ultimately its strongest justification.

Why Systems Settle in the Most Probable Macrostate

Given the fundamental postulate, why do we always observe the most probable macrostate?

The answer is pure arithmetic. In a system of 1023 particles, the most probable macrostate has so many more corresponding microstates than any other macrostate that the probability of ever observing a different macrostate is not just small — it is essentially zero.

To put it concretely: if you released a gas into one half of a box, the probability that all molecules spontaneously return to the left half is 210232^{-10^{23}} — a number so tiny that even if you waited for a trillion times the age of the universe, it would almost certainly never happen.

This is the statistical origin of the second law of thermodynamics: systems evolve towards states of higher probability (higher entropy) and never spontaneously return to states of lower probability.

Phase Space: The Arena of Statistical Mechanics

What is Phase Space?

To count microstates for a continuous system (like a gas of real atoms), we need a mathematical arena. That arena is phase space.

For a single particle moving in three dimensions, we need 6 numbers to specify its state completely: three position coordinates (x,y,z)(x, y, z) and three momentum components (px,py,pz)(p_x, p_y, p_z). Together, these define a single point in a 6-dimensional space — the phase space of one particle.

For a system of NN particles, the phase space is 6N6N-dimensional. A single point in this high-dimensional space specifies the complete microstate of the entire system — where every particle is and how fast it is moving.

The Energy Surface and the Energy Shell

For an isolated system with fixed total energy EE, all accessible microstates must satisfy:

H(q,p)=EH(\mathbf{q}, \mathbf{p}) = E

where HH is the Hamiltonian (total energy function). This condition defines a surface in phase space — the energy surface — and the system’s trajectory is forever confined to it.

In practice, we always allow a tiny energy uncertainty Δ\Delta (much smaller than EE), so we work with a thin shell between energies EE and E+ΔE + \Delta rather than an infinitely thin surface. The volume of this energy shell is the key quantity we need:

Γ(E,V,N)=volume of phase space with E<H(q,p)<E+Δ\Gamma(E, V, N) = \text{volume of phase space with } E < H(\mathbf{q},\mathbf{p}) < E + \Delta

This volume Γ\Gamma counts (in a precise sense) how many microstates the system has access to. The larger Γ\Gamma, the more microstates are accessible, and — as we will see — the larger the entropy.

One Particle in 1D
One Particle in 3D
N Particles in 3D

For a single particle of mass mm moving in one dimension with energy EE, the Hamiltonian is H=p2/2mH = p^2/2m. The “energy surface” is just two points: p=±2mEp = \pm\sqrt{2mE}. The energy shell has width Δp=mΔE/2mE\Delta p = m\Delta E / \sqrt{2mE} at each point.

Entropy: Counting Disorder

The Boltzmann Definition

We have seen that some macrostates are more probable than others simply because they correspond to more microstates. Boltzmann had the brilliant idea of capturing this in a single number. In 1877, he proposed:

S=kBlnΩ\boxed{S = k_B \ln \Omega}

where:

This formula is engraved on Boltzmann’s tombstone in Vienna. It is one of the most important equations in all of physics.

Why the Logarithm?

The logarithm in S=kBlnΩS = k_B \ln \Omega is not arbitrary. It is chosen for a crucial physical reason: entropy must be additive.

If you have two independent systems A and B, their combined entropy should be SA+B=SA+SBS_{A+B} = S_A + S_B (total entropy is the sum of parts). But the total number of microstates for two independent systems is the product: ΩA+B=ΩA×ΩB\Omega_{A+B} = \Omega_A \times \Omega_B.

The logarithm converts this product into a sum:

SA+B=kBln(ΩA×ΩB)=kBlnΩA+kBlnΩB=SA+SB  S_{A+B} = k_B \ln(\Omega_A \times \Omega_B) = k_B \ln \Omega_A + k_B \ln \Omega_B = S_A + S_B \;\checkmark

Any other function of Ω\Omega would fail this requirement.

Entropy in Everyday Terms

Let us build some intuition with a few everyday examples before turning to physics.

A Messy Room
Ink in Water
A Gas Expanding
A Perfect Crystal at 0 K

A tidy room has a very small number of arrangements (everything in exactly the right place). A messy room has an enormous number of arrangements (socks could be on the floor, the desk, the chair...). Entropy is higher for the messy room. The second law says the room will spontaneously become messier over time, never spontaneously tidier — exactly as anyone who has lived in student accommodation can confirm.

Temperature: What Does It Really Mean?

Heat Flow Between Two Systems

We now ask: if two systems are placed in thermal contact and allowed to exchange energy, what determines how they share that energy at equilibrium?

Consider two systems, 1 and 2, with energies E1E_1 and E2E_2 and entropies S1S_1 and S2S_2. Their total energy is fixed: E1+E2=E=constE_1 + E_2 = E = \text{const}. Energy can flow back and forth, but the total is conserved.

The combined system will settle into the most probable state, which means the state with the maximum total number of microstates, i.e., the state that maximises the total entropy S1+S2S_1 + S_2.

When we work out the mathematics of this maximisation, we find that at equilibrium:

(S1E1)V,N=(S2E2)V,N\left(\frac{\partial S_1}{\partial E_1}\right)_{V,N} = \left(\frac{\partial S_2}{\partial E_2}\right)_{V,N}

In other words, equilibrium requires that both systems have the same rate of change of entropy with energy. This common value is what we define as the inverse temperature:

1T(SE)V,N\boxed{\frac{1}{T} \equiv \left(\frac{\partial S}{\partial E}\right)_{V,N}}

The Physical Meaning of Temperature

This definition might look abstract, but it has a beautifully simple physical interpretation.

S/E\partial S / \partial E measures how rapidly the number of accessible microstates increases when you add a little energy to the system. Think of it as the system’s appetite for energy:

Heat flows from high TT to low $T because it increases the total entropy:**

When a hot system (small S/E\partial S/\partial E) transfers energy to a cold system (large S/E\partial S/\partial E), the cold system gains more entropy than the hot system loses. The total entropy increases. This process is spontaneous. The reverse — heat flowing from cold to hot — would decrease total entropy and never happens spontaneously.

The Zeroth Law of Thermodynamics

The definition of temperature as the quantity equalised at thermal equilibrium immediately implies the zeroth law of thermodynamics:

Pressure, Chemical Potential, and the First Law

Where Does Pressure Come From?

Just as temperature was defined by asking what is equalised when two systems can exchange energy, we can define pressure by asking what is equalised when two systems can exchange volume.

Imagine two chambers separated by a movable, thermally insulating piston. The total volume V1+V2=VV_1 + V_2 = V is fixed, but the piston can slide, exchanging volume between the two sides. The system maximises total entropy, which gives the equilibrium condition:

(S1V1)E,N=(S2V2)E,N\left(\frac{\partial S_1}{\partial V_1}\right)_{E,N} = \left(\frac{\partial S_2}{\partial V_2}\right)_{E,N}

The common value of this derivative defines pressure through P/T=(S/V)E,NP/T = (\partial S/\partial V)_{E,N}. Microscopically, pressure arises because moving the wall gives the particles more space to occupy — more accessible microstates — and the system pushes in the direction that increases its entropy.

Chemical Potential

Similarly, if two systems can exchange particles, the equilibrium condition involves the chemical potential μ\mu, defined through:

μT(SN)E,V-\frac{\mu}{T} \equiv \left(\frac{\partial S}{\partial N}\right)_{E,V}

Particles flow from regions of high chemical potential to low chemical potential, just as heat flows from high temperature to low temperature.

The First Law of Thermodynamics

Putting together the definitions of temperature, pressure, and chemical potential, we can write a single equation that expresses how the internal energy UU changes when the macroscopic state of the system changes:

dU=TdSPdV+μdN\boxed{dU = T\,dS - P\,dV + \mu\,dN}

This is the first law of thermodynamics — the conservation of energy — but written in a form that makes explicit the three ways energy can change:

Heat: $T\,dS$
Work: $-P\,dV$
Particles: $\mu\,dN$

Adding heat dQ=TdSdQ = T\,dS to the system increases its internal energy by increasing the entropy (increasing the number of accessible microstates). This is energy transferred randomly at the microscopic level.

The Second Law: Entropy Always Increases

The Statement

The second law of thermodynamics is one of the most profound statements in all of science:

From the statistical viewpoint, this is not mysterious at all. An isolated system evolves randomly through its accessible microstates. There are enormously many more microstates corresponding to the high-entropy macrostate than to any low-entropy macrostate. So the system almost always moves towards higher entropy — not because of any driving force, but simply because of the overwhelming weight of numbers.

The Arrow of Time

The second law gives time its direction. The microscopic laws of physics (Newton’s laws, quantum mechanics) are perfectly symmetric in time — if you filmed a single particle bouncing, you could not tell if the film was playing forwards or backwards. But if you filmed a gas expanding into a vacuum and played it backwards, the absurdity would be immediately obvious.

This asymmetry is entirely statistical. The expanding gas visits ever more probable macrostates. The reversed film would show a journey towards an astronomically improbable macrostate — possible in principle, but never observed in practice.

Free Expansion as an Example

A gas occupies the left half of a box. The right half is empty (vacuum). The partition is suddenly removed.

The entropy increase is:

ΔS=NkBln2\Delta S = Nk_B \ln 2

For one mole of gas, this is about 5.8 J/K — a macroscopically measurable entropy increase. The gas never spontaneously contracts back to the left half.

The Classical Ideal Gas

Now we apply the full statistical mechanics framework to the most important example: the classical ideal gas. This is a gas of NN identical, non-interacting particles in a box of volume VV, with total energy EE.

“Non-interacting” means the particles do not push or pull on each other — they only feel the walls of the box. This is an excellent approximation for low-density gases at high temperature (like ordinary air at room conditions).

Counting Microstates

For the ideal gas, the total energy is just the sum of kinetic energies of all particles:

E=i=1Npi22mE = \sum_{i=1}^{N} \frac{\mathbf{p}_i^2}{2m}

where pi\mathbf{p}_i is the momentum of particle ii and mm is its mass.

The constraint H=EH = E defines a hypersphere in the 3N3N-dimensional momentum space with radius R=2mER = \sqrt{2mE}. Multiplying by the position space volume VNV^N (each of the NN particles can be anywhere in the box), the total accessible phase-space volume is:

Φ(E,V,N)=VN×(volume of a 3N-dimensional sphere of radius 2mE)\Phi(E, V, N) = V^N \times \left(\text{volume of a }3N\text{-dimensional sphere of radius }\sqrt{2mE}\right)

The volume of a hypersphere in nn dimensions with radius RR is πn/2Γ(n/2+1)Rn\frac{\pi^{n/2}}{\Gamma(n/2+1)} R^n, giving:

Φ(E,V,N)=VNπ3N/2Γ ⁣(3N2+1)(2mE)3N/2\Phi(E, V, N) = V^N \cdot \frac{\pi^{3N/2}}{\Gamma\!\left(\frac{3N}{2}+1\right)} \cdot (2mE)^{3N/2}

The Sackur-Tetrode Equation

Taking the logarithm and using the correct normalisation Γ0=h3NN!\Gamma_0 = h^{3N} N! (more on the N!N! shortly), the entropy of the ideal gas works out to be:

S(E,V,N)=NkB[ln ⁣(VN(4πmE3Nh2)3/2)+52]\boxed{S(E, V, N) = Nk_B \left[\,\ln\!\left(\frac{V}{N}\left(\frac{4\pi m E}{3Nh^2}\right)^{3/2}\right) + \frac{5}{2}\right]}

This is the Sackur-Tetrode equation (1912), independently derived by Hugo Sackur and Otto Tetrode. It is the complete entropy of a monatomic classical ideal gas.

From this single equation, all thermodynamic properties of the ideal gas follow by differentiation.

Everything Follows from Entropy

Temperature
Pressure
Heat Capacity
Speed of Sound

Differentiating SS with respect to EE at fixed VV and NN:

1T=SEV,N    U=E=32NkBT\frac{1}{T} = \frac{\partial S}{\partial E}\bigg|_{V,N} \implies \boxed{U = E = \frac{3}{2}Nk_BT}

Each particle contributes 32kBT\frac{3}{2}k_BT to the total energy — 12kBT\frac{1}{2}k_BT for each of its three translational degrees of freedom. This is the equipartition theorem.

The Gibbs Paradox and Indistinguishability

A Surprising Puzzle

Here is a thought experiment that reveals something deep about the nature of identical particles.

Take a box divided by a partition. On the left: N/2N/2 molecules of gas A at temperature TT and pressure PP. On the right: N/2N/2 molecules of gas B, also at temperature TT and pressure PP. Now remove the partition.

If A and B are different gases (say, nitrogen and oxygen), the gases mix, and the entropy increases. This is the entropy of mixing — a real, measurable effect. You can verify it by noting that you now need to do work to separate them again.

But what if A and B are the same gas — say, nitrogen on both sides? When you remove the partition, nothing observable happens. The gas on both sides was already at the same temperature, pressure, and density. The system is in equilibrium both before and after.

The entropy should not change. And yet if you naively count microstates by treating the molecules as distinguishable labelled particles (as classical mechanics suggests), you find a spurious entropy increase of ΔS=NkBln2>0\Delta S = Nk_B \ln 2 > 0 — as if mixing two identical gases were somehow different from having one big container of gas. This is the Gibbs paradox, noticed by Josiah Willard Gibbs in 1875.

The Resolution: Particles Are Indistinguishable

The resolution is both simple and profound: identical particles are not distinguishable.

In quantum mechanics, two electrons, two nitrogen molecules, or any two identical particles are not merely similar — they are in principle completely indistinguishable. There is no experiment, even in principle, that can tell “molecule number 347” from “molecule number 8,193” if both are nitrogen molecules in the same quantum state.

This means that if you swap two identical particles, you have not created a new microstate — you have the same microstate. To correctly count microstates, we must divide by the number of ways we can permute NN identical particles, which is N!N! (N factorial):

Ωcorrect=ΩnaiveN!\Omega_{\text{correct}} = \frac{\Omega_{\text{naive}}}{N!}

With this correction, the entropy becomes:

Scorrect(E,V,N)=NkB[ln(VN(4πmE3Nh2)3/2)+52]S_{\text{correct}}(E, V, N) = Nk_B \left[\ln\left(\frac{V}{N}\cdot \left(\frac{4\pi mE}{3Nh^2}\right)^{3/2}\right) + \frac{5}{2}\right]

Notice that the volume appears as V/NV/N (volume per particle), not VV. This makes the entropy extensive — proportional to NN when E/NE/N and V/NV/N are held fixed — and the mixing entropy for two identical gases is exactly zero.

What Happens for Different Gases?

When genuinely different gases mix, the entropy increase is real and is given by:

ΔSmix=NkB(x1lnx1+x2lnx2)\Delta S_{\text{mix}} = -Nk_B\bigl(x_1 \ln x_1 + x_2 \ln x_2\bigr)

where x1=N1/Nx_1 = N_1/N and x2=N2/Nx_2 = N_2/N are the mole fractions. For equal amounts (x1=x2=1/2x_1 = x_2 = 1/2), this gives ΔS=NkBln2>0\Delta S = Nk_B \ln 2 > 0. This entropy of mixing is the thermodynamic reason why spontaneous mixing of different gases is irreversible.

A Preview: The Three Ensembles

The microcanonical ensemble — the framework we have built throughout this chapter — describes a system that is completely isolated: fixed EE, VV, and NN. It is the most fundamental ensemble, but it is often the most difficult to work with in practice, because real experiments rarely fix the energy exactly.

Statistical mechanics has developed two other ensembles, each suited to a different experimental situation. All three give the same thermodynamic results in the limit of large NN.

The Three Ensembles of Statistical Mechanics

Ensemble

Fixed quantities

Fluctuating quantity

Thermodynamic potential

Best suited for

Microcanonical

EE, VV, NN

(nothing)

Entropy SS

Isolated systems; conceptual foundations

Canonical

TT, VV, NN

Energy EE

Free energy F=UTSF = U - TS

Systems in contact with a heat bath; most practical calculations

Grand Canonical

TT, VV, μ\mu

Energy EE and particle number NN

Grand potential Ω=FμN\Omega = F - \mu N

Open systems; quantum gases; chemical reactions

The microcanonical ensemble answers the question: given fixed energy, what are the equilibrium properties?

The canonical ensemble answers: given fixed temperature (heat bath), what are the equilibrium properties?

The grand canonical ensemble answers: given fixed temperature and chemical potential (heat and particle reservoir), what are the equilibrium properties?

Summary

In this chapter we have laid the foundations of statistical physics. The central ideas to take away are:

The Big Picture
Key Definitions
Key Results
What Comes Next

Statistical physics bridges the microscopic world of atoms and the macroscopic world of thermodynamics. It does so through probability: by counting microstates, we identify the most probable macrostate, which is overwhelmingly more probable than any other for large systems. This is why thermodynamics is so precise.

Exercises