Statistical Mechanics

Detailed Balance

Why equilibrium runs the same forwards and backwards — P_i·W(i→j) = P_j·W(j→i)

Detailed balance is the equilibrium condition P_i·W(i→j) = P_j·W(j→i): in true thermal equilibrium every microscopic transition from state i to state j is exactly counterbalanced by its time-reverse, so the net probability current across every single link of the state space is zero. It is strictly stronger than stationarity, it forces the Boltzmann distribution P_i ∝ exp(−E_i/k_B·T) to be a fixed point of the master equation, and it is the mathematical engine behind the Metropolis Monte Carlo algorithm (1953). Introduced by Ludwig Boltzmann in his 1872 H-theorem work and sharpened by Onsager in 1931, detailed balance is the statistical fingerprint of microscopic time-reversal symmetry.

  • ConditionP_i·W(i→j) = P_j·W(j→i)
  • Rate ratioW(i→j)/W(j→i) = e^(−(E_j−E_i)/k_B·T)
  • ImpliesStationarity (but not conversely)
  • Net currentJ_ij = 0 on every link
  • UnderpinsMetropolis MCMC (1953)
  • SymmetryMicroscopic time reversal

Interactive visualization

Press play, or step through manually. The visualization is yours to drive — try it before reading on.

Open visualization fullscreen ↗

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

Definition

Consider a system that hops between discrete states labelled i, j, k, … Its probabilities evolve under the master equation:

dP_i/dt = Σ_j [ P_j·W(j→i) − P_i·W(i→j) ]

where P_i is the probability of finding the system in state i and W(i→j) is the transition rate from i to j (units s⁻¹ for continuous time, or a dimensionless probability per step in a Markov chain). The bracket is the net probability current on the link i↔j.

A distribution is stationary when dP_i/dt = 0 for all i — the total flux into each state balances the total flux out. Detailed balance demands something far stronger: that each individual term of the sum vanishes.

P_i · W(i→j) = P_j · W(j→i)      for every pair (i, j)

Every forward flux is cancelled by its reverse flux, one link at a time. There is no net circulation anywhere in the state graph. This is the condition that characterises genuine thermodynamic equilibrium, as opposed to a merely stationary nonequilibrium steady state.

Symbols and units

SymbolMeaningUnits
P_iEquilibrium probability of state idimensionless (Σ P_i = 1)
W(i→j)Transition rate i to js⁻¹ (continuous) or per-step probability
J_ijNet probability current = P_i W(i→j) − P_j W(j→i)s⁻¹
E_iEnergy of state iJ (or eV)
k_BBoltzmann constant1.380649 × 10⁻²³ J/K
TAbsolute temperatureK
βInverse temperature = 1/(k_B·T)J⁻¹

Why it keeps the Boltzmann distribution stationary

The canonical equilibrium distribution is Boltzmann's:

P_i = (1/Z) · exp(−E_i / (k_B·T)),    Z = Σ_i exp(−E_i / (k_B·T))

Take the ratio of two equilibrium probabilities — the partition function Z cancels:

P_j / P_i = exp(−(E_j − E_i) / (k_B·T))

Detailed balance rearranges to a constraint purely on the rates:

W(i→j) / W(j→i) = P_j / P_i = exp(−(E_j − E_i) / (k_B·T))

Any microscopic dynamics whose rates satisfy this ratio automatically balances every link when P is Boltzmann. And because detailed balance implies stationarity, the Boltzmann distribution is then a fixed point: dP_i/dt = 0. This is the deep reason thermalisation works — a heat bath supplies transition rates obeying exactly this ratio, and the system inexorably relaxes to P_i ∝ e^(−βE_i). Notice the argument never required knowing Z, only energy differences.

Detailed balance vs. global balance

The distinction is best seen on a three-state cycle A → B → C → A. Suppose the clockwise rates all equal k_+ and the counter-clockwise rates all equal k_−.

PropertyGlobal balance (stationary)Detailed balance (equilibrium)
ConditionΣ_j (P_j W_{ji} − P_i W_{ij}) = 0P_i W_{ij} = P_j W_{ji} per link
Net link current J_ijMay be nonzero (circulating)Exactly zero everywhere
Three-state cycleUniform P = 1/3 is stationary for any k_±Requires k_+ = k_− (no drift)
Entropy production rate≥ 0, positive if current flowsExactly 0
Time-reversalGenerally brokenStatistically symmetric
Free-energy inputNeeded to sustain currentNone (closed, isolated)

For the cycle with uniform P = 1/3, global balance is satisfied for any k_+ and k_−: each state receives and emits the same total. But the net current around the loop is J = (1/3)(k_+ − k_−), which is nonzero unless k_+ = k_−. So the uniform distribution can be a perfectly good nonequilibrium steady state that circulates probability endlessly — and detailed balance is precisely the extra condition that outlaws it. Kolmogorov's criterion captures this: detailed balance holds if and only if the product of forward rates around every closed loop equals the product of reverse rates.

Worked example — the Metropolis algorithm

