Thermodynamic Quantities from the Partition Function
Thermodynamics gives you a web of relations — , Maxwell relations, response functions — but it never tells you the value of anything. It cannot predict the pressure of argon at or the entropy of a mole of neon; those numbers have to be measured and fed in. Statistical mechanics closes that gap with a single object. Once you know the energy spectrum of a system and form the canonical partition function , every thermodynamic quantity becomes a derivative of — a fixed, mechanical recipe with no further physics required. This article is that recipe. The cleanest bridge is the Helmholtz free energy . Because , the natural variables of are exactly — the variables already depends on — so entropy, pressure, and chemical potential are each a single partial derivative. Internal energy comes even more directly as . First derivatives give the thermodynamic observables (); second derivatives give the widths of the distributions and the response coefficients, the archetype being . The article's owned result is that all four state functions descend from one scalar and that the extraction is self-consistent: the Gibbs–Helmholtz identity recovers , and agrees with — the loop closes symbolically. We run the whole machine on the monatomic ideal gas end to end: spectrum in, and out come , , the Sackur–Tetrode entropy with its , and . Every number here is python-verified.
- The canonical partition function is the generating function of equilibrium thermodynamics: thermodynamic quantities can be obtained from and its derivatives ().
- Internal energy is ; the Helmholtz free energy is the single most economical bridge to thermodynamics.
- Entropy, pressure, and chemical potential are first derivatives of , with the appropriate natural variables held fixed: , , , matching .
- Second derivatives give fluctuations and response: is the prototype fluctuation–response relation.
- The recipe is self-consistent (Gibbs–Helmholtz closes the loop) and modular (open the system → replace by , by ; the derivative machine is identical).
- Key idea: one scalar function generates all of equilibrium thermodynamics — its derivatives yield the thermodynamic observables and its second derivatives are the fluctuations and response functions.
All of equilibrium thermodynamics is encoded in one scalar, . Derivatives generate the thermodynamic quantities — , and from via — while second derivatives generate the fluctuations and response functions (). The extraction is self-consistent by the Gibbs–Helmholtz identity.
Where this lives today
The extraction machine is the daily workhorse of computational thermodynamics. In quantum chemistry and chemical engineering, molecular partition functions — factorized into translational, rotational, vibrational, and electronic pieces and assembled from spectroscopic constants — are differentiated exactly as in this article to tabulate standard entropies, enthalpies, Gibbs energies, and equilibrium constants; the JANAF and NIST thermochemical tables are, at bottom, vast collections of derivatives. In materials science, first-principles free energies from density-functional theory combined with phonon contributions can be used to predict phase boundaries by locating where the relevant free-energy surfaces cross. The same recipe scales to the largest simulations in science. Lattice quantum chromodynamics computes the equation of state of hot nuclear matter — the pressure and entropy of the quark–gluon plasma probed at RHIC and the LHC — as numerical - and -derivatives of a partition function that is a very high-dimensional path integral. And in machine learning, the "free energy" of an energy-based model (a Boltzmann machine, a diffusion model's score) is exactly the quantity whose gradients drive training; the intractability of that Gibbs never had to confront numerically is now the central computational bottleneck of the field. Wherever a system is described by an energy function and a temperature, the road from micro to macro still runs through the derivatives of .
The physical picture
Picture as a single smooth surface floating over the space. Nothing else is needed: the negative slope of that surface along is the average energy, the slope along , multiplied by , is the pressure, the slope along multiplied with is the chemical potential, and the curvature along is the energy variance — which is related to the heat capacity by . Thermodynamics is the differential geometry of this one surface. That is the whole content of the subject once is known. Why does a slope of give an average? Purely mechanically: differentiating with respect to pulls a factor out of each term, and dividing by turns the sum into a Boltzmann-weighted average, . Every formula in this article is this same trick applied to a different variable — differentiate with respect to instead and you pull out , whose negative is the microscopic generalized force; its average gives the pressure.
There is a deeper reason first and second derivatives split so cleanly into "averages" and "widths." Because is the logarithm of a sum of exponentials, it is the cumulant-generating function of the energy distribution: its -th -derivative gives, up to the alternating sign , the -th cumulant of . The first cumulant is the mean, ; the second is the variance, ; and no fresh assumption is needed — averages and fluctuations live in the same object because they are successive derivatives of it. The punchline plot below shows the payoff: for the ideal gas, one curve simultaneously delivers (its negative -slope), (its -slope of ), and (its curvature) — four thermodynamic quantities read off one graph.
The core equations
Everything begins with one sum. The canonical partition function collects the Boltzmann weight of every microstate, or equivalently every energy level weighted by its degeneracy . It is the normalization that makes the probabilities sum to one, and it is the generating object for all that follows.
where: — canonical partition function (dimensionless); — energy of microstate , which depends on and ; — degeneracy / density of states at energy . The dependence of the levels on volume is what makes pressure computable. The internal energy is the negative first -derivative of . This is the mechanical trick in its purest form: differentiating brings down a factor of energy and dividing by averages it.
where: — internal energy. The second form follows from (chain rule for ), and is the version to use when your is written in terms of . The Helmholtz free energy is the single bridge from which , , and all descend, because its differential exactly matches the variables depends on.
where: — Helmholtz free energy. Reading off the three partials gives the master trio: , , — the pressure and chemical potential carry no explicit prefactor when written through ; they do when written directly through . Written directly through , the same three quantities are:
where: — entropy; — pressure; — chemical potential. The entropy form is rewritten: . Every equilibrium quantity is now a derivative of the one scalar . Second derivatives generate fluctuations and response. The archetype links the energy variance (a property of the equilibrium ensemble) to the heat capacity (how the system responds to heating):
where: — heat capacity at constant volume. Because a variance is non-negative, this forces : thermal stability is guaranteed by statistics, and relative fluctuations shrink as .
This is the article's owned result. The claim is stronger than "you can compute thermodynamics from ": it is that the four thermodynamic quantities are literally derivatives of the single scalar , and that the extraction is internally consistent — the two routes to (directly as , and thermodynamically via the Gibbs–Helmholtz identity from ) must agree, and the two routes to (as and as ) must agree. The goal is to assemble the table and then prove the loop closes, so the recipe cannot be self-contradictory. The strategy: define , read off its partials, then verify the Gibbs–Helmholtz round-trip recovers Eq. (2).
Step 1. Assemble the four thermodynamic quantities. From with : , , , . Why: 's natural variables are , exactly what depends on, so each conjugate variable is one clean partial — no Legendre transform or extra input required.
Step 2. Check the two roads to meet. The thermodynamic definition gives , using from Eq. (2). This is identical to . Why: the product rule on produces one term that is and one that is exactly — the entropy formula is not an independent postulate but a consequence of the definitions.
Step 3. Close the Gibbs–Helmholtz loop for . Write (since ). Differentiate with respect to at fixed : . So , and equivalently . Why: this is the Gibbs–Helmholtz relation; it reproduces the direct definition from the free energy alone, proving the two definitions of are one and the same.
Step 4. Conclude self-consistency. The two independent routes to agree (Step 3) and the two routes to agree (Step 2); and each have a single definition. Therefore the map is well-defined and cannot contradict itself: it is one scalar generating four mutually consistent state functions. Why: a recipe that computes the same quantity two ways and gets two answers would be worthless — the closed loop is what certifies that deserves to be called the generating function of thermodynamics.
Go deeper · Derivation B · 2 minThe whole ideal gas from its spectrum: PV=Nk_BT, U=3/2 Nk_BT, Sackur-Tetrode S, and mu
The goal is to run the complete extraction machine once, on the monatomic ideal gas, so that a single delivers all four thermodynamic quantities with their exact numerical prefactors — the ideal-gas law, the equipartition energy, the Sackur–Tetrode entropy with its characteristic , and the chemical potential . This is the concrete payoff of the master table: no separate derivation for each quantity, just four derivatives of one function. The strategy is to compute the single-particle , factorize with the Gibbs , and differentiate term by term.
Step 1. Build . With the single-particle partition function is , , so and using Stirling. Note , so contains . Why: the Gaussian momentum integral gives , the Gibbs factor accounts for particle indistinguishability and ensures the correct extensive thermodynamic limit, and isolating the -dependence in is what makes the temperature derivatives trivial.
Step 2. Energy and pressure. , so . And , i.e. . Why: only the term carries temperature (giving equipartition, per momentum degree of freedom) and only the term carries volume (giving the ideal-gas law) — each state function reads off its own term.
Step 3. Entropy. — the Sackur–Tetrode form. The from combines with the from Stirling to make the famous . Why: the is not arbitrary — it is exactly (Gibbs correction) plus (three translational half-degrees), a fingerprint of monatomic translational motion counted correctly.
Step 4. Chemical potential. , with . Since a classical gas is dilute, , so (strongly negative). Why: differentiating with respect to gives , since the generated by differentiating is cancelled by the derivative of the explicit — the chemical potential measures the free-energy cost of adding one particle, negative because there is entropic room for it. *As a numerical check: argon at , gives , consistent with the Sackur–Tetrode formula derived above.*
Limiting cases
The extraction recipe in informative regimes:
| Case | Result | Meaning |
|---|---|---|
| High temperature | : , , | For a finite state space, all states equally weighted; entropy saturates at . |
| Low temperature | : , , | Ground level dominates; residual entropy (third law if ). |
| Independent modes | all additive over modes; extensivity automatic. | |
| Open system | , | Same machine: , . |
| Ideal gas | , , = Sackur–Tetrode | The full worked example; four state functions from one . |
Worked examples
1 · The full ideal gas: argon at room conditions (a real number, four ways)
Take one mole of argon () at occupying (about ). Compute, from the one , the pressure, internal energy, molar entropy, and chemical potential — and check they are mutually consistent through .
Step 1. Thermal wavelength: , so — indeed , the gas is safely classical.
Step 2. Pressure and energy from the derivatives: , and (with ). These used only and .
Step 3. Entropy from : … wait, carefully , so — the measured standard molar entropy of argon.
Step 4. Chemical potential and the consistency check: per atom, i.e. — strongly negative, as expected for a dilute gas. Finally , and independently — the two ways to get agree, closing the loop numerically.
2 · The two-level system: energy from ln Z (exam level)
A system of independent, distinguishable two-level units has a gap (levels and ). Use only the extraction recipe to find , and evaluate it at .
Step 1. Spectrum → : each unit has , so (distinguishable lattice sites, no ).
Step 2. Apply : .
Step 3. Boundary values: as (), (all in the ground state); as (), (both levels equally full). The energy saturates — it cannot exceed , unlike a gas.
Step 4. At we have , so . The system holds only of its maximum energy when the thermal scale equals the gap — the same recipe that gave the ideal gas gives a bounded, saturating system with no change of method.
Origins · 1 minpartition function and how this was discovered
The partition function is the hinge on which statistical mechanics turns: the object that converts a microscopic list of energies into every macroscopic thermodynamic number. Its name is a translation of the German Zustandssumme — "sum over states" — which is why it is universally denoted . J. Willard Gibbs gave it its modern, general role in his 1902 treatise Elementary Principles in Statistical Mechanics, where he showed that this single sum over the microstates of a system in a heat bath is a complete thermodynamic potential in disguise: differentiate its logarithm and out fall the energy, entropy, free energy, pressure, chemical potential, and all the fluctuations. The word "partition" reflects its dual job — it normalizes the Boltzmann weights to give the probabilities of the microstates (via ) and it sums their Boltzmann weights. What makes it the central object of the whole field is precisely the theme of this article: thermodynamics is not a separate science bolted onto mechanics but the calculus of . The same construction reappears everywhere — as the Euclidean path integral of quantum field theory, as a transfer-matrix trace in lattice models, and as the (notoriously intractable) normalizing constant of probabilistic machine-learning models. Master how , , , and descend from and you have mastered the core computational skill of statistical physics.
Going further
References. Pathria & Beale, Statistical Mechanics, 3rd ed., Ch. 3 · Kardar, Statistical Physics of Particles, Ch. 4 · Reif, Fundamentals of Statistical and Thermal Physics, Ch. 6 · Sethna, Statistical Mechanics: Entropy, Order Parameters, and Complexity, Ch. 6 · Callen, Thermodynamics, Ch. 16 · Gibbs, Elementary Principles in Statistical Mechanics (1902). The extraction relations (, , , , , ) and the Gibbs–Helmholtz identity are standard results of canonical statistical mechanics. Key results to keep in mind: the ideal-gas chain , , the Sackur–Tetrode , and ; the self-consistency loop and ; and the two-level result . Numerical values for argon at , : , , , , ; two-level value at . Constants , , (CODATA).
Builds on: Canonical Ensemble · Canonical Partition Function · Boltzmann Factor. Leads to: Helmholtz Free Energy from the Partition Function · Energy Fluctuations in the Canonical Ensemble · Heat Capacity and Fluctuation-Response Relation · Grand Potential.
Why is the free energy F, and not the energy U, the "master" potential to differentiate?
Because 's natural variables are — precisely the variables the partition function depends on. Thermodynamics says , so if you know you get , , and as three clean partial derivatives. The internal energy , by contrast, has natural variables ; to get from you must hold entropy fixed, which is experimentally awkward and not what hands you. Since the canonical ensemble fixes (not ), the free energy is the potential that matches the control variables. This is a general lesson: pick the thermodynamic potential whose natural variables are the ones you actually hold constant, and every conjugate quantity becomes a single derivative.
How can one function ln Z give both averages and fluctuations?
Because , viewed as a function of , is the cumulant-generating function of the energy distribution. Differentiating it with respect to once gives the first cumulant (the mean ), twice gives the second cumulant (the variance ), three times gives the third, and so on — this is the mathematical definition of a cumulant generator, and of a sum of exponentials is exactly one. Physically, the first derivative tracks how the average energy shifts as you cool the system (a response), and the second tracks how much the energy spontaneously jitters at fixed temperature (a fluctuation). Because they are consecutive derivatives of the same object, the fluctuation and the response turn out to be equal up to factors of — that is the fluctuation–response theorem, , built straight into the structure of .
Do I use β-derivatives or T-derivatives — they look different?
They are the same thing through the chain rule, and you should use whichever matches how your is written. Since , we have . So becomes ; both give the identical energy. If your partition function comes out naturally in (common for oscillators and two-level systems, where or ), use . If it comes out in (common for the ideal gas, where and contains ), use . The two conventions differ only by the factor , and mixing them up (forgetting that factor, or its sign) is a frequent slip — the sign is negative because raising lowers .
Why does the chemical potential of a classical gas come out negative?
Because and a classical gas is dilute, meaning , so the logarithm is a large negative number. Physically, is the free-energy cost of adding one more particle at fixed and . Adding a particle to a dilute gas raises the entropy a lot (there is plenty of empty phase space for it), and since , a large entropy gain means a large decrease in free energy — hence a negative . The quantity is the "phase-space occupancy": it compares the interparticle spacing to the thermal de Broglie wavelength. When it approaches , and quantum statistics take over; the gas is on the verge of degeneracy. So the sign and size of are a direct readout of how far a gas is from the quantum regime.
Is this recipe exact, or does it assume the thermodynamic limit?
The derivative relations themselves — , , , and so on — are exact for any system in the canonical ensemble, of any size, with no thermodynamic-limit assumption. What does require large is the interpretation of these ensemble averages as sharp thermodynamic values. For small systems the energy genuinely fluctuates by a relative amount , so "the" energy is only well-defined up to that spread. For a mole () the spread is one part in — utterly negligible — so the canonical is indistinguishable from a fixed number and matches the microcanonical result. The recipe is thus exact as a statement about averages, and becomes a statement about definite thermodynamic quantities only when is large enough to suppress fluctuations. This is also why ensembles become equivalent in the thermodynamic limit.
Where did the ground-state energy go — does the zero of energy matter?
For most quantities it does not, and for a few it does, so be consistent. If you shift every energy by a constant , then and . This changes by and by (as it must — you moved the origin), but it leaves the heat capacity, entropy, pressure, and all fluctuations completely unchanged, because those are derivatives that annihilate a constant. So for computing , , or you may set the ground state to zero and forget . Where it matters is any absolute energy or free energy that you compare across systems: chemical equilibrium constants depend on the real energy difference between reactant and product ground states, and the zero-point energy of each vibrational mode is a genuine contribution. The rule: differences are physical, the overall zero is a convention, but be consistent whenever you compare two systems.
How does this canonical recipe carry over to open systems?
It carries over essentially unchanged, with two substitutions. When the system can exchange particles as well as energy with a reservoir, you replace the canonical partition function by the grand partition function , and the Helmholtz free energy by the grand potential . The derivative machine is identical: , so entropy, pressure, and now the average particle number are single derivatives of . Second derivatives give the new fluctuation: , the exact analogue of . So learning the canonical recipe is not a special case — it is the template, and opening the system to particle flow just adds one more control variable () and one more fluctuation () to the same scheme.