Bread from air
Nitrogen makes up 78 % of the air, and every protein and every strand of DNA needs it, yet almost no living thing can use the nitrogen in the air directly: the triple bond in N₂ is one of the strongest in chemistry. By 1900 farmers depended on limited natural supplies of fixed nitrogen, such as Chilean saltpetre and guano, and chemists warned that the world's harvests would soon run short. In 1909, in Karlsruhe, Fritz Haber and Robert Le Rossignol made a bench-top apparatus that combined nitrogen and hydrogen into ammonia continuously, and by 1913 Carl Bosch's team at BASF had scaled it up to an industrial plant. Today the Haber–Bosch process makes nearly two hundred million tonnes of ammonia a year, most of it for fertiliser, and a widely cited estimate (Erisman and colleagues, 2008) is that the food grown with it feeds about half the people alive.
The chemistry is one line, N₂ + 3 H₂ ⇌ 2 NH₃, and the previous lesson showed it is favourable at room temperature. So why did it take a Nobel-winning effort, and why do plants still run at 400 to 500 °C and 100 to 300 bar? Because the reaction never goes to completion. It stops at an equilibrium, and where that point lies depends on temperature and pressure in a way that fights against the conditions needed to make the reaction fast. This lesson explains where equilibrium comes from, how to calculate it, and how chemists push it where they want.
A balance, not a standstill
Seal some nitrogen and hydrogen in a hot vessel with a catalyst, and ammonia forms, quickly at first, then more slowly, until the composition stops changing. Seal pure ammonia in an identical vessel, and some of it decomposes into nitrogen and hydrogen, until the composition stops changing, at the same mixture, if the amounts of atoms match. The final state does not depend on which side you started from.
At that point both reactions are still going on: ammonia molecules are forming and others are falling apart, at exactly equal rates. Experiments with isotopes show it directly. Add a little ammonia made with heavy nitrogen, ¹⁵N, to an equilibrium mixture, and the label soon spreads into the N₂, though the overall composition does not change. Chemical equilibrium is dynamic.
Analogy, not a formal construction
Picture two rooms joined by an open door at a party. People wander through in both directions. If one room is crowded, more people happen to leave it than enter, until the flows balance. After that the head-counts stay steady, but people never stop moving. Equilibrium is the steady head-count, not the end of the walking. (The analogy is only partial: where molecules "prefer" to be also depends on energy, as if one room had better food.)
Q, K and the Gibbs energy
To say precisely where a reaction stops we need a way to track its progress and a measure of how much each substance "counts".
Definition— extent of reaction
For a reaction (stoichiometric numbers negative for reactants), the extent of reaction (in moles) tracks progress: . In an ICE table (Initial, Change, Equilibrium), the "change" row is .
Definition— activity
The activity of a substance measures its effective concentration, as a pure number. For an ideal gas (partial pressure over 1 bar); for a solute in a dilute ideal solution (concentration over 1 mol/L); for a pure solid or liquid, and for the solvent of a dilute solution, . Real gases and concentrated solutions need correction factors (fugacity and activity coefficients).
Definition— reaction quotient and equilibrium constant
The reaction quotient is , products over reactants, each raised to its coefficient. The equilibrium constant is the value of at equilibrium. For N₂ + 3 H₂ ⇌ 2 NH₃ with ideal gases, .
The molar Gibbs energy of an ideal gas depends on its partial pressure as , and similarly with activities in general. That is the mixing entropy of the last lesson in disguise: a diluted substance has more room, more microstates, and a lower Gibbs energy. Summing over the reaction gives the central equation of this lesson.
Theorem— Gibbs energy of reaction and the equilibrium constant
At constant temperature and pressure, the Gibbs energy of reaction, , is
At equilibrium and , so
Proof
The total Gibbs energy is , and as the reaction advances by , each changes by . Because the Gibbs–Duhem relation makes the changes in the themselves cancel in the sum, , so . At constant and the system moves downhill in until , which is equilibrium; there .
∎
Two practical rules follow. First, compare with : if , then and the reaction runs forward; if , it runs backward. Second, every factor of ten in corresponds to kJ/mol in at 298 K. So a reaction with kJ/mol has and goes essentially to completion, while one with kJ/mol has and barely starts.
Computing K and ΔG from data
The equation turns a thermodynamic table into predictions. A neat test is the equilibrium H₂O(l) ⇌ H₂O(g). The liquid is pure, so its activity is 1, and : the equilibrium constant is the vapour pressure, in bar. The second half of the block uses for the hydrolysis of ATP in a living cell, completing the story begun in the previous lesson.
from math import exp, log
R = 8.314462618 # J/(mol K)
# 1. ΔG° fixes K. Water's vapour pressure at 25 °C from ΔfG° values (kJ/mol):
dG = -228.57 - (-237.13) # H2O(l) -> H2O(g), standard Gibbs energy
T = 298.15
K = exp(-dG * 1000 / (R * T)) # K = p(H2O)/p°, with p° = 1 bar
print(f"ΔG° = {dG:+.2f} kJ/mol -> K = {K:.4f}, so p(H2O) = {K * 100:.2f} kPa (measured: 3.17 kPa)")
# 2. Q fixes ΔG: ΔG = ΔG° + RT ln Q. ATP + H2O -> ADP + phosphate inside a cell at 37 °C.
dG0 = -30.5 # kJ/mol, standard biochemical value (pH 7)
T = 310.15
ATP, ADP, Pi = 2.5e-3, 0.25e-3, 2.0e-3 # mol/L, typical cellular levels
Q = (ADP * Pi) / ATP # concentrations relative to 1 mol/L
print(f"\nATP in a cell: Q = {Q:.1e}, RT ln Q = {R * T * log(Q) / 1000:.1f} kJ/mol, "
f"ΔG = {dG0 + R * T * log(Q) / 1000:.1f} kJ/mol")
K = exp(-dG0 * 1000 / (R * T))
print(f"K = {K:.2e}; at equilibrium (phosphate 2 mM) [ADP]/[ATP] would be {K / Pi:.1e}")From two numbers in a table, the vapour pressure of water at 25 °C comes out as 3.16 kPa, against a measured 3.17 kPa. In the cell, millimolar concentrations make tiny, and kJ/mol makes ATP hydrolysis much more favourable than its standard value: −52.5 kJ/mol.
ICE tables and root finders
Most equilibrium problems give a starting mixture and and ask for the final composition. Write the ICE table, express every amount in terms of the single unknown (the extent), substitute into the expression for , and solve. Often the result is a polynomial: quadratic, cubic, or worse. For anything beyond a quadratic, and even for quadratics where rounding matters, it is safer to let a computer find the root.
Example— Making an ester
Ethanoic (acetic) acid and ethanol react, slowly and with an acid catalyst, to give ethyl ethanoate (an ester with a fruity character, used in flavourings) and water:
CH₃COOH + C₂H₅OH ⇌ CH₃COOC₂H₅ + H₂O, with near room temperature.
Marcellin Berthelot and Léon Péan de Saint-Gilles found in the 1860s that equal amounts of acid and alcohol stop at about two-thirds conversion. ICE table, starting from 1 mol of each:
| acid | ethanol | ester | water | |
|---|---|---|---|---|
| Initial | 1 | 1 | 0 | 0 |
| Change | ||||
| Equilibrium |
The volume cancels because two molecules become two, so , which gives and . Berthelot's two-thirds, recovered.
How can we convert more of the acid? Use an excess of the cheaper ethanol. The quadratic is now less pleasant, so the block solves it by bisection (repeatedly halving an interval in which the function changes sign; see numerical methods), and then checks the answer against NumPy's polynomial root finder.
import numpy as np
def bisect(f, lo, hi, tol=1e-12):
"""A root of f between lo and hi, where f(lo) and f(hi) differ in sign."""
flo = f(lo)
for _ in range(200):
mid = 0.5 * (lo + hi)
fmid = f(mid)
if (fmid > 0) == (flo > 0):
lo, flo = mid, fmid
else:
hi = mid
if hi - lo < tol:
break
return 0.5 * (lo + hi)
# Esterification: CH3COOH + C2H5OH <=> CH3COOC2H5 + H2O, K ≈ 4.
# Equal numbers of moles on both sides, so the volume cancels and amounts can be used.
K = 4.0
for acid, alcohol in [(1.0, 1.0), (1.0, 3.0), (1.0, 10.0)]:
# ICE table: initial (acid, alcohol, 0, 0); change (-x, -x, +x, +x)
g = lambda x: x * x - K * (acid - x) * (alcohol - x) # zero at equilibrium
x = bisect(g, 0.0, min(acid, alcohol) - 1e-15)
print(f"start {acid:.0f} mol acid + {alcohol:4.1f} mol ethanol: "
f"x = {x:.4f} mol, {100 * x / acid:.1f} % of the acid converted")
# The same quadratic with numpy's polynomial root finder: (1 - K) x^2 + K (a + b) x - K a b = 0
a, b = 1.0, 3.0
roots = np.roots([1 - K, K * (a + b), -K * a * b])
print("np.roots for 1 : 3 gives", np.round(roots, 4), "- only the root between 0 and 1 is physical")Three moles of ethanol per mole of acid raise the conversion from 66.7 % to 90.3 %; ten moles, to 97.4 %. Chemists also remove the water as it forms, which keeps below so that the reaction keeps running forward.
Le Chatelier's principle, explained
In 1884 Henry Le Chatelier stated that a system at equilibrium, when disturbed, shifts so as to counteract the disturbance. It is a fine rule of thumb, but thermodynamics says exactly what happens and why, so we can derive each case from .
Changing concentrations. Adding a reactant or removing a product lowers below , so and the reaction runs forward until again. itself has not changed. That is the ester example above.
Changing pressure. For ideal gases, write partial pressures as mole fractions times the total pressure . Then , where is the same product of mole fractions and counts gas molecules. depends only on temperature, so if (fewer gas molecules on the product side), raising must raise : more product. For ammonia synthesis , so doubling the pressure multiplies by four. Reactions with do not respond to pressure at all, and adding an inert gas at constant volume changes no partial pressure and so does nothing.
Changing temperature. This is the only disturbance that changes itself.
Theorem— The van 't Hoff equation
Proof
From . Differentiating with respect to , the terms from and cancel exactly, leaving . Integrating between and with constant gives the second form.
∎
So heating favours the endothermic direction ( rises if ), and cooling favours the exothermic one. A catalyst, finally, speeds up the forward and reverse reactions equally: it changes how fast equilibrium is reached, never where it lies.
Worked case: the Haber–Bosch process
Everything comes together in ammonia synthesis. From the previous lesson, kJ/mol and J/(mol K), with J/(mol K). The reaction is exothermic, so heating lowers ; and it turns four gas molecules into two, so pressure helps. The block computes at several temperatures, in two ways, and then the equilibrium mole fraction of ammonia from a 1 : 3 mixture of N₂ and H₂, treating the gases as ideal.
from math import exp, log
R = 8.314462618e-3 # kJ/(mol K)
T0, dH0, dS0 = 298.15, -91.8, -0.1981 # N2 + 3 H2 -> 2 NH3, kJ/mol and kJ/(mol K)
dCp = -0.0453 # kJ/(mol K), from 298 K heat capacities
def K_of_T(T, kirchhoff=True):
if kirchhoff: # let ΔH° and ΔS° drift with a constant ΔCp
dH = dH0 + dCp * (T - T0)
dS = dS0 + dCp * log(T / T0)
else: # crude: ΔH° and ΔS° frozen at 298 K
dH, dS = dH0, dS0
return exp(-(dH - T * dS) / (R * T))
for T in (298.15, 500, 600, 700, 800):
print(f"T = {T:6.1f} K K ≈ {K_of_T(T, False):9.3g} (crude) {K_of_T(T):9.3g} (with ΔCp)")
def ammonia_fraction(K, p):
"""Equilibrium mole fraction of NH3 from a 1 : 3 N2/H2 feed at total pressure p (bar), ideal gases."""
def f(xi): # ln Q - ln K, increasing in xi
n = 4 - 2 * xi
x_nh3, x_n2, x_h2 = 2 * xi / n, (1 - xi) / n, 3 * (1 - xi) / n
return log(x_nh3**2 / (x_n2 * x_h2**3) / p**2) - log(K)
lo, hi = 1e-12, 1 - 1e-12
for _ in range(100): # bisection
mid = 0.5 * (lo + hi)
if f(mid) > 0:
hi = mid
else:
lo = mid
xi = 0.5 * (lo + hi)
return 2 * xi / (4 - 2 * xi)
print("\nequilibrium mole fraction of NH3 (ideal-gas estimate, 1 : 3 feed)")
pressures = (1, 50, 100, 200, 300)
print(" T/K " + "".join(f"{p:>8} bar" for p in pressures))
for T in (600, 700, 800):
K = K_of_T(T)
print(f"{T:6d} " + "".join(f"{100 * ammonia_fraction(K, p):11.1f} %" for p in pressures))falls from about at room temperature to below at 700 K. The two estimates differ by a factor of about four at 700 K; since the true lies between 0 and −45 J/(mol K) over this range, the real value lies between them, nearer the second. At 1 bar and 700 K almost nothing forms (0.3 %), but at 200 bar the equilibrium mixture holds 28 % ammonia. At 600 K the equilibrium would be much better, 54 % at 200 bar.
So why not run at 600 K or lower? Because equilibrium says nothing about speed. Even with the best catalysts, breaking the N≡N bond is slow at low temperature, and a reactor that produces a high equilibrium yield in a year is useless. The industrial answer is a compromise and a loop:
- Temperature of roughly 400 to 500 °C, hot enough for the catalyst to work quickly, cool enough to keep a useful . Converters are built in several beds with cooling between them, so the gas is cooled each time the exothermic reaction heats it.
- Pressure of roughly 100 to 300 bar, to push up, limited by the cost of compressors and thick-walled vessels.
- A catalyst, iron promoted with small amounts of potassium, aluminium and calcium oxides, found by Alwin Mittasch's team at BASF after thousands of trials; some plants now use ruthenium catalysts.
- Recycling. The gas leaving the converter typically holds only 15 to 20 % ammonia. It is cooled until the ammonia condenses and can be removed (removing a product, so drops), and the unreacted nitrogen and hydrogen go round again. Over many passes almost all the feed is converted.
Real gases at 200 bar are not ideal, and engineers use fugacities instead of partial pressures; the corrections raise the equilibrium yield somewhat, but the ideal-gas picture gets the trends right. The biggest cost today is not the converter but the hydrogen, which is mostly made from natural gas or coal and releases carbon dioxide. According to the IEA's Ammonia Technology Roadmap, ammonia production uses about 2 % of the world's final energy and emits over 1 % of its CO₂. As of 2026, plants that make hydrogen by electrolysis with renewable electricity, and research on catalysts that work at lower pressure and temperature, are active areas, discussed further in Energy chemistry and Sustainable chemistry.
Ammonia is also the starting point for nitric acid and nitrates, which meant that Haber–Bosch plants supplied munitions as well as fertiliser, and Haber himself led Germany's chemical-weapons programme in the First World War. That history is part of why the international community later agreed the Chemical Weapons Convention, and why chemists today are taught to think about the uses of what they make.
Optional Christian reflection · Swords and ploughshares
A reflection from the Christian tradition that inspires Lumenary Academy. It is not part of the mathematics and you are welcome to skip it.
The prophet Isaiah looked forward to a day when nations "shall beat their swords into plowshares, and their spears into pruninghooks" (Isaiah 2:4, King James Version). The story of ammonia runs in both directions: the same reaction that has fed billions also armed nations. Knowledge itself rarely chooses its use; people do. A chemist's skill is a gift, and part of receiving it well is asking what it is for. This reflection is optional, and nothing in the lesson depends on it.
Equilibrium in practice
Real systems have many reactions and many phases at once: a combustion flame has dozens of species, a natural water has carbonates, metal ions and dissolved gases. Rather than writing one equilibrium constant per reaction, professionals usually minimise the total Gibbs energy of the whole system subject to conservation of each element, which gives every equilibrium at once. Open-source tools such as Cantera do this for gases in combustion and process engineering, and the U.S. Geological Survey's PHREEQC does it for natural waters, where activity coefficients matter. The data come from evaluated tables such as NIST-JANAF. For acid–base equilibria, the most common equilibria of all, see the next lesson.
Common misconceptions
Misconception
"At equilibrium the reactions stop." Both directions continue at equal rates. Isotope-labelling experiments show atoms moving between reactants and products in a mixture whose composition does not change.
Misconception
"At equilibrium the concentrations of reactants and products are equal." They are whatever makes . With there is almost no reactant left; with almost no product forms.
Misconception
"Adding a catalyst gives more product." A catalyst gets you to equilibrium faster, but the equilibrium composition is fixed by , which depends only on temperature. Catalysts matter enormously in Haber–Bosch because they make the reaction fast enough at temperatures where is still useful.
Misconception
"Raising the pressure always shifts the equilibrium." Only if the number of gas molecules changes, and only if the partial pressures change. Compressing H₂ + I₂ ⇌ 2 HI does nothing, and pumping argon into a sealed vessel at constant volume leaves every equilibrium as it was.
Exercises
Take J/(mol K). Two exercises ask for Python functions; use a bracketing root finder such as bisection.
1. Chemical equilibrium
Warm-upHumanA reaction mixture in a closed vessel at constant temperature has reached chemical equilibrium. Which statements are true? Select all that apply.
2. Chemical equilibrium
Warm-upHumanFor a reaction at 500 K, . A mixture is prepared in which . What happens?
3. Chemical equilibrium
CoreHumanA reaction has kJ/mol at 298.15 K. What is its equilibrium constant , to the nearest whole number?
4. Chemical equilibrium
CoreHumanEach equilibrium below is compressed to half its volume at constant temperature. In which does the equilibrium composition shift towards the products? Select all that apply.
5. Chemical equilibrium
CoreHumanThe equilibrium constant of a reaction doubles when the temperature is raised from 298.15 K to 308.15 K. Assuming is constant over this range, estimate in kJ/mol, to the nearest whole number.
6. Chemical equilibrium
StretchHumanFor CH₃COOH + C₂H₅OH ⇌ CH₃COOC₂H₅ + H₂O take . Starting from 1.0 mol of acid and 2.0 mol of ethanol (no ester or water), what percentage of the acid is converted at equilibrium? Give the nearest whole number.
7. Chemical equilibrium
CoreComputationalFor a reaction A + B ⇌ C + D in which the volume cancels (two molecules on each side), write extent(K, a, b, c=0.0, d=0.0) that returns the equilibrium extent (in mol) starting from amounts a, b, c, d. At equilibrium
is negative if the reaction runs backwards. Use bisection on the interval , where every amount stays positive; on it, increases from negative to positive, so there is exactly one root.
8. Chemical equilibrium
StretchComputationalWrite ammonia_fraction(K, p), which returns the equilibrium mole fraction of NH₃ when a 1 : 3 mixture of N₂ and H₂ reacts at total pressure p (in bar), for N₂ + 3 H₂ ⇌ 2 NH₃ with dimensionless equilibrium constant K and ideal gases ( bar).
Start from 1 mol N₂ and 3 mol H₂; at extent the amounts are , and , out of in total. Partial pressures are mole fractions times p.
Further reading and resources
- How a century of ammonia synthesis changed the world · J. W. Erisman, M. A. Sutton, J. Galloway, Z. Klimont and W. Winiwarter · 2008Nature Geoscience. The estimate that synthetic nitrogen fertiliser supports roughly half the world's population.
- Ammonia Technology Roadmap · International Energy Agency · 2021Energy use and emissions of ammonia production, and routes to lower-emission ammonia.
- NIST-JANAF Thermochemical Tables · National Institute of Standards and TechnologyGibbs energies of formation and equilibrium constants of formation over wide temperature ranges.
- CanteraOpen-source software for chemical equilibrium, kinetics and thermodynamics, widely used in combustion and process engineering.
- PHREEQC · U.S. Geological SurveyThe standard program for equilibrium in natural waters, used by geochemists and water engineers.
- MIT OpenCourseWare 5.60: Thermodynamics and Kinetics · Massachusetts Institute of Technology