The single most consequential application is Markov-chain Monte Carlo. To sample configurations with Boltzmann weights P_i ∝ e^(−βE_i) — say the spins of an Ising model — you build a Markov chain whose stationary distribution is Boltzmann, by engineering detailed balance. The Metropolis recipe (Metropolis, Rosenbluth, Rosenbluth, Teller & Teller, J. Chem. Phys. 1953):

  1. From configuration i, propose a symmetric move to j (e.g. flip a random spin): proposal g(i→j) = g(j→i).
  2. Compute ΔE = E_j − E_i.
  3. Accept the move with probability A(i→j) = min(1, e^(−βΔE)). If ΔE ≤ 0 always accept; if ΔE > 0 accept with probability e^(−βΔE).

The effective rate is W(i→j) = g(i→j)·A(i→j). Check detailed balance for E_j > E_i:

P_i · W(i→j) = e^(−βE_i) · g · e^(−β(E_j−E_i)) = g · e^(−βE_j)
P_j · W(j→i) = e^(−βE_j) · g · 1                = g · e^(−βE_j)   ✓ equal

Detailed balance holds by construction, so the Boltzmann distribution is the unique stationary distribution of an ergodic chain — and long-run averages of any observable converge to thermal expectation values. The Metropolis–Hastings generalisation (Hastings, 1970) removes the symmetric-proposal requirement by using A = min(1, [P_j g(j→i)] / [P_i g(i→j)]), restoring detailed balance for asymmetric proposals. The whole enterprise sidesteps the exponentially large partition function Z entirely.

// Metropolis single-spin update obeying detailed balance
const k_B = 1.380649e-23;   // J/K (use reduced units J/k_B = 1 below)

// Reduced units: beta = 1/T, energies in units of coupling J
function metropolisStep(spins, T, coupling = 1) {
  const N = spins.length;
  const beta = 1 / T;
  const i = Math.floor(Math.random() * N);

  // Energy cost of flipping spin i (1D chain, periodic)
  const left  = spins[(i - 1 + N) % N];
  const right = spins[(i + 1) % N];
  const dE = 2 * coupling * spins[i] * (left + right);  // E_j - E_i

  // Acceptance A = min(1, exp(-beta*dE)) — this line encodes detailed balance
  if (dE <= 0 || Math.random() < Math.exp(-beta * dE)) {
    spins[i] = -spins[i];   // accept the flip
  }
  return spins;
}

// Verify the rate ratio equals the Boltzmann ratio for dE = +2 at T = 1
const dE = 2, T = 1;
const acceptRatio = Math.exp(-dE / T);           // W(i->j)/W(j->i)
const boltzRatio  = Math.exp(-(dE) / T);         // P_j/P_i
console.log(acceptRatio.toFixed(4), boltzRatio.toFixed(4)); // 0.1353 0.1353 — detailed balance ✓

Detailed balance and time-reversal symmetry

Detailed balance is the statistical shadow of microscopic reversibility. Newton's equations, Maxwell's equations, and the Schrödinger equation are all invariant under t → −t (for time-reversal-even fields). At equilibrium this symmetry surfaces as detailed balance: a recorded movie of the equilibrium fluctuations, played backwards, is statistically indistinguishable from the forward movie, because for every observed transition i→j the reverse j→i occurs equally often. Formally, the equilibrium two-time correlation obeys ⟨A(0)B(t)⟩ = ⟨A(t)B(0)⟩.

From this reversibility Lars Onsager derived his reciprocal relations (1931, Nobel Prize 1968): the matrix of linear transport coefficients is symmetric, L_ij = L_ji — so, for instance, the thermoelectric cross-coefficient linking a temperature gradient to charge flow equals the one linking a voltage to heat flow. When time-reversal symmetry is broken — by an external magnetic field B or a Coriolis (rotating-frame) force — detailed balance in its simple form can fail, and one uses the generalised Onsager–Casimir relations L_ij(B) = L_ji(−B).

The catch — nonequilibrium steady states

A stationary distribution is not automatically an equilibrium one. A nonequilibrium steady state (NESS) has constant probabilities yet carries persistent circulating currents J_ij ≠ 0 — detailed balance is broken. Such states are ubiquitous in the living world: a kinesin motor stepping along a microtubule, the citric-acid cycle, or an ion channel rectifying flow all cycle preferentially in one direction, powered by ATP hydrolysis (≈ 20 k_B·T ≈ 50 kJ/mol of free energy per molecule at physiological conditions). Any system wired between two reservoirs at different temperatures or chemical potentials sits in a NESS. These states produce entropy at a constant positive rate σ = Σ J_ij·ln[P_i W_{ij} / (P_j W_{ji})] > 0, whereas true equilibrium (detailed balance) has σ = 0 exactly. The circulating current is the microscopic signature of the free energy being continuously dissipated.

