How does the Metropolis–Hastings acceptance probability follow from detailed balance, and why is Gibbs sampling a special case whose proposals are always accepted?
Probabilistic models, MCMC
Level L4 Advanced. Length Long. Nature Mat Mathematical.
What's being asked
Whether you can build a Markov chain with a prescribed stationary distribution, and connect the two standard MCMC algorithms.
Key idea
With proposal and target , accepting with gives , which is detailed balance, so is stationary. For Gibbs, with , where means all coordinates except , and the ratio is exactly 1.
Steps
- Show that detailed balance implies stationarity: summing over gives .
- For the MH kernel is . Detailed balance requires Only the ratio of the two acceptance probabilities is fixed, so we still have a free choice.
- Choose the largest acceptance probabilities with this ratio: if , set and ; if , the reverse. Both cases are . Rejected moves keep the chain at , which does not affect detailed balance for .
- Note that enters only as a ratio, so its normalising constant is not needed. For a symmetric proposal the ratio is (the Metropolis algorithm).
- Gibbs: update coordinate by proposing and keeping . Write . Then so every proposal is accepted.
- Say what else convergence needs: irreducibility and aperiodicity, so that the stationary distribution is unique and the chain approaches it; in practice, burn-in and autocorrelation.
Common mistakes
- Dropping the proposal ratio for an asymmetric proposal, which samples from the wrong distribution.
- Claiming detailed balance is necessary for stationarity. It is sufficient, not necessary.
- Discarding rejected steps. A rejection means the chain repeats , and that repeat must be kept as a sample.
How long your answer should be
About a page; 8–10 minutes.
Last checked on 4 December 2026.
Read this
- Bishop, Pattern Recognition and Machine Learning, Sections 11.2–11.3: Free PDF. Sections 11.2.1–11.3 (pp. 539–546): detailed balance, the MH acceptance probability (11.44), and on p. 544 the derivation that Gibbs is MH with acceptance probability 1.
- MacKay, Information Theory, Inference, and Learning Algorithms: Free PDF. Chapter 29, Monte Carlo Methods (Sections 29.4–29.5): intuitive treatment of Metropolis–Hastings and Gibbs sampling, with pictures of random-walk behaviour.
- MIT OCW: 6.438 Algorithms for Inference: Lecture 18: Markov Chain Monte Carlo Methods, which covers Metropolis-Hastings, detailed balance and Gibbs sampling.
Previous in Probabilistic models: An MCMC chain has post-burn-in draws of a quantity with variance and autocorrelations . What is the effective sample size , how does the Monte Carlo standard error compare with the naive , and what happens to the information if you thin the chain by keeping every 20th draw?
Next in Probabilistic models: In mean-field variational inference, with , show that the optimal factor satisfies . How is this used as an algorithm?