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 averages (); 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: every macroscopic quantity is a derivative of ().
- Internal energy is ; the Helmholtz free energy is the single most economical bridge to thermodynamics.
- Entropy, pressure, and chemical potential are first derivatives of : , , , 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 first derivatives are the averages and its second derivatives are the fluctuations and response functions.
All of equilibrium thermodynamics is encoded in one scalar, . First derivatives generate the averages — , and from via — while second derivatives generate the fluctuations and response functions (). The extraction is self-consistent by the Gibbs–Helmholtz identity.
The physical picture
Picture as a single smooth surface floating over the space. Nothing else is needed: the slope of that surface along is the average energy, the slope along is (up to ) the pressure, the slope along is the chemical potential, and the curvature along is the energy variance — which is the heat capacity. 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 , the microscopic force, whose average is minus 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 is 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 -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 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 state functions 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 averages. 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. *Verified: equals and all confirmed symbolically in verify_aq-sm-thermodynamics-from-partition-function.py.*
The goal is to run the complete extraction machine once, on the monatomic ideal gas, so that a single delivers all four state functions 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 replaces by to keep extensive, 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: of leaves , which combines with the explicit to give the compact — the chemical potential measures the free-energy cost of adding one particle, negative because there is entropic room for it. *Verified: , , (the ), and all confirmed symbolically; argon at , gives in the verify script.*
Limiting cases
The extraction recipe in informative regimes:
| Case | Result | Meaning |
|---|---|---|
| High temperature | : , , | 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 . |
It is tempting to write by analogy with mechanics, but in the canonical ensemble that is wrong. Pressure is minus the derivative of the free energy at fixed temperature, — not of the internal energy. The two differ by a term, which for a real system is not negligible: for the ideal gas entirely (energy is volume-independent), so would give zero pressure, an absurdity. The pressure comes wholly from the entropy's volume dependence — the gas pushes out because more volume means more accessible microstates, not because expanding lowers its energy. The general rule: every conjugate variable is a derivative of the potential whose natural variables include the one you hold fixed. Hold fixed → differentiate . Hold fixed → differentiate . Mixing them up is the single most common sign-and-factor error in the whole recipe. The same warning applies to : it is , not a derivative of .
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.
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 partitions the total probability among 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.
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 plus phonon partition functions predict phase diagrams by locating where two 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 -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 .
Check yourself
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).
Provenance. The extraction relations (, , , , , ) and the Gibbs–Helmholtz identity are standard (Pathria Ch. 3; Kardar Ch. 4). A verifier should reproduce: the ideal-gas chain , , the Sackur–Tetrode , and ; the self-consistency loop and ; and the two-level . Numerical instances for argon at , (, , , , ) and the two-level value at are recomputed in verify_aq-sm-thermodynamics-from-partition-function.py. , , (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.