The Fundamental Equations of Thermodynamics

Imagine squeezing a gas in a cylinder while heat leaks in, or letting a reaction release heat while gas expands against the atmosphere. Tracking energy through these simultaneous changes looks messy until you realize four equations do all the bookkeeping at once. These are the fundamental equations of thermodynamics, combining the first and second laws into single differential statements for UU, HH, AA, and GG. They matter because every equilibrium condition, every phase rule, every van 't Hoff or Clausius–Clapeyron relation traces back to these four lines. Once you see how they arise, the rest of chemical thermodynamics becomes bookkeeping rather than mystery. This article derives all four equations from the first and second laws. You will see why each one has its own natural variables. Two fully worked numerical examples follow. The article closes by pointing toward Maxwell relations, which fall out of these equations almost for free.

Key takeaways
  • The four fundamental equations combine dU=TdS−pdVdU = TdS - pdV with the definitions of HH, AA, and GG.
  • Each equation pairs a state function with its own natural variables: U(S,V)U(S,V), H(S,p)H(S,p), A(T,V)A(T,V), G(T,p)G(T,p).
  • They apply to closed systems doing only pVpV work, in either reversible or irreversible processes.
  • Because each is an exact differential, the coefficients give exact partial-derivative identities.
  • These four equations are the parent equations from which Maxwell's relations and all equilibrium criteria descend.
  • Key idea: combining dU=TdS−pdVdU = TdS - pdV with H=U+pVH = U + pV, A=U−TSA = U - TS, G=H−TSG = H - TS generates four equivalent, exact statements of the combined first and second laws, each naturally expressed in a different pair of variables.
The core insight

All chemical thermodynamics reduces to one master statement, dU=TdS−pdVdU = TdS - pdV for reversible pVpV-work only closed systems, restated through Legendre transformations as dHdH, dAdA, and dGdG so that each state function is naturally controlled by the variables actually held fixed in the laboratory: entropy and volume for UU, entropy and pressure for HH, temperature and volume for AA, temperature and pressure for GG.

The physical picture

Start with a closed system, meaning no matter crosses its boundary, doing only expansion work against pressure pp. The first law states

dU=dq+dwdU = dq + dw

For a reversible change, dwrev=−p dVdw_{rev} = -p\,dV, and the second law defines entropy through dqrev=TdSdq_{rev} = TdS. Substituting both into the first law gives the fundamental equation

dU=TdS−pdVdU = TdS - pdV

This single line is remarkable: it contains no path-dependent quantities. Both qq and ww individually depend on the path taken, but their combination dUdU does not. Because dUdU is expressed entirely in the state functions TT, SS, pp, and VV, the equation holds for any change between two neighboring equilibrium states of the closed system, reversible or not — the derivation used a reversible path only as a bookkeeping device to evaluate the exact differential. The other three thermodynamic potentials are defined from UU by adding or subtracting a TSTS or pVpV term — a mathematical trick called a Legendre transformation. Each transformation swaps one natural variable for its conjugate:

  • H=U+pVH = U + pV swaps VV for pp
  • A=U−TSA = U - TS swaps SS for TT
  • G=H−TS=U+pV−TSG = H - TS = U + pV - TS swaps both

Differentiating each definition and substituting dU=TdS−pdVdU = TdS - pdV produces the other three fundamental equations, derived explicitly below. The payoff is that each potential is simplest — meaning its differential has the fewest terms — when expressed in its own natural variables, and those natural variables are exactly the ones easiest to control experimentally: constant S,VS,V for UU; constant S,pS,p for HH; constant T,VT,V for AA; constant T,pT,p for GG, the last being the everyday condition of a beaker open to the lab bench.

Figure
The four potentials and their natural variable pairs
U(S,V) dU = TdS − pdV H(S,p) dH = TdS + Vdp A(T,V) dA = −SdT − pdV G(T,p) dG = −SdT + Vdp +pV (V→p) +pV (V→p) −TS (S→T) −TS

The core relations

