---
title: Thermodynamic potentials and Maxwell relations
heading: Four energies, their natural variables, and the identities that link what you can't measure to what you can
eyebrow: B11 · Lesson 31 · Thermodynamic potentials and Maxwell relations
xp: 40
---

::: hook
Entropy can't be measured with a meter. How much a gas's entropy rises when it expands at constant temperature, or how much a paramagnet's entropy falls when a field is switched on, sounds like it needs exactly that. Yet both follow from things that are easy to measure: how pressure changes with temperature, how magnetization changes with temperature. The bridge is a family of identities, the **Maxwell relations**, that come from writing the energy four different ways (lessons 4 and 30's free energies are two of them) and noticing that mixed second derivatives don't care about order. The magnetic one is how cryogenic labs cool below a kelvin by turning off a magnet.
:::

::: play
- The curve is the entropy change of a paramagnet when a field $B$ is switched on at constant temperature $T$, from the Maxwell relation and Curie's law: $\Delta S/Nk = -\frac12(\mu B/kT)^2$, in the high-temperature limit where it holds.
- The colder the magnet and the stronger the field, the more the spins line up and the more entropy is squeezed out, which is the entropy adiabatic demagnetization uses to cool.
:::

```sim plot
view: graph
x: B = 0..2
y: dS = -0.08..0
slider: T = 1..10 step 0.5 = 4
plot: -0.5*(9.274e-24*B/(1.380649e-23*T))^2 | label: ΔS/Nk for spin-½ moments (high-temperature limit)
readout: μB/kT at the largest field = 9.274e-24*2/(1.380649e-23*T) | digits: 3
```

::: predict
## A mole of ideal gas doubles its volume at constant temperature. Its entropy rises by how much?

- [x] $R\ln 2$, about 5.8 J/K
- [ ] Zero, since the temperature didn't change
- [ ] $R$, about 8.3 J/K
- [ ] It depends on the gas

::: reveal
$R\ln 2 = 5.76$ J/K. The Maxwell relation $(\partial S/\partial V)_T = (\partial p/\partial T)_V$ turns the unmeasurable entropy change into the measurable slope of pressure with temperature, which for an ideal gas is $nR/V$. Integrating from $V$ to $2V$ gives $nR\ln 2$. Each molecule has twice the room, and that's worth $k\ln 2$ of entropy.
:::
:::

::: nameit
## Four potentials

Starting from $dU = T\,dS - p\,dV$, subtracting products to change which variables are held fixed gives

| Potential | Definition | Differential | Natural variables |
|---|---|---|---|
| Energy | $U$ | $dU = T\,dS - p\,dV$ | $S, V$ |
| Enthalpy | $H = U + pV$ | $dH = T\,dS + V\,dp$ | $S, p$ |
| Helmholtz free energy | $F = U - TS$ | $dF = -S\,dT - p\,dV$ | $T, V$ |
| Gibbs free energy | $G = H - TS$ | $dG = -S\,dT + V\,dp$ | $T, p$ |

Each is the right "energy" for its conditions: at fixed $T$ and $V$ a system settles to minimum $F$; at fixed $T$ and $p$, minimum $G$ (lesson 30).

## Maxwell relations

Each differential's coefficients are partial derivatives, and mixed second partials are equal. From $dF$, $S = -(\partial F/\partial T)_V$ and $p = -(\partial F/\partial V)_T$, so

$$\left(\frac{\partial S}{\partial V}\right)_T = \left(\frac{\partial p}{\partial T}\right)_V$$

From $dG$: $\left(\frac{\partial S}{\partial p}\right)_T = -\left(\frac{\partial V}{\partial T}\right)_p$. From $dU$ and $dH$: $\left(\frac{\partial T}{\partial V}\right)_S = -\left(\frac{\partial p}{\partial S}\right)_V$ and $\left(\frac{\partial T}{\partial p}\right)_S = \left(\frac{\partial V}{\partial S}\right)_p$.

## Consequences you can measure

