The second law says entropy increases for an isolated system. That's a clean, powerful statement — and almost useless for the actual experiments physicists and chemists run every day. A beaker of reacting chemicals on a lab bench is not isolated. It sits in a room at a fixed temperature, freely trading heat with the air around it, and it's often open to the atmosphere, freely trading volume against a fixed external pressure too. The system you actually care about is only ever part of "the isolated universe" the second law talks about — so what quantity should you actually track, if not the entropy of a system that isn't isolated to begin with?
There is an answer, and it isn't a retreat from the second law — it's the second law, worked out honestly for a system that isn't alone.
Building the right quantity from the second law itself
Consider a system held at fixed temperature by contact with a large reservoir (a room, a water bath — anything big enough that its own temperature doesn't budge), and fixed volume (a rigid, sealed container: no work is done by expansion). The full second law applies to the combined system-plus-reservoir, since that combination really is isolated:
At fixed volume, the system does no work, so whatever energy it gains comes entirely as heat: . Whatever heat flows into the system leaves the reservoir, so , and because the reservoir is so large that this heat exchange happens at its fixed temperature , its entropy change is exactly . Substitute into the second law:
Multiply through by (which is positive, so the inequality flips direction):
The left side is exactly , evaluated for the system alone. Define the Helmholtz free energy:
and the result reads . At fixed temperature and volume, a system evolves so as to decrease its free energy, and sits in equilibrium exactly where is minimized. The second law, which looked like a statement about the entire universe's entropy, has become a statement purely about the system itself — provided you track , not , once the system is embedded in a reservoir rather than isolated.
The identical argument, run at fixed temperature and fixed pressure instead of fixed volume (an open beaker exposed to the atmosphere, rather than a sealed rigid box, so the system can also do work against the surrounding air as it changes volume) produces a close cousin, the Gibbs free energy:
where is the enthalpy. Exactly as with , a system held at fixed and evolves to minimize . The two potentials aren't competing ideas — they're the same construction, applied to two different sets of experimental constraints. Constant volume, sealed container: use . Constant pressure, open to the atmosphere: use . Almost every real chemical reaction happening in an open flask is a -minimization problem; almost every gas confined to a rigid tank is an -minimization problem.
The bridge to the partition function
This is the moment the partition function earns the central role it was given. Recall the Gibbs entropy formula, the natural generalization of Boltzmann's to a system whose microstates aren't all equally likely, only distributed according to some probability :
As a sanity check before using it: if every one of microstates is equally likely, for each, this reduces to — exactly Boltzmann's formula recovered as the special case of equal probabilities.
Now use the actual Boltzmann distribution, , so that . Substitute directly:
The first sum is exactly by definition, and the second sum is since probabilities add up to one. With :
Rearranging, using :
The left side is exactly . So:
The Helmholtz free energy is nothing but the partition function, logarithmed and rescaled. Every thermodynamic quantity this track has built — average energy, entropy, and now free energy — is obtainable from alone by ordinary calculus: , , and itself directly from with no further work.
Worked example
Using the two-level system from the previous topic, with energies and and partition function , find the Helmholtz free energy , then extract the entropy from it. Check the and limits. (click to reveal the solution)
Free energy, directly from :
Extracting entropy, using the general relation just derived, , together with the average energy already found in the previous topic, :
Checking : as , , so . The logarithm term . The first term: blows up in the denominator far faster than the explicit in front shrinks it, so the whole first term as well (an exponential beats any power of ). So — exactly what the third law demands: the system is frozen into its unique, non-degenerate ground state, energy , with and therefore zero entropy.
Checking : as , , so , and the logarithm term . The first term has , so it becomes as . So:
This is exactly the entropy of a two-state system with both states equally likely — accessible microstates, each with probability , giving straight from Boltzmann's original formula. At high temperature, the system stops caring about the energy difference between its two states entirely and populates both equally — the maximum possible entropy a single two-state system can have, recovered here as a limit of the exact free-energy calculation rather than assumed in advance.
Where this leads
Free energy is the tool that finally makes the second law usable in the lab, not just in a textbook proof about isolated universes — and the identity means every free-energy calculation is, underneath, just a partition-function calculation. One loose thread remains, and it's been sitting in plain sight since the very first topic in the quantum track of this curriculum: angular momentum and spin and quantum field theory both promised that spin determines whether a particle is a boson or a fermion, and both left the consequence of that distinction unexplored. It turns out bosons and fermions don't just differ in a quantum number — they populate energy levels according to two completely different statistical distributions, and the final topic in this track derives exactly what those distributions are, and exactly how the Boltzmann distribution built here turns out to be a special limiting case of both.