dU=TdS−pdVdU = TdS - pdV

where: UU is internal energy, natural variables SS (entropy) and VV (volume); valid for closed, pVpV-work-only systems.

dH=TdS+VdpdH = TdS + Vdp

where: H=U+pVH = U + pV is enthalpy, natural variables SS and pp (pressure).

dA=−SdT−pdVdA = -SdT - pdV

where: A=U−TSA = U - TS is Helmholtz energy, natural variables TT (temperature) and VV.

dG=−SdT+VdpdG = -SdT + Vdp

where: G=H−TSG = H - TS is Gibbs energy, natural variables TT and pp.

Derivation AFrom dU to dH, dA, and dG

Goal. Starting from dU=TdS−pdVdU = TdS - pdV, derive the other three fundamental equations by differentiating the defining relations for HH, AA, and GG.

Step 1 — establish dU. For a closed system with reversible pVpV work, the first law dU=dq+dwdU = dq + dw becomes dU=dqrev−pdVdU = dq_{rev} - pdV. The second law defines dS=dqrev/TdS = dq_{rev}/T for a reversible step, so dqrev=TdSdq_{rev} = TdS. Substitution gives

dU=TdS−pdVdU = TdS - pdV

Because UU, TT, SS, pp, VV are all state functions, this equation is an exact differential relation that holds for any infinitesimal change connecting equilibrium states — irreversible paths included — even though it was derived using a reversible path.

Step 2 — derive dH. Enthalpy is defined as H=U+pVH = U + pV. Take the total differential using the product rule:

dH=dU+pdV+VdpdH = dU + pdV + Vdp

Substitute dU=TdS−pdVdU = TdS - pdV from Step 1:

dH=TdS−pdV+pdV+VdpdH = TdS - pdV + pdV + Vdp

The −pdV-pdV and +pdV+pdV terms cancel exactly, leaving

dH=TdS+VdpdH = TdS + Vdp

This confirms HH's natural variables are SS and pp: at constant entropy and pressure, dH=0dH = 0, and more usefully, at constant pressure dH=TdS=dqpdH = TdS = dq_p, recovering the familiar rule that enthalpy change equals heat at constant pressure.

Step 3 — derive dA. Helmholtz energy is defined as A=U−TSA = U - TS. Differentiate:

dA=dU−TdS−SdTdA = dU - TdS - SdT

Substitute dU=TdS−pdVdU = TdS - pdV:

dA=TdS−pdV−TdS−SdTdA = TdS - pdV - TdS - SdT

The two TdSTdS terms cancel:

dA=−SdT−pdVdA = -SdT - pdV

AA's natural variables are TT and VV. At constant temperature, dA=−pdVdA = -pdV, so AA measures the maximum non-expansion... actually here purely pVpV work extractable at constant T,VT,V, motivating its role as the criterion for spontaneity in rigid, isothermal systems.

Step 4 — derive dG. Gibbs energy is defined as G=H−TSG = H - TS, or equivalently G=U+pV−TSG = U + pV - TS. Differentiate:

dG=dH−TdS−SdTdG = dH - TdS - SdT

Substitute dH=TdS+VdpdH = TdS + Vdp from Step 2:

dG=TdS+Vdp−TdS−SdTdG = TdS + Vdp - TdS - SdT

The TdSTdS terms cancel:

dG=−SdT+VdpdG = -SdT + Vdp

GG's natural variables are TT and pp — precisely the variables fixed in an open beaker on a lab bench. At constant temperature and pressure, dGdG reduces to zero at equilibrium and is negative for any spontaneous process, which is why GG dominates practical chemical thermodynamics.

Boxed result.

dU=TdS−pdV,dH=TdS+Vdp,dA=−SdT−pdV,dG=−SdT+Vdp\boxed{dU = TdS - pdV, \quad dH = TdS + Vdp, \quad dA = -SdT - pdV, \quad dG = -SdT + Vdp}

All four follow from one master equation plus three definitions; none contains new physics beyond the first and second laws.