- **Heating a solid at constant pressure versus constant volume:** $C_p - C_V = \dfrac{TV\alpha^2}{\kappa_T}$, with $\alpha$ the volume expansion coefficient and $\kappa_T$ the isothermal compressibility. Always positive, and for an ideal gas it's $nR$.
- **Magnetic systems:** with $dF = -S\,dT - M\,dB$ (magnetization $M$ in a field $B$), $\left(\frac{\partial S}{\partial B}\right)_T = \left(\frac{\partial M}{\partial T}\right)_B$. A paramagnet obeying Curie's law, $M = N\mu^2B/kT$ (lesson 7), has $\partial M/\partial T < 0$, so a field at fixed temperature lowers its entropy. Remove the field with no heat exchange and the spins must take the entropy back from the lattice: the **magnetocaloric** effect, used for adiabatic demagnetization below 1 K.
- **Dielectrics:** the same relation with $E$ and polarization gives the electrocaloric effect, studied for solid-state coolers.
:::

::: example
## Find the entropy change of $n$ moles of ideal gas expanding isothermally from $V_1$ to $V_2$, using a Maxwell relation. Evaluate it for one mole doubling its volume.

::: solution
1. **Use the Maxwell relation.** For $p = nRT/V$,
   $$\begin{aligned} (\partial S/\partial V)_T &= (\partial p/\partial T)_V \\ &= nR/V \end{aligned}$$
2. **Integrate at constant T.**
   $$\Delta S = nR\ln\frac{V_2}{V_1}$$
3. **One mole doubling its volume.**
   $$8.314\ln 2 = 5.76\ \text{J/K}$$
4. **Why it's useful.** The same result comes from counting states (lesson 1), but here it took only the equation of state, which is what makes Maxwell relations useful for real substances whose microscopic states nobody can count.

**Answer:** ΔS = nR ln(V₂/V₁), which is 5.76 J/K for one mole doubling its volume.
:::
:::

::: example
## For copper at 300 K, $\alpha = 4.95 \times 10^{-5}$ K⁻¹, $\kappa_T = 7.3 \times 10^{-12}$ Pa⁻¹ and the molar volume is $7.11 \times 10^{-6}$ m³. How different are $C_p$ and $C_V$?

::: solution
1. **The relation.**
   $$C_p - C_V = \frac{TV\alpha^2}{\kappa_T}$$
2. **Put in copper's numbers.**
   $$\begin{aligned} C_p - C_V &= \frac{300 \times 7.11 \times 10^{-6}}{7.3 \times 10^{-12}} \\ &\quad \times (4.95 \times 10^{-5})^2 \\ &= 0.72\ \text{J/(mol·K)} \end{aligned}$$
3. **Compare with $C_p$.** Against $C_p$ = 24.4 J/(mol·K), that's about 3%.
4. **Why it's useful.** Measurements are always at constant pressure, while theory (lesson 15's Debye model) predicts $C_V$; this relation converts one to the other using only expansion and compressibility data.

**Answer:** $C_p$ exceeds $C_V$ by 0.72 J/(mol·K), about 3%.
:::
:::

::: example
## Spin-½ magnetic moments of one Bohr magneton sit at 4 K. By how much does a 1 T field lower their entropy, per spin, in the high-temperature limit?

::: solution
1. **Curie's law.** $M = N\mu^2B/kT$ gives
   $$(\partial M/\partial T)_B = -N\mu^2B/kT^2$$
2. **The ratio μB/kT.**
   $$\begin{aligned} \frac{\mu B}{kT} &= \frac{9.274 \times 10^{-24}}{1.381 \times 10^{-23} \times 4} \\ &= 0.168 \end{aligned}$$
3. **Integrate the Maxwell relation.**
   $$\begin{aligned} \frac{\Delta S}{Nk} &= -\frac12\left(\frac{\mu B}{kT}\right)^2 \\ &= -\frac12(0.168)^2 \\ &= -0.0141 \end{aligned}$$
4. **Compare with the maximum.** It's a small fraction of the maximum $\ln 2 = 0.693$ per spin, which is why demagnetization refrigerators start from fields of several tesla at a kelvin or so, where $\mu B/kT$ is large and most of the spin entropy can be squeezed out.

**Answer:** the field lowers the entropy by 0.0141k per spin.
:::
:::

::: check
given: n = 2 | 3; r = 2 | 3 | 10
answer: n*8.314*ln(r)
unit: J/K
tolerance: 0.5%

## {n} moles of ideal gas expands at constant temperature to {r} times its volume. By how much does its entropy rise?

::: right
Right. $(\partial S/\partial V)_T = nR/V$ integrates to $nR\ln(V_2/V_1)$ = {answer}.
:::

