Glauber dynamics and Gibbs sampling
Construct a finite sampler from exact conditional laws and distinguish stationarity, uniqueness and rapid mixing.
On this page
The question for today
What you’ll understand
- Write single-site Gibbs transitions from a normalized conditional law.
- Prove detailed balance for random-scan coordinate updates.
- State when finite Gibbs sampling has a unique stationary law and why that says nothing by itself about speed.
Sampling a joint probability law may be difficult even when sampling one coordinate conditional on the rest is easy. Gibbs sampling turns those conditional draws into a Markov chain. For finite configurations, strictly positive target weights and positive probabilities of choosing every coordinate give a clean irreducible aperiodic sampler. But correct conditionals guarantee invariance rather than immediate equilibration, and finite uniqueness does not rule out very slow mixing or multiple Gibbs states in an infinite-volume limit. Those are distinct questions requiring distinct hypotheses.
Condition on everything except the chosen site
Let the configuration space be a finite Cartesian product and let π be a strictly positive probability on every configuration. Choose a coordinate i with fixed positive probability rᵢ, summing to one, and redraw its value from π conditional on all other coordinates. Other coordinates remain unchanged. The conditional denominator is the sum of target weights over possible values at that site with the surrounding configuration held fixed. It is not the global normalization constant, which cancels. This cancellation is the practical attraction when π is known only through unnormalized positive weights.
If two distinct configurations differ only at coordinate i, their transition probability is rᵢ times the appropriate conditional mass. Multiplying by π of the source shows a symmetric product of their two target weights divided by the same conditional denominator. This proves detailed balance for that update and, by summing over coordinates, for the random-scan kernel. State-independent coordinate-selection probabilities matter to this elementary proof; arbitrary state-dependent scan choices can change the invariant law unless their effects are explicitly compensated.
Finite positivity gives uniqueness, not speed
With strict positivity on the full finite product, any configuration can be reached by changing coordinates one at a time, because every required conditional draw has positive probability. Redrawing the current value also has positive probability, giving a self-loop. Thus the sampler is irreducible and aperiodic, with unique stationary law π and convergence from every start. This conclusion does not provide a useful bound on the number of updates: conditional probabilities may be tiny, and competing high-probability regions can create small conductance.
If some configurations have zero target mass, restrict the state space to the positive support and check its single-site connectivity. Correct conditional updates can preserve π while leaving several closed components, producing multiple stationary laws. Hard constraints or zero-temperature limits often require this extra analysis. Systematic scans also preserve π because each coordinate-update kernel preserves it, but the composition is generally not reversible and its time unit is a whole scan rather than one random coordinate update. Infinite-volume Gibbs-state uniqueness is a further question and is not settled by uniqueness on every finite box.
Local refreshes still leave global information
For independent coordinates, a conditional redraw ignores the neighbors, yet a single-site update still refreshes only one coordinate. Unselected sites retain their initial values. Coupling copies with the same selected sites and the same conditional draws shows why a coupon-collection scale can arise for many independent coordinates. For interacting coordinates, identical site choices and random numbers need not immediately erase discrepancies because the conditional thresholds depend on neighboring spins. Contraction arguments must quantify how much disagreement one update can create or remove.
This also explains the difference between preserving the target and drawing an exact independent sample from it. Starting already from π, every subsequent marginal remains π; starting elsewhere, one conditional update usually leaves the joint law different. Successive stationary observations can still be correlated, affecting Monte Carlo error even after initialization bias is controlled. A justified sampling analysis therefore combines an invariance proof with a convergence estimate and a variance calculation for the actual observable rather than treating a stationary formula as a complete performance certificate.
Work it through
Two aligned spins from conditional weights
Give configurations ++ and −− unnormalized weight 3 each, and +− and −+ weight 1 each. Choose either spin with probability 1/2 and redraw it conditionally. Compute π, the row from ++, and one detailed-balance check.
The total weight is eight, so π(++ )=π(−−)=3/8 and each mixed configuration has mass 1/8.
Given the other spin, the chosen spin matches it with probability 3/4 and differs with probability 1/4. From ++, the probabilities to +− and −+ are each (1/2)(1/4)=1/8, leaving hold probability 3/4.
From +− to ++, choose the second spin and match the first, giving probability 3/8. The stationary flows are (3/8)(1/8)=3/64 and (1/8)(3/8)=3/64, as required.
The kernel is reversible for the stated nonuniform target. All conditional probabilities are positive, so this finite sampler has a unique stationary law, but one update is not a global refresh.
The living notebook
Explore the model
Interactive lab · markov
A complete Bernoulli refresh is a special two-state Gibbs update
Pause and Reset, then set p=0.30,q=0.70. Both transition rows equal the Bernoulli law with state-1 probability 0.30, so predict that one Step reaches the stationary law exactly. For a fresh comparison Reset and set p=0.15,q=0.35; these are half-hold plus half-refresh transitions, and after one Step predict state-1 probability 0.15 while the stationary readout remains 0.30. This is one variable, not a multi-spin Gibbs simulation or evidence of rapid mixing for interacting systems.
- P(state 1) at step 0
- 0%
- Stationary P(state 1)
- 60%
- Chain behavior
- Monotone convergence
Exact finite-step probabilities for a two-state chain starting in state 0, not sampled trajectories. Playback advances two transitions per second. When p = q = 0 every distribution is stationary; when p = q = 1 the chain alternates forever. A single zero transition creates an absorbing state. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forCorrect stationary conditionals can coexist with partial refresh and persistent dependence on the initial state.
Pause & reason
Check your understanding
Your turn
Try it yourself
Let two independent bits have success probability 3/10. Start at 00 and redraw one uniformly chosen bit from its conditional law. Compute the one-step distribution and its total variation from the target product law.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Only one bit can become one after a single update. Compare all four configuration masses, including 11.
Compare with the solution
In order 00,10,01,11, the one-step law is (7/10,3/20,3/20,0). The stationary product law is (49/100,21/100,21/100,9/100). Their differences are 21/100,−6/100,−6/100,−9/100. Half the sum of absolute differences is 21/100. The target is invariant under the update, but this nonstationary start has not reached it in one transition because one bit remains unrefreshed.
Keep the idea
Take it with you
- Gibbs updates draw from a coordinate’s exact conditional law.
- Strict positivity on a finite full product gives uniqueness through irreducibility.
- Invariance, fast mixing and independent samples require separate arguments.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.