Worked examples

Example 1 — Foundational: reversible isothermal expansion of an ideal gas One mole of an ideal gas expands reversibly and isothermally at T=298 KT = 298\ \text{K} from V1=10.0 LV_1 = 10.0\ \text{L} to V2=20.0 LV_2 = 20.0\ \text{L}. Find dUdU, dHdH, dAdA, and dGdG integrated over the process, using the fundamental equations as a consistency check. Step 1: entropy change. For an ideal gas at constant TT,

ΔS=nRln⁡(V2V1)=(1.00 mol)(8.314 J K−1mol−1)ln⁡(2.00)\Delta S = nR\ln\left(\frac{V_2}{V_1}\right) = (1.00\ \text{mol})(8.314\ \text{J K}^{-1}\text{mol}^{-1})\ln(2.00)
ΔS=8.314×0.6931=5.763 J K−1\Delta S = 8.314 \times 0.6931 = 5.763\ \text{J K}^{-1}

Step 2: check ΔU\Delta U via the fundamental equation. For an ideal gas, UU depends only on TT, so at constant TT, ΔU=0\Delta U = 0. Verify this is consistent with dU=TdS−pdVdU = TdS - pdV integrated along the isothermal path:

ΔU=TΔS−∫V1V2p dV=TΔS−nRTln⁡(V2V1)\Delta U = T\Delta S - \int_{V_1}^{V_2} p\,dV = T\Delta S - nRT\ln\left(\frac{V_2}{V_1}\right)

Since TΔS=nRTln⁡(V2/V1)T\Delta S = nRT\ln(V_2/V_1) exactly (because ΔS\Delta S was itself computed from that integral), the two terms cancel:

ΔU=nRTln⁡(2.00)−nRTln⁡(2.00)=0 J\Delta U = nRT\ln(2.00) - nRT\ln(2.00) = 0\ \text{J}

This confirms internal consistency: ΔU=0\Delta U = 0, as required for an isothermal ideal-gas process. Step 3: ΔH\Delta H. Since H=U+pV=U+nRTH = U + pV = U + nRT for an ideal gas, HH also depends only on TT, so ΔH=0 J\Delta H = 0\ \text{J}. Check via dH=TdS+VdpdH = TdS + Vdp: at constant TT, pV=nRTpV = nRT is constant, so Vdp=−pdVVdp = -pdV, giving

ΔH=TΔS−∫p dV=0 J\Delta H = T\Delta S - \int p\,dV = 0\ \text{J}

consistent with Step 2. Step 4: ΔA\Delta A. Using dA=−SdT−pdVdA = -SdT - pdV, at constant TT, dT=0dT = 0:

ΔA=−∫V1V2p dV=−nRTln⁡(V2V1)\Delta A = -\int_{V_1}^{V_2} p\,dV = -nRT\ln\left(\frac{V_2}{V_1}\right)
ΔA=−(1.00)(8.314)(298)ln⁡(2.00)=−2478.6×0.6931=−1717.7 J\Delta A = -(1.00)(8.314)(298)\ln(2.00) = -2478.6 \times 0.6931 = -1717.7\ \text{J}

Step 5: ΔG\Delta G. Using dG=−SdT+VdpdG = -SdT + Vdp, at constant TT:

ΔG=∫p1p2V dp=nRTln⁡(p2p1)=nRTln⁡(V1V2)\Delta G = \int_{p_1}^{p_2} V\,dp = nRT\ln\left(\frac{p_2}{p_1}\right) = nRT\ln\left(\frac{V_1}{V_2}\right)

(since pVpV = constant, p2/p1=V1/V2p_2/p_1 = V_1/V_2)

ΔG=(8.314)(298)ln⁡(0.500)=2478.6×(−0.6931)=−1717.7 J\Delta G = (8.314)(298)\ln(0.500) = 2478.6 \times (-0.6931) = -1717.7\ \text{J}