Common misconceptions

  • "Stationary means equilibrium." No. Stationarity is global balance; equilibrium is detailed balance. Every equilibrium is stationary, but a stationary state can circulate current (a NESS) and violate detailed balance.
  • "Detailed balance needs the partition function." Only the rate ratio W(i→j)/W(j→i) = e^(−βΔE) matters, and it depends only on energy differences. Z cancels — which is exactly why Monte Carlo can sample without ever computing Z.
  • "Any rates that thermalise obey detailed balance." Not necessarily. You can construct rates (e.g. a biased cycle) that still relax to the Boltzmann distribution as a stationary state while violating detailed balance link-by-link. Detailed balance is sufficient for Boltzmann stationarity, not strictly necessary.
  • "Detailed balance always holds in equilibrium." It holds for time-reversal-symmetric microscopic dynamics. In a magnetic field or rotating frame the simple form is replaced by the Onsager–Casimir version; naive detailed balance can be violated even at equilibrium.
  • "It's just a bookkeeping identity." It is a physical statement about the absence of net microscopic currents and the vanishing of entropy production — a sharp, testable dividing line between equilibrium and driven systems.
  • "Metropolis needs symmetric proposals." Plain Metropolis does; Metropolis–Hastings restores detailed balance for asymmetric proposals by folding the proposal ratio g(j→i)/g(i→j) into the acceptance probability.

Frequently asked questions

What is the detailed balance condition?

Detailed balance says that in equilibrium every pair of states balances individually: P_i·W(i→j) = P_j·W(j→i). Here P_i is the equilibrium probability of state i and W(i→j) is the transition rate (or probability) from i to j. The flux i→j exactly cancels the flux j→i, so the net probability current across every single link of the state graph is zero. It is a much stronger statement than saying the total inflow to each state equals the total outflow.

What is the difference between detailed balance and stationarity?

Stationarity (the global balance condition) only requires that the total probability flowing into each state equals the total flowing out: Σ_j [P_j·W(j→i) − P_i·W(i→j)] = 0 for every i. Detailed balance requires each term of that sum to vanish separately: P_i·W(i→j) = P_j·W(j→i). Every distribution satisfying detailed balance is stationary, but the reverse is false — a nonequilibrium steady state can be stationary while carrying persistent circulating currents (for example a three-state cycle A→B→C→A), which detailed balance forbids.

Why does detailed balance keep the Boltzmann distribution stationary?

For the Boltzmann distribution P_i ∝ exp(−E_i / k_B·T), the ratio of equilibrium probabilities is P_j/P_i = exp(−(E_j − E_i)/k_B·T). Any dynamics whose rates obey W(i→j)/W(j→i) = exp(−(E_j − E_i)/k_B·T) automatically satisfies P_i·W(i→j) = P_j·W(j→i). Because detailed balance implies stationarity, the Boltzmann distribution is then a fixed point of the master equation: dP_i/dt = 0 for all i. This is exactly why detailed-balance rates relax any initial distribution toward thermal equilibrium.

How does detailed balance make the Metropolis algorithm work?

The Metropolis algorithm (Metropolis, Rosenbluth, Rosenbluth, Teller & Teller, 1953) proposes a move i→j symmetrically and accepts it with probability A = min(1, exp(−(E_j − E_i)/k_B·T)). This acceptance rule is engineered so that P_i·W(i→j) = P_j·W(j→i) with P ∝ exp(−E/k_B·T). Because the chain obeys detailed balance and is ergodic, its unique stationary distribution is the Boltzmann distribution — so long-run sampling draws configurations with the correct thermal weights without ever computing the intractable partition function Z.

Is detailed balance related to time-reversal symmetry?

Yes. Detailed balance is the statistical statement of microscopic reversibility: at equilibrium a movie of the fluctuations run backwards is statistically indistinguishable from the forward movie, because every forward transition is matched by its reverse. Onsager's 1931 reciprocal relations for transport coefficients are derived directly from this microscopic time-reversal symmetry. When a magnetic field or a rotating frame breaks time-reversal symmetry, detailed balance can fail and must be generalized (for example Onsager–Casimir symmetry L_ij(B) = L_ji(−B)).

Can a system be in a steady state without detailed balance?

Absolutely — these are nonequilibrium steady states (NESS). They are stationary (probabilities do not change in time) yet carry nonzero circulating probability currents, so detailed balance is violated. Molecular motors, biochemical reaction cycles driven by ATP hydrolysis, and any system coupled to two reservoirs at different temperatures or chemical potentials live in such states. The persistent currents require a continuous supply of free energy and produce entropy at a constant positive rate, unlike true equilibrium where entropy production is exactly zero.

What is Kolmogorov's criterion for detailed balance?

Kolmogorov's criterion lets you test for detailed balance using only the rates, without knowing the equilibrium distribution. A Markov chain satisfies detailed balance if and only if, for every closed loop of states i₁→i₂→…→i_n→i₁, the product of forward rates equals the product of reverse rates: W(i₁→i₂)·W(i₂→i₃)···W(i_n→i₁) = W(i₁→i_n)···W(i₃→i₂)·W(i₂→i₁). If any cycle's forward and reverse products differ, no equilibrium distribution can balance every link and the steady state must carry a net current around that loop.