A partition function is a weighted sum over the microscopic states available to a physical system. In statistical mechanics, it connects a microscopic description—such as molecular positions and momenta or quantum energy levels—to measurable quantities including pressure, internal energy, and heat capacity. Its most familiar form is the canonical partition function,
where is the energy of microstate , is absolute temperature, and is the Boltzmann constant. Each term is a statistical weight: low-energy states receive greater weight individually, while numerous higher-energy states can collectively dominate.
A partition function both normalizes the equilibrium probability distribution and generates thermodynamic information through its logarithm and derivatives. Different experimental constraints require different partition functions, particularly when a system exchanges particles or volume with its surroundings. The same mathematical construction appears in molecular chemistry, magnetism, phase transitions, and quantum field theory. Although its definition is compact, evaluating it for an interacting many-particle system is often the central difficulty of an equilibrium calculation.
Microscopic states, statistical weights, and historical development
A microscopic state specifies the information required to describe a system at the chosen level of theory. In classical mechanics, this usually means a point in phase space, containing all particle positions and momenta. In quantum mechanics, the equilibrium sum can be taken over a complete set of energy eigenstates. A macroscopic state, by contrast, is specified by quantities such as temperature, volume, and particle number. Many microscopic states can be compatible with one macroscopic description.
The partition function organizes these microscopic possibilities according to both energy and multiplicity. If an energy level has degeneracy , meaning that distinct states share that energy, then
The degeneracy must not be counted again if the sum already runs over individual states. This distinction matters in atomic spectroscopy, spin systems, and molecular rotational states, where equal-energy states can occur in large numbers. The equilibrium importance of an energy range depends on the competition between its Boltzmann suppression and its number of accessible states.
For a continuous energy description, introduce the density of states , defined so that counts states in an interval . Then
Mathematically, this is a Laplace transform. It links a description based on counting states at fixed energy to one based on weighting states at fixed temperature. The rapid growth of with system size explains why macroscopic equilibrium is usually concentrated around a narrow range of energies even though many individual microscopic states contribute.
The historical foundations developed through nineteenth-century kinetic theory and the work of Ludwig Boltzmann on the statistical interpretation of entropy. J. Willard Gibbs gave a systematic ensemble formulation in his 1902 book Elementary Principles in Statistical Mechanics. The conventional symbol is associated with the German Zustandssumme, meaning “sum over states.” Quantum theory subsequently changed which states were counted and how indistinguishable particles were treated, without removing the underlying weighted-sum structure.
The concept is therefore more specific than an arbitrary sum of probabilities. The terms are initially unnormalized weights fixed by the physical constraints. Their sum determines the normalization and, through its parameter dependence, records how equilibrium changes when temperature, volume, or external fields change. A finite partition function is also a condition for the corresponding equilibrium distribution to exist; an unrestricted free particle in infinite space, for example, has a divergent translational state sum.
The canonical ensemble and the Boltzmann distribution
The canonical ensemble describes a system with fixed particle number and volume , in thermal equilibrium with a much larger reservoir at temperature . The system can exchange energy with the reservoir, but not particles. Its energy therefore fluctuates, while the combined energy of system and reservoir is fixed. Weak coupling is assumed so that their interaction energy does not substantially alter the system’s own energy levels.
The Boltzmann weight follows from counting reservoir states. If the system occupies microstate with energy , the reservoir has energy . Its multiplicity is proportional to
Expanding the reservoir entropy to first order gives
The state-independent factor cancels in normalization, leaving the Boltzmann distribution
Higher-order terms describe corrections associated with a finite reservoir. The canonical approximation becomes especially accurate when energy exchanges produce negligible changes in reservoir temperature.
In a quantum description, the same distribution is represented by the equilibrium density operator
where is the Hamiltonian operator. The trace is independent of the basis used to evaluate it. An energy eigenbasis makes the trace a sum of exponentials, but other bases may be more useful computationally. The expectation value of an observable is
Thus the partition function alone is a scalar, while the Hamiltonian and density operator retain the information needed to evaluate particular observables.
A simple two-state system illustrates normalization. Let its energies be and , each nondegenerate. Then
When , the excited state is rarely occupied. When , the two probabilities approach one-half. The appearance of a Fermi-like denominator here results from the two-state structure; it does not by itself imply that the system consists of fermions.
The choice of energy zero changes but not normalized probabilities. Replacing every by multiplies by . Mean energy and free energy shift by , while entropy, heat capacity, and occupation probabilities remain unchanged for a parameter-independent shift. Consequently, the numerical value of a partition function must be interpreted together with its energy convention.
Classical phase-space integrals and indistinguishability
For identical, structureless particles in three dimensions, the classical canonical partition function is
where is the Planck constant. The coordinate integral covers the allowed configurations, and the momentum integral covers all allowed momenta. The factor makes the phase-space measure dimensionless. Although classical equations of motion do not require , the absolute normalization of classical statistical state counting is inherited from quantum mechanics.
The factor prevents permutations of identical particles from being counted as distinct physical arrangements in the dilute classical limit. Omitting it gives an incorrect particle-number dependence of entropy and produces the Gibbs paradox for mixing identical gases. It is not a universal factor for every classical model: particles attached to different lattice sites, distinguishable components, and constrained mechanical coordinates require state counting appropriate to their physical identities. Moreover, dividing by does not reproduce quantum exchange effects when wave functions overlap substantially.
For particles with a momentum-independent potential energy,
the momentum integrals are Gaussian. Defining the thermal wavelength
one obtains
The remaining configurational integral contains the effects of interactions, walls, and external potentials. For an ideal gas, inside the container, so the integral is :
This expression yields the ideal-gas equation and the translational energy .
The dilute-gas condition is commonly expressed as , where , with internal degeneracy included when relevant. It indicates that quantum exchange effects are small. Low temperature or high density can invalidate this approximation, requiring Bose or Fermi statistics. Classical treatment can also fail for particular degrees of freedom even when translational motion is approximately classical: molecular vibrations, for example, often remain quantum-mechanically restricted at temperatures where translation is well described by a phase-space integral.
The classical integral further shows how microscopic geometry enters thermodynamics. Excluded-volume interactions remove configurations from the accessible integration domain; attractive interactions increase their statistical weight. Neither effect generally permits the configurational integral to factor into independent one-particle contributions. This is why the ideal-gas partition function is elementary while the corresponding expression for a dense liquid is a many-body problem.
Thermodynamic potentials, derivatives, and fluctuations
The canonical partition function determines the Helmholtz free energy:
This relation connects microscopic state counting with thermodynamics. For a simple compressible system,
where is entropy and is chemical potential. Derivatives of , or equivalently of , give the associated equilibrium quantities. Particle-number derivatives are understood thermodynamically when is large; finite systems require suitable differences or a particle-exchanging ensemble.
For a Hamiltonian without explicit temperature dependence,
The entropy formula is equivalent to
for a classical discrete distribution, or its density-operator counterpart in quantum mechanics. Pressure follows from
These expressions assume that the variables and the state-counting measure are handled consistently. An effective model whose parameters depend explicitly on temperature needs additional derivative terms and cannot automatically use every temperature-independent-Hamiltonian identity unchanged.
The second derivative of gives the energy variance:
Consequently,
Heat capacity is therefore a measure of equilibrium energy fluctuations. For many ordinary systems away from a critical point, the mean energy scales as , while its standard deviation scales as . Relative fluctuations then decrease as , explaining why macroscopic energy appears sharply defined even when a canonical system exchanges energy continuously with its surroundings.
An external parameter can generate other observables. If
where couples linearly to an observable , then
For a classical system, or a quantum system in which the relevant operators commute,
Magnetic susceptibility and compressibility are examples of response coefficients related to fluctuations. For noncommuting quantum observables, the response generally involves an imaginary-time correlation rather than simply the equal-time variance.
Because generates connected fluctuations, it is called a cumulant-generating quantity. Higher derivatives yield higher energy cumulants, which describe deviations from Gaussian fluctuations. Mixed derivatives connect different observables and give microscopic expressions for thermodynamic cross-responses. The logarithm is essential: independent subsystems have multiplying partition functions but additive free energies and additive connected fluctuation contributions.
Other ensembles and their partition functions
Different boundary conditions require different statistical sums. The microcanonical ensemble describes an isolated system with fixed energy, volume, and particle number. Its central quantity is the number of accessible states in a specified energy interval,
with Boltzmann entropy . Definitions based on an energy-shell density or an integrated state count require attention to normalization and finite-system differences. The canonical partition function is obtained by summing such fixed-energy contributions with Boltzmann weights.
When particles as well as energy can pass between a system and a reservoir, the appropriate description is the grand canonical ensemble. Its partition function is
Writing the fugacity as makes a generating function for the canonical functions . A microstate with particle number and energy has probability
For several particle species, the exponent contains .
The grand potential is
For a homogeneous bulk system with negligible surface contributions, . Differentiation gives
and
The latter relates particle-number fluctuations to the system’s response to a particle reservoir. This formulation is particularly convenient for adsorption, quantum gases, and mixtures.
The isothermal–isobaric ensemble instead fixes temperature, pressure, and particle number while allowing volume to fluctuate. A dimensionless version of its partition function can be defined using a fixed reference volume :
The factor weights the mechanical cost associated with volume. Different normalization conventions exist; a fixed reference measure makes the probability distribution well defined without taking the logarithm of a dimensional quantity. In the macroscopic limit, the logarithm generates the Gibbs free energy, apart from normalization-dependent subextensive contributions.
For stable short-range interactions, these ensembles usually predict the same bulk local properties in the thermodynamic limit, where at fixed density. They do not describe identical global fluctuations: canonical particle number is fixed, whereas grand-canonical particle number fluctuates. Ensemble equivalence also needs qualification near phase coexistence, in small systems, and in nonadditive systems with long-range interactions.
Quantum state counting and elementary models
For quantum systems, a partition function must count physically allowed many-particle states, not arbitrary assignments of labeled particles to levels. Identical bosons occupy symmetric many-particle states, while identical fermions occupy antisymmetric states. The Pauli exclusion principle restricts each fermionic single-particle state to occupation zero or one. For noninteracting particles, occupation-number states make the grand partition function factorize over single-particle states.
For a single-particle state with energy , bosonic occupation numbers are , giving
For fermions, , giving
Differentiating with respect to the corresponding level energies produces the mean occupations,
These are Bose–Einstein statistics and Fermi–Dirac statistics. The bosonic grand sum requires for finite occupation of the lowest level; condensation is associated with its approach to that limit in a macroscopic system.
The quantum harmonic oscillator supplies another fundamental example. With
its partition function is a geometric series:
The mean energy is
At high temperature it approaches the classical result ; at low temperature it approaches the zero-point energy . The oscillator heat capacity vanishes as thermal excitation becomes inaccessible. Products of oscillator partition functions describe independent vibrational modes and, in the harmonic approximation, crystal phonons.
An independent spin- magnetic moment with energies and has
The mean magnetic moment per spin is
It is approximately proportional to in weak fields and saturates in a strong field at fixed temperature. Its heat capacity exhibits a finite-temperature peak associated with redistribution between the two levels, known as a Schottky anomaly. This demonstrates that a conspicuous heat-capacity maximum does not necessarily signal a phase transition.
The factorization used in these examples depends on independence. Coupled spins, anharmonic vibrations, and interacting quantum particles generally cannot be reduced to products over elementary components. Their partition functions retain the same trace definition, but the many-body spectrum becomes the computational obstacle.
Interactions, phase transitions, and critical behavior
For independent subsystems and , with additive Hamiltonian , the partition function factorizes:
Interactions obstruct this simple decomposition because the weight of one component depends on the state of another. In a fluid with pair potential ,
the configurational integral couples particle positions. At low density, expanding
in terms of the Mayer function organizes these correlations into cluster integrals. The resulting virial expansion expresses pressure as a power series in density.
For a three-dimensional isotropic classical pair potential, the second virial coefficient is
and
Repulsive excluded volume generally contributes positively to , whereas attractive regions contribute negatively. Higher coefficients involve configurations of three or more particles. Such expansions are useful in dilute gases, but a low-density series need not remain convergent in the liquid region or near a critical point.
Lattice models isolate interaction effects in a simpler state space. The Ising model has spins and Hamiltonian
Its partition function sums over all spin configurations. For a one-dimensional nearest-neighbor chain with periodic boundaries, the sum can be written as the trace of a power of a transfer matrix. At zero field,
This chain has no phase transition at nonzero temperature. By contrast, Lars Onsager’s 1944 solution established a finite-temperature transition for the zero-field square-lattice model, with
For a finite model with finitely many states, is a finite positive sum at real positive temperature and is analytic in ordinary finite parameters. Genuine thermodynamic singularities emerge through a limiting process as system size grows without bound. A first-order transition corresponds to competing bulk free-energy branches; continuous transitions involve singular responses and correlations over increasingly large distances. This distinction separates a smooth finite-system crossover from a sharp bulk phase transition.
The Lee–Yang theorem, developed in 1952, examines zeros of partition functions after an external parameter is continued into the complex plane. For ferromagnetic Ising models with suitable couplings, the zeros obey a circle constraint in an appropriate field variable. A bulk transition can occur when accumulating zeros approach the physical real-parameter domain. This connects apparently smooth finite sums to macroscopic nonanalyticity. The renormalization group provides a complementary explanation of why different microscopic systems can share the same critical scaling laws.
Molecular partition functions and chemical equilibrium
In molecular applications, the one-molecule partition function is often separated approximately into translational, rotational, vibrational, and electronic factors:
This factorization assumes that the corresponding motions are sufficiently weakly coupled. It is most effective for dilute gases and relatively rigid molecules; rotation–vibration coupling, anharmonicity, and electronic-state mixing require corrections. For noninteracting indistinguishable molecules in the classical dilute limit,
This versus distinction is important because both are sometimes called a molecular partition function.
Translation contributes , using the molecular mass. For a rigid linear rotor,
where is the moment of inertia and each rotational level has spatial degeneracy . At temperatures high compared with the rotational spacing, the rotational partition function is approximately
where is the rotational symmetry number. It prevents equivalent molecular orientations from being overcounted in this approximation. At low temperature, the actual allowed rotational levels and their nuclear-spin statistical weights must be treated explicitly, as in the distinct rotational populations of hydrogen.
Vibrational contributions are commonly approximated by products of harmonic-oscillator partition functions. A nonlinear molecule with atoms has vibrational modes; a linear molecule has , after removing overall translation and rotation. High-frequency modes may contribute little to heat capacity at ordinary temperatures because their excited states have low Boltzmann populations. Their zero-point energies nevertheless matter for reaction energies and isotope effects. Spectroscopy supplies rotational constants, vibrational frequencies, and electronic energy separations used in these sums.
For an ideal-gas species with one-molecule partition function , the chemical potential is approximately
provided internal energies are referenced consistently. Combining the chemical potentials of reactants and products gives the condition for chemical equilibrium:
Partition-function ratios thus determine equilibrium composition through molecular energies and state counts. Expressing the result as a dimensionless equilibrium constant requires specified standard states; omitting them can leave misleading dimensional factors.
Internal-state sums also require physically appropriate boundaries. An isolated-atom model with infinitely many bound levels approaching an ionization threshold can produce a divergent electronic state sum if applied without environmental restrictions. In actual gases and plasmas, interactions and ionization modify the high-lying states. More generally, molecular partition functions are equilibrium objects: they predict relative populations but do not by themselves determine reaction rates or the timescale of equilibration.
Computational evaluation and field-theoretic formulations
Direct enumeration becomes impractical quickly: an Ising model with 100 spins already has , approximately , configurations. Continuous molecular systems replace this sum with high-dimensional integrals. Computational statistical mechanics therefore usually seeks expectation values or free-energy differences without evaluating every contribution individually. Exact enumeration and matrix methods remain valuable for small systems, one-dimensional models, and benchmarks against which approximate methods can be checked.
The Monte Carlo method samples configurations according to their statistical weights. The Metropolis algorithm, introduced in 1953, accepts a proposed move with probability
when the proposal is symmetric. The normalization cancels from the ratio of probabilities, which is precisely why canonical sampling is possible without knowing the partition function. For asymmetric proposals, the acceptance ratio must also include the appropriate proposal probabilities. Sampling can nevertheless become slow when free-energy barriers separate important regions of configuration space.
Obtaining free energies requires additional methods. For
thermodynamic integration gives
Another exact identity is
The latter can converge poorly when configurations important to system 1 are rarely sampled in system 0. Intermediate states, umbrella sampling, and related enhanced-sampling techniques address this overlap problem. Molecular dynamics can provide the required ensemble averages when its sampling scheme produces the intended equilibrium distribution.
Quantum partition functions can also be rewritten as path integrals. Splitting the operator into many short imaginary-time factors introduces intermediate configurations. For a particle with Euclidean action , the schematic form is
with imaginary-time extent . The trace identifies the initial and final configurations. This representation underlies path-integral simulations of quantum particles and finite-temperature formulations of quantum field theory. Bosonic fields are periodic in imaginary time, while fermionic Grassmann fields are antiperiodic.
Not all resulting weights can be interpreted as ordinary probabilities. Fermion exchange or complex action terms can create negative or complex contributions, producing the sign problem and severe cancellations. This limits straightforward importance sampling in many quantum systems. In lattice quantum chromodynamics, related Euclidean partition functions are evaluated numerically to investigate strongly interacting matter, although nonzero baryon chemical potential presents a major sign-problem difficulty.
A field-theoretic partition function may be extended by introducing sources coupled to observables. Derivatives of generate correlation functions, while derivatives of generate connected correlation functions. This is the same generating principle that makes energy derivatives of yield canonical fluctuations, now applied to observables distributed across space and imaginary time.