::: misses
- [n*8.314*(r - 1)] Integrate $nR/V$: the result is a logarithm.
- [8.314*ln(r)] That's one mole. Multiply by {n}.
- [0] The temperature is constant, but the entropy isn't: there's more room.
- [any] Not yet. Integrate $(\partial S/\partial V)_T = nR/V$.
:::
:::

::: check
given: T = 300 | 500; V = 7.1 | 10; a = 3 | 5; k = 7 | 15
answer: T*V*1e-6*(a*1e-5)^2/(k*1e-12)
unit: J/K
tolerance: 0.5%

## A solid has a molar volume of {V} × 10⁻⁶ m³, a volume expansion coefficient of {a} × 10⁻⁵ K⁻¹ and an isothermal compressibility of {k} × 10⁻¹² Pa⁻¹. What is $C_p - C_V$ per mole at {T} K?

::: right
Right. $C_p - C_V = TV\alpha^2/\kappa_T$ = {answer}.
:::

::: misses
- [T*V*1e-6*a*1e-5/(k*1e-12)] The expansion coefficient enters squared.
- [any] Not yet. Use $TV\alpha^2/\kappa_T$ in SI units.
:::
:::

::: check
given: B = 0.5 | 1 | 2; T = 2 | 4 | 10
answer: -0.5*(9.274e-24*B/(1.380649e-23*T))^2
tolerance: 1%

## In the high-temperature limit, by how much does a field of {B} T lower the entropy per spin, in units of $k$, of spin-½ moments of one Bohr magneton at {T} K?

::: right
Right. $\Delta S/Nk = -\frac12(\mu B/kT)^2$ = {answer}.
:::

::: misses
- [-(9.274e-24*B/(1.380649e-23*T))^2] Integrating $-N\mu^2B/kT^2$ from 0 to $B$ brings a factor of $\frac12$.
- [0.5*(9.274e-24*B/(1.380649e-23*T))^2] A field lines the spins up: the entropy falls.
- [any] Not yet. Integrate $(\partial S/\partial B)_T = (\partial M/\partial T)_B$ with Curie's law.
:::
:::

::: check
kind: choice

## Which Maxwell relation comes from the Gibbs free energy, $dG = -S\,dT + V\,dp$?

- [x] $(\partial S/\partial p)_T = -(\partial V/\partial T)_p$
- [ ] $(\partial S/\partial V)_T = (\partial p/\partial T)_V$
- [ ] $(\partial T/\partial V)_S = -(\partial p/\partial S)_V$
- [ ] $(\partial T/\partial p)_S = (\partial V/\partial S)_p$

::: right
Right. $S = -(\partial G/\partial T)_p$ and $V = (\partial G/\partial p)_T$; equating the mixed second derivatives gives it. It says a substance that expands on heating loses entropy when compressed.
:::

::: misses
- [2] That's from $dF = -S\,dT - p\,dV$.
- [3] That's from $dU = T\,dS - p\,dV$.
- [4] That's from $dH = T\,dS + V\,dp$.
:::
:::

::: check
kind: parts
given: T = 250 | 300 | 350; p = 2 | 5 | 10

## For an ideal gas, $V = nRT/p$.

::: part
answer: -8.314/(p*1e5)
unit: J/(K·Pa)
tolerance: 0.5%

### Using $(\partial S/\partial p)_T = -(\partial V/\partial T)_p$, what is $(\partial S/\partial p)_T$ for one mole at {p} bar?

::: misses
- [8.314/(p*1e5)] Mind the sign: compressing the gas lowers its entropy.
- [-8.314*T/(p*1e5)^2] That's $(\partial V/\partial p)_T$'s form. Differentiate $V$ with respect to $T$.
- [any] Not yet. $(\partial V/\partial T)_p = nR/p$, with the pressure in pascals.
:::
:::

::: part
answer: 8.314*ln(p)
unit: J/K
tolerance: 0.5%

### How much entropy does one mole lose when compressed isothermally from 1 bar to {p} bar? (Give the size.)

::: misses
- [8.314*(p - 1)] Integrate $nR/p$ over pressure: a logarithm.
- [any] Not yet. Integrate $nR/p$ from 1 to {p} bar.
:::
:::

::: right
Right. At {T} K or any other temperature, the entropy change depends only on the pressure ratio, as it must for an ideal gas.
:::
:::

::: check
kind: python
given: T = 300 | 400; n = 1 | 2

