Partition Functions
Reading time: ~45 minutes | Derivations: 5 | Simulations: 2
1. Introduction: The Bridge Between Worlds
The partition function is the single most important quantity in statistical mechanics. It encodes all thermodynamic information about a system in one mathematical object — a sum over Boltzmann-weighted states that connects the microscopic energy spectrum to macroscopic observables.
The Canonical Partition Function
For a system with discrete energy levels $\{E_i\}$, the canonical partition function is:
where $\beta = 1/(k_B T)$ is the thermodynamic beta, $g_i$ is the degeneracy of level $i$, and the sum runs over all distinct energy levels.
The German word Zustandssumme ("sum over states") captures the essence: we sum over every accessible quantum state, each weighted by its Boltzmann factor. At low temperature, only the ground state contributes significantly. As $T \to \infty$, all states participate equally, and $Z$ grows without bound.
For a single molecule, we write the molecular partition function as $q$. For $N$ indistinguishable, non-interacting molecules, the system partition function is:
The $N!$ accounts for the indistinguishability of identical particles (Gibbs's correction), preventing the Gibbs paradox in which the entropy of mixing two identical gases would be nonzero.
Why the Partition Function Matters
- Every thermodynamic quantity can be derived from $Z$ by differentiation
- It provides the normalization for the Boltzmann distribution
- The logarithm of $Z$ is directly proportional to the Helmholtz free energy
- Chemical equilibrium constants follow from ratios of partition functions
- It naturally incorporates quantum effects through the energy level structure
2. Derivation: Translational Partition Function
A molecule of mass $m$ confined to a cubic box of side $L$(volume $V = L^3$) has particle-in-a-box energy levels in three dimensions:
The translational partition function is therefore:
Because the energy is a sum of independent terms, the triple sum factors:
High-Temperature (Continuum) Limit
Define $\alpha = h^2/(8mL^2 k_B T)$. For typical molecules at room temperature,$\alpha \sim 10^{-18}$, so the spacing between levels is vastly smaller than $k_B T$. We replace the sum by an integral:
This is the Gaussian integral $\int_0^\infty e^{-ax^2}\,dx = \frac{1}{2}\sqrt{\pi/a}$.
Substituting back and cubing:
Thermal de Broglie Wavelength
Define the thermal de Broglie wavelength:
Then the translational partition function takes the elegant form:
Physical interpretation: $q_{\text{trans}}$ counts the number of thermal de Broglie volumes that fit inside the container. For an ideal gas at STP,$q_{\text{trans}} \sim 10^{30}$ — an enormous number, confirming that the classical (high-temperature) limit is valid.
3. Derivation: Rotational Partition Function
For a rigid rotor (linear molecule), the rotational energy levels are:
where $I$ is the moment of inertia and we define the characteristic rotational temperature:
where $B$ is the rotational constant in frequency units. For N$_2$,$\Theta_{\text{rot}} \approx 2.88$ K; for H$_2$,$\Theta_{\text{rot}} \approx 87.6$ K.
Each level $J$ has degeneracy $g_J = 2J + 1$ (from the magnetic quantum number $m_J = -J, \ldots, +J$). The rotational partition function is:
The symmetry number $\sigma$ corrects for overcounting of indistinguishable orientations: $\sigma = 1$ for heteronuclear diatomics (CO, HCl),$\sigma = 2$ for homonuclear diatomics (N$_2$, O$_2$).
High-Temperature Limit
When $T \gg \Theta_{\text{rot}}$, many rotational levels are populated and we may replace the sum by an integral. Let $x = J(J+1)$, so$dx = (2J+1)\,dJ$:
At 300 K for N$_2$: $q_{\text{rot}} \approx 300/(2 \times 2.88) \approx 52$.
Extension to Polyatomic Molecules
Symmetric Top
For a symmetric top with moments of inertia $I_A = I_B \neq I_C$:
where $\Theta_A = \hbar^2/(2I_A k_B)$ and similarly for $\Theta_C$.
Asymmetric Top
For a general asymmetric top with three distinct moments $I_A, I_B, I_C$:
Water is an asymmetric top with $\sigma = 2$: $\Theta_A = 40.1$ K,$\Theta_B = 20.9$ K, $\Theta_C = 13.4$ K. At 300 K,$q_{\text{rot}} \approx 43$.
Note: Rotational contributions give $C_V = k_B$ per molecule for linear molecules (2 rotational degrees of freedom) and $C_V = \frac{3}{2}k_B$for nonlinear molecules (3 rotational degrees of freedom) in the classical limit.
4. Derivation: Vibrational Partition Function
In the harmonic approximation, a diatomic molecule has vibrational energy levels:
Measuring energies from the zero-point level (setting $E_0 = 0$), the vibrational partition function becomes:
where we define the characteristic vibrational temperature:
For N$_2$: $\Theta_{\text{vib}} \approx 3393$ K; for HCl: $\Theta_{\text{vib}} \approx 4303$ K.
This is a geometric series with ratio $r = e^{-\Theta_{\text{vib}}/T} < 1$. Using $\sum_{v=0}^{\infty} r^v = 1/(1-r)$:
Vibrational Energy and Heat Capacity
The mean vibrational energy (per molecule, above zero-point) is obtained from$\langle E \rangle = -\partial \ln q_{\text{vib}} / \partial \beta$:
The vibrational contribution to the heat capacity is:
This is the Einstein function. Key limiting behaviors:
- $T \gg \Theta_{\text{vib}}$: $C_{V,\text{vib}} \to k_B$ (classical equipartition)
- $T \ll \Theta_{\text{vib}}$: $C_{V,\text{vib}} \to k_B (\Theta_{\text{vib}}/T)^2 e^{-\Theta_{\text{vib}}/T} \to 0$ (mode frozen out)
Polyatomic molecules: A nonlinear molecule with $N$ atoms has$3N - 6$ vibrational modes (or $3N - 5$ for linear). Each mode has its own $\Theta_{\text{vib},i}$, and the total vibrational partition function is $q_{\text{vib}} = \prod_{i} q_{\text{vib},i}$.
5. Derivation: Electronic Partition Function
The electronic partition function sums over electronic energy levels, each with its own degeneracy:
where $g_i$ is the degeneracy of the $i$-th electronic state and$\varepsilon_i$ is its energy above the ground state.
The Usual Simplification
For most molecules, the first excited electronic state lies tens of thousands of cm$^{-1}$above the ground state, corresponding to $\Theta_{\text{elec}} \sim 10^4$–$10^5$ K. At ordinary temperatures, all excited-state Boltzmann factors are negligible:
Examples: N$_2$ ($g_0 = 1$, $^1\Sigma_g^+$), O$_2$ ($g_0 = 3$, $^3\Sigma_g^-$), Cl ($g_0 = 4$, $^2P_{3/2}$).
Exception: Nitric Oxide (NO)
NO is a remarkable exception. Its ground state $^2\Pi_{1/2}$ ($g_0 = 2$) has a low-lying excited state $^2\Pi_{3/2}$ ($g_1 = 2$) at only$\varepsilon_1 = 121.1$ cm$^{-1}$, corresponding to$\Theta_{\text{elec}} \approx 174$ K. This is comparable to room temperature!
At 300 K: $q_{\text{elec}}^{\text{NO}} \approx 2 + 2(0.562) = 3.12$. The excited state contributes significantly to the partition function and therefore to the entropy and heat capacity of NO gas.
Electronic Contribution to Heat Capacity
For a two-level electronic system with degeneracies $g_0, g_1$ and gap $\varepsilon_1$:
This is a Schottky anomaly: the heat capacity has a maximum at$k_BT \approx 0.42\,\varepsilon_1$ and vanishes at both low and high temperatures.
6. Derivation: Total Molecular Partition Function
The key assumption enabling the factorization of the molecular partition function is the separability of degrees of freedom. If the total molecular energy can be written as:
then because the exponential of a sum is a product of exponentials, the molecular partition function factors:
This factorization is approximate: rotation-vibration coupling, centrifugal distortion, and electronic-vibrational interactions break strict separability. These corrections are typically small for low-lying states.
Thermodynamic Quantities from the Partition Function
For $N$ indistinguishable molecules, $Q = q^N/N!$. Using Stirling's approximation ($\ln N! \approx N\ln N - N$):
Internal Energy
Equivalently, $E = k_B T^2 \frac{\partial \ln Q}{\partial T}\Big|_V$.
Helmholtz Free Energy
This is the fundamental bridge equation of statistical thermodynamics. All other thermodynamic potentials follow from $A$.
Entropy
From $S = -(\partial A/\partial T)_V$ or equivalently $S = (E - A)/T$:
For an ideal gas, this yields the Sackur-Tetrode equation for translational entropy:
Pressure
Since only $q_{\text{trans}} \propto V$, this immediately gives the ideal gas law:$P = Nk_BT/V$.
Chemical Potential
This connects to chemical equilibrium: for the reaction $aA + bB \rightleftharpoons cC + dD$, the equilibrium constant is:
7. Applications
Heat Capacities of Gases
The heat capacity of an ideal gas reveals which degrees of freedom are active at a given temperature. For a diatomic molecule:
- Low T ($T \ll \Theta_{\text{rot}}$): Only translation is active. $C_V = \frac{3}{2}Nk_B$, giving$\gamma = C_P/C_V = 5/3$ (monatomic-like).
- Intermediate T ($\Theta_{\text{rot}} \ll T \ll \Theta_{\text{vib}}$): Translation + rotation active. $C_V = \frac{5}{2}Nk_B$, giving$\gamma = 7/5 = 1.4$. This is the regime for N$_2$ and O$_2$ at room temperature.
- High T ($T \gg \Theta_{\text{vib}}$): All modes active. $C_V = \frac{7}{2}Nk_B$, giving $\gamma = 9/7 \approx 1.29$.
Chemical Equilibrium from Partition Functions
The equilibrium constant for any gas-phase reaction can be computed from molecular partition functions without any empirical input beyond spectroscopic data. For example, the dissociation of I$_2$:
where $D_0$ is the dissociation energy from the zero-point level. Computing each $q$ from spectroscopic constants gives excellent agreement with experimental equilibrium constants.
Spectroscopic Determination of q
The molecular parameters entering partition functions — rotational constants ($B$), vibrational frequencies ($\nu$), electronic term values — are all measured spectroscopically. High-resolution infrared and microwave spectroscopy provide these constants to extraordinary precision (often 8+ significant figures for $B$), making statistical mechanical calculations of thermodynamic properties more accurate than direct calorimetric measurements for many small molecules.
8. Historical Context
Ludwig Boltzmann (1844–1906)
Boltzmann laid the foundations of statistical mechanics in the 1870s. His expression $S = k_B \ln W$ (carved on his tombstone) connects entropy to the number of microstates. He introduced the concept of the partition function as the normalization of the probability distribution over states, though the term "Zustandssumme" came later from Planck.
Max Planck (1858–1947)
In his derivation of the blackbody radiation law (1900), Planck introduced energy quantization $E = nh\nu$ and computed the partition function for quantum oscillators. This was the first quantum partition function, though Planck did not initially appreciate its revolutionary implications. His result for the average energy of an oscillator, $\langle E \rangle = h\nu/(e^{h\nu/k_BT} - 1)$, is precisely the vibrational contribution we derived above.
Albert Einstein (1879–1955)
Einstein's 1907 paper on the specific heat of solids was a triumph of partition function methods. By modeling a solid as $3N$ independent quantum oscillators all at the same frequency, he derived the Einstein heat capacity function that correctly predicts $C_V \to 0$ as $T \to 0$, resolving the classical equipartition catastrophe. Though quantitatively imperfect at very low temperatures (due to the single-frequency assumption), it demonstrated the power of quantum statistical mechanics.
Peter Debye (1884–1966)
Debye improved upon Einstein's model in 1912 by recognizing that a solid has a continuous spectrum of vibrational frequencies up to a cutoff $\nu_D$(the Debye frequency). His model gives $C_V \propto T^3$ at low temperatures, in excellent agreement with experiment. The Debye model remains the standard starting point for understanding the thermal properties of solids.
9. Simulation: Heat Capacity Contributions (Python)
This simulation computes and plots the individual contributions of translational, rotational, vibrational, and electronic modes to the constant-volume heat capacity $C_V/Nk_B$ as a function of temperature for two molecules: N$_2$ (linear diatomic) and H$_2$O (nonlinear triatomic). The rotational partition function for N$_2$is computed by exact summation over $J$ levels, capturing the quantum freeze-out at low temperature. Characteristic temperatures $\Theta_{\text{rot}}$ and$\Theta_{\text{vib}}$ are printed for comparison.
Heat Capacity from Partition Functions: N₂ and H₂O
PythonComputes translational, rotational, vibrational, and electronic contributions to Cv/NkB vs temperature for N₂ and H₂O. Characteristic temperatures and room-temperature values are printed.
Click Run to execute the Python code
Code will be executed with Python 3 on the server
10. Computation: Molecular Partition Functions (Fortran)
This Fortran program computes the translational, rotational, vibrational, and electronic partition functions for five diatomic molecules (N$_2$, O$_2$, CO, HCl, NO) at temperatures from 100 K to 5000 K. It uses exact summation for the rotational partition function at low temperatures and the high-temperature approximation when appropriate. Thermodynamic properties (energy, entropy, free energy) are computed at 298.15 K. Note the difference for NO, which has a doubly degenerate ground electronic state.
Diatomic Partition Functions & Thermodynamics
FortranComputes molecular partition functions (translational, rotational, vibrational, electronic) and thermodynamic properties for N₂, O₂, CO, HCl, and NO across a range of temperatures.
Click Run to execute the Fortran code
Code will be compiled with gfortran and executed on the server
Summary of Partition Functions
| Mode | Partition Function | $C_V/k_B$ (classical) | Characteristic T |
|---|---|---|---|
| Translation | $V/\Lambda^3$ | $3/2$ | $\sim 10^{-15}$ K |
| Rotation (linear) | $T/(\sigma\Theta_{\text{rot}})$ | $1$ | $\sim 1$–$100$ K |
| Rotation (nonlinear) | $\frac{1}{\sigma}\sqrt{\pi T^3/(\Theta_A\Theta_B\Theta_C)}$ | $3/2$ | $\sim 10$–$50$ K |
| Vibration | $1/(1 - e^{-\Theta_{\text{vib}}/T})$ | $1$ per mode | $\sim 1000$–$6000$ K |
| Electronic | $g_0 + g_1 e^{-\varepsilon_1/k_BT} + \cdots$ | Schottky | $\sim 10^4$–$10^5$ K |
Key Takeaways
The partition function $q$ is a sum over Boltzmann-weighted states that encodes all equilibrium thermodynamic information about a molecule.
Under the separability assumption, $q = q_{\text{trans}} \cdot q_{\text{rot}} \cdot q_{\text{vib}} \cdot q_{\text{elec}}$, allowing each contribution to be computed independently.
Characteristic temperatures ($\Theta_{\text{rot}}$, $\Theta_{\text{vib}}$) determine when each mode "thaws" — transitions from quantum freeze-out to classical equipartition.
The thermal de Broglie wavelength $\Lambda$ sets the quantum length scale for translation: when $\Lambda \ll$ the mean intermolecular spacing, classical behavior prevails.
All thermodynamic quantities follow from derivatives of $\ln Q$: energy, entropy, free energy, pressure, chemical potential, and equilibrium constants.