The Partition Function and F = -kT ln Z
Statement
For a system in thermal contact with a reservoir at temperature T, normalizing the Boltzmann distribution pi ∝ e−βEi over microstates i forces the introduction of the canonical partition function Z = ∑i e−βEi (with β = 1/kT). The Helmholtz free energy is then F = −kT ln Z, and the internal energy, entropy, and every thermodynamic quantity follow as derivatives of ln Z.
Why it matters
The partition function is the single bridge between microscopic mechanics and macroscopic thermodynamics. Once you can write down the energy spectrum {Ei} of a system and sum e−βEi, every equilibrium thermodynamic property is obtained by differentiation — no further physical input is required. This is why Z is often called the generating function of statistical mechanics.
The relation F = −kT ln Z is the exact point where the two halves of the subject meet: the left side is a thermodynamic potential defined by a Legendre transform of the energy; the right side is a sum over quantum states. Identifying them turns thermodynamics into arithmetic on spectra.
Assumptions
Derivation
Result
Reading. Everything thermodynamic is a derivative of ln Z. Compute the single scalar Z from the spectrum; its logarithm is (up to −kT) the free energy. From F(T,V,N) the standard thermodynamic derivatives deliver the rest: S=−(∂F/∂T)V,N, pressure P=−(∂F/∂V)T,N, chemical potential μ=(∂F/∂N)T,V, and U=F+TS. The differentiation with respect to β pulls down factors of Ei, which is why log-derivatives of Z generate energy moments (mean, variance, …).
Units check. βEi is dimensionless (β in J−1, Ei in J), so every Boltzmann factor and Z itself are dimensionless — ln Z is therefore well-defined. Then kT ln Z carries the units of kT: (J K−1)(K) = J, matching F. U=−∂ln Z/∂β has units J⋅(J−1)−1=J. S=U/T+k ln Z is J K−1. All consistent.
Limiting cases
- High temperature (β→0): every Boltzmann factor →1, so Z→ the number of accessible microstates g. Then F→−kT ln g and S→k ln g — the microcanonical, equal-probability limit.
- Low temperature (β→∞): Z→g0e−βE0, dominated by the ground level. Then F→E0−kT ln g0, U→E0, S→k ln g0 (the third law, with residual entropy if g0>1).
- Two-level system: Z=1+e−βε gives U=ε/(eβε+1) and the Schottky heat-capacity peak — a full solvable check.
- Factorizable systems: for independent subsystems E=∑aE(a), so Z=∏aZ(a) and ln Z (hence F, U, S) is additive — extensivity emerges automatically.
Breaks when
- The sum diverges. A spectrum unbounded below, or an attractive potential with no ground state (e.g. point charges collapsing, or a classical hydrogen atom summed over all bound and arbitrarily deep states without cutoff), makes Z=∞. No F exists; the canonical formalism simply does not apply.
- Long-range interactions / non-additive energy. Gravitating systems and unscreened Coulomb systems violate Esys+Eres additivity, so Z is non-extensive, ln Z is not proportional to N, and ensembles become inequivalent (negative heat capacities appear).
- Small systems / strong coupling. When the system–bath boundary energy is not negligible, the derived Boltzmann factor is only approximate and F=−kT ln Z acquires coupling-dependent corrections; the very definition of the system's temperature blurs.
- Broken ergodicity / non-equilibrium. In a glass or a system trapped in a metastable basin below its transition, the accessible states are not the full spectrum; the equilibrium Z overcounts and the measured F is basin-restricted, not the global minimum.
Failure modes
- Summing over energy levels instead of microstates. Forgetting degeneracy: a level of energy E and degeneracy g contributes g e−βE, not e−βE. This silently corrupts S.
- Sign errors in F=−kT ln Z. Because Z>1 usually, ln Z>0 and F<0 for the excitation part; dropping the minus sign flips the free energy and reverses which state is favoured.
- Differentiating Z at fixed β while letting Ei vary. The relation U=−∂ln Z/∂β requires the spectrum to be held fixed; if V is allowed to change you are computing something else (and picking up the pressure term).
- Confusing ⟨E⟩ with the most probable energy. The distribution is sharply peaked for large N, but U=⟨E⟩ is the mean; only in the thermodynamic limit do mean, mode, and microcanonical energy coincide.
- Adding an extensive constant to the entropy by hand. For indistinguishable particles the correct single-particle result needs the 1/N! (Gibbs) factor in Z; omitting it produces the Gibbs paradox — a non-extensive S.
Discussion
The deep content of F=−kT ln Z is that a sum over states becomes a minimization of a potential. Thermodynamics says the equilibrium state at fixed T,V,N minimizes F=U−TS — a competition between lowering energy and raising entropy. Statistical mechanics shows this same F is −kT ln Z, where Z automatically weighs each state by e−βEi. The Boltzmann weight is the energy–entropy trade-off resolved microstate by microstate; summing them and taking the log performs the minimization for you.
The two threads of this unit meet here. The chance thread supplies the normalized probability pi=e−βEi/Z and the Gibbs entropy; the energy thread supplies the Legendre structure F=U−TS whose natural variables (T,V,N) are exactly the canonical control variables. That the same four symbols U,T,S,F appear on both sides is not a coincidence but the statement that the canonical ensemble is the microscopic realization of Helmholtz thermodynamics.
Log-derivatives of Z form a generating hierarchy. The first β-derivative gives −U; the second gives the energy variance, ∂2ln Z/∂β2=⟨E2⟩−⟨E⟩2=k T2CV. This is a fluctuation–dissipation relation: the size of spontaneous energy fluctuations is fixed by the heat capacity, a linear response. Because the variance scales as N while ⟨E⟩ scales as N, the relative fluctuation falls as N−1/2 — which is precisely why the canonical and microcanonical descriptions agree in the thermodynamic limit.
At the rigorous level, F=−kT ln Z is a Legendre transform in disguise on both sides. Thermodynamically, F(T) is the Legendre transform of U(S) swapping S↔T. Statistically, the Laplace transform relating the microcanonical Ω(E) to Z(β)=∫Ω(E)e−βEdE becomes, by the saddle-point/large-deviation evaluation for large N, exactly a Legendre transform between lnΩ(E)=S/k and ln Z(β)=−βF. Convexity of S(E) is what guarantees this transform is single-valued; where S(E) has a concave region (a van der Waals loop, a first-order transition) the ensembles are inequivalent and the naive F=−kT ln Z gives the Maxwell-constructed (convex-hull) free energy, not the metastable branch.
Common misconceptions. Z is not itself a probability and is not dimensionless "because it must be" — it is dimensionless only because each βEi is. It is not the number of states (that is only its T→∞ limit); it is a thermally weighted count, sometimes called the effective number of accessible states. And F=−kT ln Z is exact, not an approximation — the approximations enter only in evaluating Z.
Worked examples
Reading. At 300 K the excited state is populated with probability e−βε/Z=0.440 — the level gap is only about a quarter of kT, so the two states are nearly equally occupied and U is close to ε/2. Check: F=−(1.381×10−23)(300)ln(1.786)=−(4.143×10−21)(0.5799)=−2.40×10−21 J.
Reading. Here ℏω≈kT, so the oscillator sits between its quantum and classical regimes. The internal energy U=4.46×10−21 J exceeds the zero-point value ℏω/2=2.00×10−21 J because thermal excitation adds ℏω/(eβℏω−1)=2.46×10−21 J. In the classical limit βℏω→0 this would tend to U→kT=4.14×10−21 J (equipartition), which the exact result approaches from above.
Problems
- A three-level system has non-degenerate energies 0, ε, 2ε. Write Z and find the probability of the top level at kT=ε.
Solution
With x=e−βε, Z=1+x+x2. At kT=ε, βε=1, x=e−1=0.3679, x2=0.1353. So Z=1.5032 and p2ε=x2/Z=0.1353/1.5032=0.0900. The top level holds about 9%. - For the two-level system (Z=1+e−βε) derive the heat capacity CV=dU/dT and locate its qualitative maximum (the Schottky anomaly).
Solution
U=ε/(eβε+1). Differentiate: CV=dU/dT=k(βε)2 eβε/(eβε+1)2. Writing u=βε=ε/kT, CV=k u2eu/(eu+1)2. This vanishes as T→0 (u→∞, exponential kill) and as T→∞ (u→0, u2 kill), so it peaks at intermediate T. Setting dCV/du=0 gives the transcendental u tanh(u/2)=2, solved by u≈2.40, i.e. kT≈0.417ε — the Schottky peak sits below the level gap. - N distinguishable, independent two-level systems each with gap ε. Write the total ZN and total F, and confirm extensivity.
Solution
Independence and additive energy give ZN=(Z1)N=(1+e−βε)N. Then F=−kT ln ZN=−NkT ln(1+e−βε). Since F∝N (and U,S likewise), the free energy is extensive. Note: distinguishable, so no 1/N! is needed — these are localized sites, e.g. paramagnetic ions on a lattice. - Show explicitly that S=−(∂F/∂T)V,N reproduces S=U/T+k ln Z, given F=−kT ln Z and Z=Z(β,V).
Solution
F=−kT ln Z. Differentiate at fixed V,N: ∂F/∂T=−k ln Z−kT(∂ln Z/∂T). Now ∂ln Z/∂T=(∂ln Z/∂β)(dβ/dT)=(−U)(−1/kT2)=U/kT2, using U=−∂ln Z/∂β and β=1/kT. Hence ∂F/∂T=−k ln Z−kT⋅U/kT2=−k ln Z−U/T. Therefore S=−∂F/∂T=k ln Z+U/T. QED. - A classical particle of mass m in a 1D box of length L has Z1=L/Λ with thermal wavelength Λ=h/√(2πmkT). Compute U and CV and comment on equipartition.
Solution
Z1=L(2πmkT)1/2/h=L(2πm/h2)1/2β−1/2, so ln Z1=−½lnβ+(const). Then U=−∂ln Z1/∂β=½/β=½kT, and CV=dU/dT=½k. This is exactly the equipartition result: ½kT per translational (quadratic) degree of freedom. The β−1/2 scaling of Z is what encodes the single quadratic degree of freedom — each such power of β−1/2 contributes ½kT to U.