## For a van der Waals gas, $p = \dfrac{nRT}{V - nb} - \dfrac{an^2}{V^2}$, with $a = 0.137$ Pa·m⁶/mol² and $b = 3.87 \times 10^{-5}$ m³/mol (nitrogen). Using the Maxwell relation $(\partial S/\partial V)_T = (\partial p/\partial T)_V$, compute the entropy change of `n` = {n} mol expanding isothermally at `T` = {T} K from 1 L to 10 L by integrating $(\partial p/\partial T)_V$ numerically (Simpson, 1000 intervals). Set `dS` and `dS_ideal`, the ideal-gas value $nR\ln 10$.

```python starter
import math
dS = dS_ideal = n * 8.314 * math.log(10)
print(dS, dS_ideal)
```

```python solution
import math
R, a, b = 8.314, 0.137, 3.87e-5
dpdT = lambda V: n * R / (V - n * b)
V1, V2, N = 1e-3, 10e-3, 1000
h = (V2 - V1) / N
dS = h / 3 * (dpdT(V1) + dpdT(V2) + sum((4 if k % 2 else 2) * dpdT(V1 + k * h) for k in range(1, N)))
dS_ideal = n * R * math.log(10)
print(dS, dS_ideal)
```

```python tests
import math
R, b = 8.314, 3.87e-5
ex = n * R * math.log((10e-3 - n * b) / (1e-3 - n * b))
assert abs(dS - ex) < 1e-6 * ex, f"The entropy change should be nR·ln((V2 − nb)/(V1 − nb)) = {ex:.5f} J/K: only the excluded volume b matters."
assert abs(dS_ideal - n * R * math.log(10)) < 1e-12 and dS > dS_ideal, "The van der Waals value is a little larger than the ideal gas's."
```

::: right
Right. $(\partial p/\partial T)_V = nR/(V - nb)$ doesn't involve $a$ at all: the attraction changes the pressure but not its temperature slope, so only the molecules' own volume changes the entropy. The integral is $nR\ln\frac{V_2 - nb}{V_1 - nb}$.
:::
:::

::: check
kind: derivation
vars: T = 200..400, V = 0.001..0.01, n = 1..3

## Derive $(\partial S/\partial V)_T$ for $n$ moles of ideal gas from the Helmholtz free energy.

::: step
answer: n*8.314/V

### $p = nRT/V$. What is $(\partial p/\partial T)_V$?
:::

::: step
answer: n*8.314/V

### By the Maxwell relation from $dF = -S\,dT - p\,dV$, what is $(\partial S/\partial V)_T$?
:::

::: right
Right. The entropy grows with volume at a rate set by the equation of state alone; integrating gives $nR\ln(V_2/V_1)$.
:::
:::

::: explain
## A demagnetization refrigerator magnetizes a paramagnetic salt while it's in contact with a cold bath, then isolates it and turns the field off. Use the magnetic Maxwell relation to explain why the salt cools.

::: model
For a paramagnet, $(\partial S/\partial B)_T = (\partial M/\partial T)_B$, and Curie's law makes $\partial M/\partial T$ negative: a field at fixed temperature aligns the spins and lowers their entropy, with the excess carried away as heat into the bath. Once the salt is isolated, its total entropy can't change. When the field is removed, the spins are free to disorder again and their entropy rises, so the only place that entropy can come from is the lattice's thermal motion: the lattice loses entropy, which means it cools. The colder the bath and stronger the field at the start, the more spin entropy is squeezed out and the lower the final temperature.
:::
:::

::: practice

::: check
given: r = 2..10 int
answer: 8.314*ln(r)
unit: J/K
tolerance: 0.5%

## One mole of ideal gas expands isothermally to {r} times its volume. What is its entropy change?

::: misses
- [8.314*r] It's a logarithm: $R\ln(V_2/V_1)$.
- [any] $\Delta S = R\ln(V_2/V_1)$.
:::
:::

::: check
kind: choice

## Which potential is minimized by a system held at fixed temperature and pressure?

- [x] The Gibbs free energy $G$
- [ ] The Helmholtz free energy $F$
- [ ] The enthalpy $H$
- [ ] The internal energy $U$

::: right
Right. At fixed $T$ and $p$, the system plus its surroundings maximize entropy exactly when $G$ is minimized.
:::

::: misses
- [2] $F$ is minimized at fixed $T$ and $V$.
- [3] $H$ is minimized at fixed $S$ and $p$.
- [4] $U$ is minimized at fixed $S$ and $V$.
:::
:::
:::
