See also: Course-wide Conventions & Notation
Run the code: Notebook for Section 5.1, in which you can change and rerun the Python cells of this section in your browser.
The course map shows where this module sits in the course and which relations connect the microscopic and macroscopic descriptions. Select a module to unfold its sections.

Overview and Learning Objectives¶
In Section 4.3 we derived the canonical entropy and showed that rearranging it gives the Helmholtz free energy . We noted that this makes a “master potential” — if you can compute , you can derive all other thermodynamic quantities by taking appropriate derivatives. This section develops that machinery.
We begin by combining the Clausius inequality (Section 4.3) with the First Law to obtain a fundamental inequality, , that governs the direction of spontaneous change. From this single inequality we derive extremum principles: rules for which thermodynamic potential (, , , or ) is minimized at equilibrium under a given set of constraints. These potentials are related to one another by Legendre transforms that swap “awkward” natural variables (like ) for experimentally controllable ones (like ).
With the potentials and their differentials in hand, we can read off measurable quantities as partial derivatives. In particular, we derive the pressure formula that was previewed in Section 2.3, and we show that changes in the Gibbs free energy track reversible non- work under typical laboratory conditions.
Learning objectives:
Derive the fundamental inequality from the Clausius inequality.
Identify the natural variables and equilibrium differentials of , , , and .
State which thermodynamic potential is minimized at equilibrium under fixed , , , and .
Use (Section 4.3) to derive the pressure formula .
Interpret as reversible non- work.
Core Ideas and Derivations¶
The Fundamental Inequality¶
In Section 4.1 we derived the fundamental thermodynamic relation,
It holds for any infinitesimal change between equilibrium states of a closed system with only work, whether the change is reversible or not. It does not say in which direction a system changes, and it does not describe a system in which an irreversible process such as a chemical reaction, the mixing of two substances, or a phase change is under way. For that we need the Clausius inequality (Section 4.3),
in which is the temperature at which the heat is transferred to the system. The inequality says that entropy can be produced by irreversibility beyond the entropy carried in by heat flow. Rearranging gives .
For a closed system with only work, the First Law reads with . Substituting gives
Now suppose that the system is in thermal and mechanical equilibrium with its surroundings, so that the heat is transferred at the temperature of the system and . The system need not be in equilibrium internally. We then arrive at the fundamental inequality:
Equality holds when every change in the system is reversible. The strict inequality holds when an irreversible process takes place inside the system, and it gives the direction of spontaneous change.
Thermodynamic Equilibrium as an Extremum Principle¶
Equation (5.1.4) gives an “equilibrium test” once you specify what is held fixed. The idea is simple: if certain variables are constant, the inequality constrains what happens to the remaining ones.
Constant and ⇒ Minimize ¶
If and are both fixed, then and , so (5.1.4) reduces to
At constant and , spontaneous evolution drives downward until equilibrium is reached at a minimum of .
Identifying and from Derivatives of ¶
Since the fundamental relation at equilibrium is , we can read off
These partial-derivative identities are the natural-variable counterparts of the differential form. In Section 4.1 we noted that a state function’s natural variables are those that appear as independent variables in its total differential; for , these are and . The expressions above show that the conjugate intensive variables ( and ) are encoded as slopes of along its natural-variable axes.
Euler’s Theorem and the Euler Relation¶
Many thermodynamic functions are homogeneous in their extensive variables. If a function is homogeneous of degree — meaning for all — then Euler’s theorem states
The internal energy is homogeneous of degree 1 in its extensive arguments only when the number of particles is counted among them: doubling , , and together doubles , whereas doubling and at fixed does not. We therefore write and apply Euler’s theorem with :
Equation (5.1.8) is the Euler relation. The derivative is the chemical potential, which Section 6.1 develops. With the Gibbs free energy defined below, the Euler relation reads .
Thermodynamic Potentials¶
Holding or constant is experimentally awkward — most laboratory work is done at controlled and/or controlled . Nor is a laboratory system usually isolated: the Second Law of Section 4.2 is stated for the total entropy of an isolated system, whereas a system held at constant temperature exchanges heat with its surroundings. The solution is to define new state functions whose natural variables match the experimentally convenient ones. This is the same strategy we used in Section 3.3 when we defined enthalpy to simplify the First Law at constant pressure; now we extend it systematically.
Each new potential is obtained from by a Legendre transform: a mathematical operation that swaps an extensive variable for its conjugate intensive variable while preserving all thermodynamic information. For example, replacing the natural variable in with its conjugate gives the Helmholtz free energy .
Summary Table¶
| potential | symbol | definition | differential (equilibrium) | natural variables |
|---|---|---|---|---|
| internal energy | — | |||
| enthalpy | ||||
| Helmholtz free energy | ||||
| Gibbs free energy |
Each differential can be verified by direct computation. For example, for the Helmholtz free energy:
The other differentials follow by the same approach.
Which Potential Is Minimized?¶
Each thermodynamic potential satisfies an inequality analogous to Eq. (5.1.4), derived by applying the same fundamental inequality to the appropriate Legendre-transformed quantity. The results are:
Constant : ⇒ decreases to a minimum.
Constant : ⇒ decreases to a minimum.
Constant : ⇒ decreases to a minimum.
Constant : ⇒ decreases to a minimum.
Deriving the and Inequalities
Figure 5.1.1 collects the Summary Table and the four extremum principles.
Source
import sys
sys.path.append("..") # the book folder, which holds figstyle
import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch
import figstyle as fs
# position, symbol with natural variables, name, variables held fixed at the minimum
boxes = {
"U": ((0.0, 1.0), r"$U(S,V)$", "internal energy", r"minimum at fixed $S$, $V$"),
"H": ((1.0, 1.0), r"$H(S,P)$", "enthalpy", r"minimum at fixed $S$, $P$"),
"A": ((0.0, 0.0), r"$A(T,V)$", "Helmholtz free energy", r"minimum at fixed $T$, $V$"),
"G": ((1.0, 0.0), r"$G(T,P)$", "Gibbs free energy", r"minimum at fixed $T$, $P$"),
}
w, h = 0.58, 0.44
def draw(c):
fig, ax = plt.subplots(figsize=(6.4, 3.9), constrained_layout=True)
for (x, y), symbol, name, fixed in boxes.values():
ax.add_patch(FancyBboxPatch((x - w / 2, y - h / 2), w, h, boxstyle="round,pad=0.02,rounding_size=0.035",
fc=c.fill, ec="none"))
ax.text(x, y + 0.10, symbol, ha="center", va="center", fontsize=fs.BASE + 5)
ax.text(x, y - 0.045, name, ha="center", va="center")
ax.text(x, y - 0.145, fixed, ha="center", va="center", fontsize=fs.BASE - 0.5, color=c.note)
# Horizontal transforms replace V by P; vertical transforms replace S by T
for y in (1.0, 0.0):
fs.arrow(ax, (w / 2 + 0.05, y), (1 - w / 2 - 0.05, y), c.blue, lw=2, scale=16)
ax.text(0.5, y + 0.05, r"$+PV$", ha="center", va="bottom", fontsize=fs.BASE + 2, color=c.blue)
ax.text(0.5, y - 0.06, r"$V \rightarrow P$", ha="center", va="top", fontsize=fs.BASE - 0.5, color=c.blue)
for x in (0.0, 1.0):
fs.arrow(ax, (x, 1 - h / 2 - 0.05), (x, h / 2 + 0.05), c.vermilion, lw=2, scale=16)
ax.text(x + 0.03, 0.5, r"$-TS$", ha="left", va="center", fontsize=fs.BASE + 2, color=c.vermilion)
ax.text(x - 0.03, 0.5, r"$S \rightarrow T$", ha="right", va="center", fontsize=fs.BASE - 0.5, color=c.vermilion)
ax.set_xlim(-0.36, 1.36)
ax.set_ylim(-0.3, 1.3)
ax.axis("off")
return fig
fs.show(draw, alt="Diagram of the four thermodynamic potentials U(S,V), H(S,P), A(T,V) and G(T,P) at the corners "
"of a square. Horizontal arrows labeled +PV lead from U to H and from A to G. Vertical arrows "
"labeled -TS lead from U to A and from H to G.")Figure 5.1.1:The four thermodynamic potentials and the Legendre transforms that connect them. Each horizontal arrow adds and replaces the natural variable by ; each vertical arrow subtracts and replaces by . Below each potential are the variables that are held fixed when it is minimized at equilibrium.
These extremum principles are immensely practical. Most chemistry and biology occurs at constant temperature (thermostatted lab or regulated body temperature) and either constant volume (rigid container, computational simulation) or constant pressure (open to the atmosphere). Under these conditions:
Constant : the Helmholtz free energy is minimized at equilibrium.
Constant : the Gibbs free energy is minimized at equilibrium.
The first of these two statements is illustrated below with two gases separated by a piston, a system in which the minimum of can be located.
The Helmholtz Free Energy as a Master Potential¶
Section 4.3 established the central connection between the canonical partition function and thermodynamics:
From this single equation, combined with the Helmholtz differential , we can extract every equilibrium property of the system by differentiation.
Entropy¶
Reading off the coefficient of in the Helmholtz differential:
This is consistent with the canonical entropy expression derived in Section 4.3, as can be verified by differentiating Eq. (5.1.13) directly.
Pressure¶
Reading off the coefficient of :
Substituting :
This is the result previewed (without derivation) in Section 2.3. The route is now clear: the Helmholtz differential tells us that pressure is , and the partition-function bridge converts that into a derivative of .
Internal Energy¶
From and the expressions above:
After simplification (or using the result of Section 2.3 directly):
Heat Capacity¶
Takeaway. Knowing gives access to , , , , and the equation of state — all from derivatives of a single function.
Example: Monatomic Ideal Gas¶
To see the derivative machinery in action, we return to a system whose partition function we derived in Section 2.5. For a monatomic ideal gas:
Helmholtz Free Energy¶
Using Eq. (5.1.13):
Applying Stirling’s approximation ():
Pressure (Recovering the Ideal Gas Law)¶
From Eq. (5.1.16), and noting that depends on only through the term:
The microscopic translational partition function reproduces the macroscopic equation of state. This was also shown in Section 2.5 using the pressure formula stated in Section 2.3; the difference is that we can now trace its origin through the Helmholtz free energy.
Entropy (the Sackur–Tetrode Equation)¶
From Eq. (5.1.14), noting that so :
This is the Sackur–Tetrode equation for the entropy of an ideal monatomic gas — a result that connects statistical mechanics (through and ) to a measurable thermodynamic quantity.
Minimum of : Two Gases Separated by a Piston¶
Equation (5.1.22) also provides an example of the extremum principle at constant and . A rigid box of volume is in contact with a heat bath at temperature . A movable piston divides the box into two compartments, which hold and atoms of ideal gas in the volumes and (panel (a) of Figure 5.1.2). The temperature, the total volume, and the numbers of atoms are fixed, but is not, so the system is in general not in equilibrium internally. Its Helmholtz free energy is the sum of the free energies of the two gases, and by Eq. (5.1.22) it depends on as
Panel (b) of Figure 5.1.2 shows this function for of gas 1 and of gas 2 at . It has a single minimum. By Eq. (5.1.15), applied to each gas,
so the minimum lies where the two pressures are equal, which for these amounts is . From any other position, the piston moves toward the side with the lower pressure, and decreases until the minimum is reached.
Source
import sys
sys.path.append("..") # the book folder, which holds figstyle
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from scipy.constants import R
import figstyle as fs
# Two ideal gases in a rigid box at fixed T, separated by a movable piston
T = 298.15 # K
n1, n2 = 1.0, 2.0 # mol
x_eq = n1 / (n1 + n2) # V_1/V at which the two pressures are equal
x_p = 0.60 # V_1/V of the piston position that is drawn
def dA(x):
"""A(x) - A(x_eq) in kJ, from the V dependence of A for each ideal gas."""
return -R * T * (n1 * np.log(x / x_eq) + n2 * np.log((1 - x) / (1 - x_eq))) / 1000
def draw(c):
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(fs.WIDTH, 3.2), constrained_layout=True,
gridspec_kw={"width_ratios": [1, 1.15]})
# (a) The system, drawn with the piston away from its equilibrium position
rng = np.random.default_rng(5020)
ax1.add_patch(Rectangle((-0.06, -0.08), 1.12, 0.76, fc=c.fill, ec="none")) # heat bath
ax1.add_patch(Rectangle((0, 0), 1, 0.6, fc=c.ground, ec=c.ink, lw=1.5)) # rigid box
ax1.add_patch(Rectangle((x_p - 0.012, 0), 0.024, 0.6, fc=c.muted, ec=c.ink, lw=0.8)) # piston
ax1.scatter(rng.uniform(0.03, x_p - 0.04, 9), rng.uniform(0.04, 0.56, 9), s=30, color=c.blue, lw=0)
ax1.scatter(rng.uniform(x_p + 0.04, 0.97, 18), rng.uniform(0.04, 0.56, 18), s=30, color=c.vermilion, lw=0)
fs.arrow(ax1, (x_p - 0.03, 0.30), (x_p - 0.20, 0.30), c.ink, lw=1.6, scale=14)
ax1.text(x_p / 2, 0.71, r"gas 1: $N_1$, $V_1$", ha="center", va="bottom", color=c.blue)
ax1.text((1 + x_p) / 2, 0.71, r"gas 2: $N_2$, $V - V_1$", ha="center", va="bottom", color=c.vermilion)
ax1.text(x_p, -0.03, "piston", ha="center", va="top", fontsize=fs.BASE - 1)
ax1.text(0.5, -0.17, r"heat bath at temperature $T$", ha="center", va="top", fontsize=fs.BASE - 1, color=c.muted)
ax1.set_xlim(-0.1, 1.1)
ax1.set_ylim(-0.3, 0.87)
ax1.set_aspect("equal")
ax1.axis("off")
fs.panel(ax1, "a", "Fixed $T$ and $V$")
# (b) Helmholtz free energy as a function of the piston position
x = np.linspace(0.04, 0.9, 400)
ax2.plot(x, dA(x), "-", color=c.ink)
ax2.plot(x_eq, 0, "o", color=c.ink, ms=6.5, zorder=3)
ax2.plot(x_p, dA(x_p), "o", mfc=c.ground, mec=c.ink, ms=6.5, zorder=3)
ax2.annotate(r"$P_1 = P_2$", (x_eq, 0), xytext=(0, 12), textcoords="offset points", ha="center")
for xa, xb in ((x_p - 0.02, x_p - 0.14), (0.3 * x_eq, 0.6 * x_eq)):
ax2.annotate("", xy=(xb, dA(xb) + 0.25), xytext=(xa, dA(xa) + 0.25),
arrowprops=dict(arrowstyle="-|>", color=c.muted, lw=1.3))
ax2.text(x_eq, 1.55, "spontaneous\n" + r"$dA < 0$", ha="center", color=c.muted)
ax2.text(0.14, -0.42, r"$P_1 > P_2$", ha="center", fontsize=fs.BASE - 1, color=c.muted)
ax2.text(0.72, -0.42, r"$P_1 < P_2$", ha="center", fontsize=fs.BASE - 1, color=c.muted)
ax2.set_xlabel(r"Volume fraction of gas 1, $V_1/V$")
ax2.set_ylabel(r"$A - A_{\mathrm{min}}$ (kJ)")
ax2.set_xlim(0, 1)
ax2.set_ylim(-0.6, 3.2)
fs.panel(ax2, "b", "Helmholtz free energy")
return fig
fs.show(draw, alt="Two panels. Panel a: a rigid box in a heat bath, divided by a piston into gas 1 on the left and "
"gas 2 on the right, with an arrow that shows the piston moving left. Panel b: the Helmholtz free "
"energy relative to its minimum against the volume fraction of gas 1, a curve with a single "
"minimum at one third, where the two pressures are equal.")Figure 5.1.2:Two ideal gases in a rigid box at fixed temperature, separated by a movable piston. (a) The system, drawn with the piston at , where . (b) The Helmholtz free energy relative to its minimum as a function of , for of gas 1 and of gas 2 at . The open circle marks the position drawn in (a) and the filled circle marks equilibrium, where .
Gibbs Free Energy and Non- Work¶
The Gibbs free energy is defined as
Its equilibrium differential is
But what if the system can do work other than expansion/compression — for example, electrical work in a battery or an electrolyzer? To see how handles this, consider a reversible process that includes both work and non- work. The First Law gives
Substituting into :
At constant and :
Under the most common laboratory conditions (constant and ), changes in equal the reversible non- work. This is why is sometimes called the “free energy” — it measures the energy “free” to do useful work beyond unavoidable work against the atmosphere.
Equation (5.1.31) applies to the reversible limit. Repeat the derivation for a process at constant and that is not reversible: write the First Law as and use the Clausius inequality, , in place of . Which relation between and results? Recall that for work done by the system, and consider what the relation says about a spontaneous process that delivers work.
Example: Water Splitting (Electrolysis)¶
The standard-state water-splitting reaction at room temperature is
Because , the reaction is non-spontaneous under standard conditions. It must be driven by supplying non- work — in this case, electrical work in an electrolyzer. In the reversible limit, the minimum electrical work required per mole equals .
The enthalpy change of the reaction, , is larger than . At constant and , , and in the reversible limit . The electrolyzer therefore supplies as electrical work, and the remaining is absorbed as heat from the surroundings (Figure 5.1.3).
Source
import sys
sys.path.append("..") # the book folder, which holds figstyle
import matplotlib.pyplot as plt
import figstyle as fs
# H2O(l) -> H2(g) + 1/2 O2(g) at 298.15 K and 1 bar (NIST-JANAF values)
T = 298.15 # K
dH = 285.83 # kJ/mol, -Delta_f H(H2O, l)
dS = 130.680 + 0.5 * 205.147 - 69.95 # J/(mol K)
TdS = T * dS / 1000 # kJ/mol
dG = dH - TdS # kJ/mol
def draw(c):
total = c.tint(c.gray, 0.55)
fig, ax = plt.subplots(figsize=(fs.WIDTH, 2.5), constrained_layout=True)
edge = dict(height=0.55, ec=c.ground, lw=1.2)
ax.barh(1, dH, color=total, **edge)
ax.barh(0, dG, color=c.blue, **edge)
ax.barh(0, TdS, left=dG, color=c.vermilion, **edge)
ax.text(dH / 2, 1, rf"$\Delta H°$ = {dH:.1f}", ha="center", va="center", color=fs.on(total))
ax.text(dG / 2, 0, rf"$\Delta G°$ = {dG:.1f}" + "\nminimum electrical work", ha="center", va="center",
color=fs.on(c.blue))
ax.text(dG + TdS / 2, 0, r"$T\Delta S°$" + f"\n{TdS:.1f}", ha="center", va="center", color=fs.on(c.vermilion))
ax.annotate("heat from the\nsurroundings", (dG + TdS / 2, -0.28), xytext=(dG + TdS / 2, -0.95),
ha="center", va="top", fontsize=fs.BASE - 1, arrowprops=dict(arrowstyle="-", color=c.muted, lw=0.8))
ax.set_yticks([1, 0], ["required", "supplied as"])
ax.set_xlabel(r"Energy per mole of $\mathrm{H_2O}$ (kJ mol$^{-1}$)")
ax.set_xlim(0, 300)
ax.set_ylim(-1.5, 1.5)
ax.spines["left"].set_visible(False)
ax.tick_params(axis="y", length=0)
return fig
fs.show(draw, alt=f"Two horizontal bars. The top bar is the enthalpy change, {dH:.1f} kJ per mole. The bottom bar "
f"has the same length and is split into the Gibbs energy change, {dG:.1f} kJ per mole, supplied "
f"as electrical work, and T times the entropy change, {TdS:.1f} kJ per mole, supplied as heat "
"from the surroundings.")Figure 5.1.3:Energy required to split one mole of liquid water at and in the reversible limit. The enthalpy change (top) is supplied as electrical work equal to and as heat equal to (bottom). Data from the NIST-JANAF Thermochemical Tables.
Worked Examples¶
Example 1: Helmholtz Free Energy and Reversible Work¶
Problem. One mole of a monatomic ideal gas expands isothermally at from to . (a) Use Eq. (5.1.22) to find . (b) Compare with the work of the reversible isothermal expansion found in Section 3.2. (c) Find from Eq. (5.1.24) and then .
Solution.
Change in . At fixed and , the thermal wavelength does not change, so only the term in Eq. (5.1.22) contributes:
where .
Comparison with the work. The reversible isothermal expansion of an ideal gas has (Section 3.2), so
Entropy and internal energy. Only the term in Eq. (5.1.24) changes as well:
Result. , equal to the reversible work, and , as it must be for an ideal gas at constant temperature. The equality is general: at constant , , and for a reversible process , so . The Helmholtz free energy stands to the total reversible work at constant as the Gibbs free energy stands to the reversible non- work at constant and .
Example 2: Entropy and Internal Energy of the Ideal Gas from ¶
Problem. Starting from the Helmholtz free energy of the monatomic ideal gas, Eq. (5.1.22), derive expressions for and .
Solution.
The Helmholtz free energy is
Since , we have and . Therefore
where “const” collects terms independent of and .
Entropy. Using :
This is the Sackur–Tetrode equation.
Internal energy. From :
Result. Differentiating with respect to gives the entropy (Sackur–Tetrode), and adding back recovers the equipartition result . All thermodynamic properties of the ideal gas follow from a single function, .
Concept Checks¶
Why do extremum principles involve minimization of a potential rather than maximization of entropy in most lab settings?
In the derivation of Eq. (5.1.4), which step comes from the Clausius inequality and which from the First Law? What kind of process inside the system does the strict inequality represent?
Why does (not ) naturally appear for systems at fixed and ?
Equation (5.1.31) gives for a reversible process. How does this change for an irreversible process, and what does the change mean for the maximum useful work a spontaneous reaction can deliver?
Why does differentiating the same function give both a thermal quantity () and a mechanical quantity ()?
Key Takeaways¶
The fundamental inequality combines the First Law with the Clausius inequality and governs the direction of spontaneous change.
Thermodynamic potentials (, , , ) are related by Legendre transforms that match natural variables to experimental constraints.
Equilibrium corresponds to minimization of , , , or depending on which variables are held fixed; at constant and at constant are the most common laboratory cases.
The connection (Section 4.3) makes a master potential: , , , and all follow from partial derivatives.
Under typical lab conditions (constant ), measures the reversible non- work — the energy “free” to do useful work.