Sanity check: ΔG=ΔH−Δ(TS)=ΔH−TΔS=0−(298)(5.763)=−1717.5 J\Delta G = \Delta H - \Delta(TS) = \Delta H - T\Delta S = 0 - (298)(5.763) = -1717.5\ \text{J}, matching within rounding. Also ΔA=ΔG\Delta A = \Delta G here because Δ(pV)=0\Delta(pV) = 0 for an isothermal ideal-gas process, consistent with G−A=pVG - A = pV.

Example 2 — Applied: pressure dependence of Gibbs energy across a phase-like compression Liquid water (Vm=18.07 cm3mol−1V_m = 18.07\ \text{cm}^3\text{mol}^{-1} at 298 K, essentially incompressible over this range) is compressed reversibly and isothermally from 1.00 bar1.00\ \text{bar} to 101 bar101\ \text{bar} at T=298 KT = 298\ \text{K}. Use dG=−SdT+VdpdG = -SdT + Vdp to find ΔGm\Delta G_m, and compare the relative contributions that would arise from a hypothetical entropy change to show why the VdpVdp term dominates for condensed phases. Step 1: apply dG at constant T. Since TT is constant, dT=0dT = 0, so

dGm=Vm dpdG_m = V_m\,dp

Because liquid water is nearly incompressible, VmV_m is treated as constant over this pressure range:

ΔGm=VmΔp=Vm(p2−p1)\Delta G_m = V_m \Delta p = V_m(p_2 - p_1)

Step 2: numbers. Convert VmV_m to SI: 18.07 cm3mol−1=18.07×10−6 m3mol−118.07\ \text{cm}^3\text{mol}^{-1} = 18.07\times10^{-6}\ \text{m}^3\text{mol}^{-1}. Pressure change:

Δp=101 bar−1 bar=100 bar=100×105 Pa=1.00×107 Pa\Delta p = 101\ \text{bar} - 1\ \text{bar} = 100\ \text{bar} = 100 \times 10^5\ \text{Pa} = 1.00\times10^7\ \text{Pa}
ΔGm=(18.07×10−6 m3mol−1)(1.00×107 Pa)=180.7 J mol−1\Delta G_m = (18.07\times10^{-6}\ \text{m}^3\text{mol}^{-1})(1.00\times10^7\ \text{Pa}) = 180.7\ \text{J mol}^{-1}

Step 3: compare with a typical thermal contribution. Consider that raising the temperature by just 1 K1\ \text{K} at constant pp changes GG by −SmΔT-S_m\Delta T. Using Sm∘(H2O,l)=69.9 J K−1mol−1S_m^{\circ}(\text{H}_2\text{O}, l) = 69.9\ \text{J K}^{-1}\text{mol}^{-1}:

ΔGm(ΔT=1 K)=−SmΔT=−(69.9)(1.00)=−69.9 J mol−1\Delta G_m(\Delta T = 1\ \text{K}) = -S_m \Delta T = -(69.9)(1.00) = -69.9\ \text{J mol}^{-1}

Step 4: interpretation. A 100-bar compression changes GmG_m by +180.7 J mol−1+180.7\ \text{J mol}^{-1}, comparable in magnitude to a 22–3 K3\ \text{K} temperature change, even though 100 bar sounds like an enormous pressure change and is chemically a mild one. This illustrates why liquids and solids are called "pressure-insensitive": their small molar volumes make the VdpVdp term in dGdG small unless pressure changes are extreme (hundreds to thousands of bar), in sharp contrast to gases, where VmV_m is roughly 2000 times larger at 1 bar and the same Δp\Delta p produces enormous ΔG\Delta G. Sanity check: the sign is positive, correctly reflecting that compression at constant TT raises Gibbs energy (work is done on the system, and Vm>0V_m > 0 means increasing pp increases GG), consistent with (∂G/∂p)T=V>0(\partial G/\partial p)_T = V > 0.

Limiting cases & common traps

