← thecodex.expert
Thermodynamics & Statistical Mechanics Hub Physicist Biographies
Definition Curious Exploring Deep Dive Sources
Statistical Mechanics · Concept

Partition Function

Reading time: 9 minConfidence: HighLast verified: October 2026

The (canonical) partition function of a system in thermal equilibrium at temperature T is Z = Σi gi e−Ei/kBT, summed over energy levels Ei with degeneracies gi. It normalises the Boltzmann distribution, Pi = gie−Ei/kBT/Z, and all equilibrium thermodynamics follows from it: F = −kBT ln Z, U = −∂ ln Z/∂β with β = 1/kBT, and S = (U − F)/T.

Curious

One sentence that captures itThe partition function adds up how accessible every state of a system is at a given temperature, and from that single number all its thermal properties can be calculated.

At a given temperature, a system does not sit in one state; it hops among many, preferring low-energy ones. The Boltzmann factor e−E/kBT measures how likely each state is: high-energy states are exponentially unlikely unless the temperature is high. Adding up these factors for all states gives the partition function Z (from the German Zustandssumme, “sum over states”).

Z is a master key. Knowing it, you can calculate a system's average energy, heat capacity, entropy and free energy without solving the motion of every particle.

Exploring

Worked examples(1) Two-level system with energy gap 0.1 eV at 300 K (kBT = 0.0259 eV): Z = 1 + e−0.1/0.0259 = 1.021, so only about 2% of systems occupy the upper level at any moment. (2) Hydrogen in the Sun's photosphere (T ≈ 5,778 K): the ratio of atoms in the n = 2 level (10.2 eV above ground, degeneracy 8 versus 2) is 4e−10.2/(kBT) ≈ 5×10−9. So few atoms are excited that it needed Cecilia Payne's 1925 analysis with the Boltzmann and Saha equations to show that the Sun is mostly hydrogen, overturning the assumption that its composition resembled Earth's. (Computed in Python.)
QuantityFrom Z
Probability of state iPi = e−βEi/Z
Mean energyU = −∂ ln Z/∂β
Helmholtz free energyF = −kBT ln Z
EntropyS = kB(ln Z + βU)
Heat capacityCV = ∂U/∂T
Common mistake — Commonly ConfusedZ is not a probability and is not dimensionless “by nature”: its value depends on where the zero of energy is set, but physical results such as probabilities and energy differences do not. In classical mechanics, Z is an integral over phase space divided by h3N (and N! for identical particles), choices that matter for absolute entropies.

Deep Dive

Primary sourceGibbs, J.W. (1902). Elementary Principles in Statistical Mechanics. New York: Scribner's.

Factorisation. For independent degrees of freedom, Z factorises: a molecule's partition function is z = ztranszrotzvibzelec, and for N identical non-interacting molecules Z = zN/N!. The translational part ztrans = V/λ³, with thermal wavelength λ = h/√(2πmkBT), leads to the ideal gas law and the Sackur–Tetrode entropy (see Boltzmann Entropy). Vibrational modes give zvib = 1/(1 − e−hν/kBT), which explains why vibrations freeze out at low temperature (see Equipartition Theorem).

Fluctuations. Derivatives of ln Z give fluctuations as well as averages: ⟨(ΔE)²⟩ = kBT²CV. Phase transitions appear as non-analytic points of ln Z per particle in the thermodynamic limit; the 1944 Onsager solution of the 2D Ising model and the Lee–Yang theorem (1952) on the zeros of the partition function made this precise (see Phase Transitions).

Beyond physics. The same mathematical object appears in Bayesian statistics (the evidence), in machine learning (energy-based models) and in quantum field theory, where the path-integral partition function in imaginary time connects quantum mechanics to statistical mechanics.

Sources

  • Gibbs, J.W. (1902). Elementary Principles in Statistical Mechanics. Scribner's.
  • Payne, C.H. (1925). Stellar Atmospheres. Harvard Observatory Monographs No. 1.
  • Pathria, R.K., Beale, P.D. (2011). Statistical Mechanics (3rd ed.). Academic Press.
Last verified: October 2026 · Source: Gibbs (1902); Payne (1925); Pathria & Beale (2011) · Confidence: high