SituationWhat happensWhy
Constant S,VS, VdU=0dU = 0 at equilibriumUU's natural variables held fixed
Constant S,pS, pdH=0dH = 0 at equilibriumHH's natural variables held fixed
Constant T,VT, VdA≤0dA \le 0 for spontaneous changemaximum work criterion
Constant T,pT, pdG≤0dG \le 0 for spontaneous changeeveryday lab condition
Ideal gas, isothermaldU=dH=0dU = dH = 0U,HU, H depend on TT only
  • These equations assume a closed system (no mass exchange) doing only reversible pVpV work; adding non-expansion work dwadddw_{add} or open-system mass flow μ dn\mu\,dn adds extra terms.
  • The equations hold for irreversible changes too, since UU, HH, AA, GG are state functions — only the derivation used a reversible path.
  • Don't confuse dG=−SdT+VdpdG = -SdT + Vdp (a general, exact relation) with ΔG=ΔH−TΔS\Delta G = \Delta H - T\Delta S (valid only at constant TT).

The chemist behind it

Josiah Willard Gibbs, working largely alone at Yale in the 1870s, unified mechanics and thermodynamics into a single mathematical framework built on exactly this kind of potential function. His 300-page memoir "On the Equilibrium of Heterogeneous Substances" (1876–1878) introduced the free energy that bears his name and derived the equilibrium and phase-rule consequences of dG=−SdT+VdpdG = -SdT + Vdp decades before most chemists had the mathematical tools to appreciate it. Wilhelm Ostwald's German translation later helped the ideas spread through European chemistry.

Origins · 1 minJosiah Willard Gibbs and how this was discovered
JW
Josiah Willard Gibbs
1839–1903 · American mathematical physicist who founded chemical thermodynamics with the Gibbs free energy and phase rule

Ask the tutor: How do the exactness conditions on these four equations generate the four Maxwell relations?

Why do we need four different potentials instead of just using U everywhere

Because U's natural variables are S and V, which are inconvenient to control in a lab. Chemists usually fix temperature and pressure, not entropy and volume. H, A, and G are Legendre transforms of U built precisely so that each is naturally expressed in a more convenient variable pair. G, with variables T and p, matches everyday bench conditions, which is why it appears so often in equilibrium and reaction thermodynamics.

Does dG = −SdT + Vdp mean G always decreases with temperature

Yes, at constant pressure, since (∂G/∂T)p=−S(\partial G/\partial T)_p = -S and entropy is always positive for any substance with positive absolute temperature. So increasing TT at fixed pp always lowers GG, and the rate of decrease is steeper for phases with larger entropy, such as gases compared to liquids or solids.

How do these four equations lead to Maxwell's relations

Each fundamental equation is an exact differential of the form dZ=M dx+N dydZ = M\,dx + N\,dy. Exactness requires the mixed second partial derivatives of ZZ to be equal regardless of order, which forces a cross-relation between MM and NN. Applying this test to dUdU, dHdH, dAdA, and dGdG in turn generates the four Maxwell relations, a topic that follows directly from what is derived here.

What changes if the system does non-expansion work, like electrical work

An extra term appears in every equation. For example, dU=TdS−pdV+dwadddU = TdS - pdV + dw_{add}, and correspondingly dG=−SdT+Vdp+dwadddG = -SdT + Vdp + dw_{add} at constant T,pT,p. This is the basis for relating ΔG\Delta G to the maximum non-expansion work obtainable, such as in electrochemical cells where dwadd=−nFE dξdw_{add} = -nFE\,d\xi.

Why does ΔA equal ΔG for the isothermal ideal gas expansion in Example 1

Because G−A=pVG - A = pV, so ΔG−ΔA=Δ(pV)\Delta G - \Delta A = \Delta(pV). For an ideal gas at constant temperature, pV=nRTpV = nRT is constant, so Δ(pV)=0\Delta(pV) = 0 and ΔG=ΔA\Delta G = \Delta A exactly. This equality is special to isothermal ideal-gas processes and does not hold generally.

Before this

Where this leads