Suppose we want the mean separation of particles under the canonical position law. We can evaluate for any proposed configuration, but cannot integrate over a space with coordinates. The normalising constant is the very integral we hoped sampling would avoid. How can an algorithm use a distribution it cannot normalise?
The answer will be to compare local probability ratios. Before introducing a chain, we should understand what ordinary independent sampling already provides, and what we give up by replacing it.
4.1 An integral is an expectation under a chosen measure
Let and choose a normalised sampling density positive wherever contributes. If are independent draws from , then
Absolute integrability justifies the expectation and a law of large numbers. If is finite, the estimator is unbiased and has variance . A central limit theorem then gives the familiar standard-error rate. The exponent does not depend on dimension; the variance and cost per evaluation certainly can.
For a finite-volume domain of volume , uniform sampling gives . Hit-or-miss sampling gives another low-dimensional construction: for , draw uniformly from and estimate by times the fraction lying below the graph. This trades function values for indicators and often increases variance. In low dimensions, smooth deterministic quadrature can be far more efficient.
Independent draws can be obtained by inverse transforms in suitable one-dimensional distributions or by rejection sampling. The latter uses an envelope for a nonnegative unnormalised target, accepting a proposal with probability . It does not require the target normaliser, but it does require a valid envelope, which can be extremely inefficient in high dimensions. Thus an unknown partition function is an obstacle, not a proof that all direct sampling is impossible.
4.2 Spend samples where they matter
Importance sampling chooses to reduce fluctuations in . For a nonnegative integrand, the ideal choice makes that quantity constant, but normalising this ideal density requires knowing . For signed , minimises the second moment among admissible densities, yet cancellation can still make relative error large.
In statistical mechanics the desired quantity is usually a ratio:
If independent samples from were available, we would simply average . Sampling from an accessible auxiliary instead gives a self-normalised weighted estimator. It is generally biased at finite , and poor overlap can concentrate almost all weight on a handful of observations. We need a way to target the physically relevant configurations without constructing a global independent sampler.
What happens if we transport uniform draws towards the large parts of an integrand, then compensate for the changed sampling density?
Î = mean[f(X)/p(X)]; ∫₀¹ f(x) dx = 1
22 samples; latest weight 0.037; integral estimate 0.921.
Paused. Play the sequence, step through it, or drag the position slider.
f(x) = 6x(1−x), 0 < x < 1, integral one. The normalised mixture p = (1−η) + ηf is sampled by deterministic bisection of its CDF using a fixed random seed. Curves are finite-run estimates, not confidence bands.
4.3 Replace a global draw by local transitions
A Markov chain has the property that the law of conditional on its history depends only on . Its transition kernel describes that law. On a finite state space it is a matrix with nonnegative entries and rows summing to one.
A measure is stationary when
or, in continuous state space, for every measurable set . A chain started at stationarity has the right distribution at every step, although successive states may be strongly correlated. Starting from a convenient instead introduces an equilibration problem.
4.4 Balance probability flow
Stationarity balances all incoming flow. A stronger sufficient condition is detailed balance:
Summing over proves stationarity because the rows of sum to one. Detailed balance also makes the stationary chain reversible: a finite path has the same probability as its time reverse. It is useful for constructing algorithms, but it is not required for equilibrium sampling.
4.5 The Metropolis–Hastings construction
At , propose from . When target and proposal densities are available, accept with
A proposal with positive forward density and zero reverse density has acceptance zero in this construction. For , the probability flux is
This expression is symmetric in , proving detailed balance. The unused probability remains at , completing the stochastic kernel. The diagonal term must be included; a proposed move and an actual transition are different objects.
For a symmetric proposal and a Boltzmann target,
The partition function cancels in . Downhill moves are accepted; uphill moves are sometimes accepted because equilibrium is a distribution, not an optimisation problem. A practical update draws an independent and accepts when . Rejection records the current state again.
A rejection is part of the sample
Consider two states of energies and , with . Always propose the other state. The transition matrix and stationary probabilities are
The equilibrium flux in either direction is . Imagine deleting every repeated state from a trajectory. What distribution would the remaining sequence represent?
Count jumps: one visit each
Ignoring holding times gives equal jump frequencies.
Count attempts: residence 4 : 1
Residence-weighted observations recover the Boltzmann probabilities.
The figure shows expected residence per two-jump cycle, not a randomly generated trajectory. This distinction will explain why rejection-free methods must retain waiting-time information rather than merely delete rejections.
Propose a displacement in a double well, inspect its energy cost, and then watch whether the chain moves or stays.
α = min(1, exp[−βΔU])
Attempt 22: rejected; ΔU = 0.87; acceptance 0.175.
Paused. Play the sequence, step through it, or drag the position slider.
Seeded Metropolis demonstration in U(x) = (x² − 1)², symmetric uniform displacement in [−1.2,1.2]. This short run starts at x = −1 and is not evidence of equilibration or an estimate of mixing time. Proposals above the energy plot are marked at its upper edge, with their true ΔU in the readout.
4.6 Invariance is necessary, exploration is additional
For a finite state space, irreducibility means every state can reach every other in some finite number of transitions. With irreducibility, a stationary probability is unique and time averages of integrable observables obey an ergodic law. Aperiodicity additionally gives convergence of the time- distribution from every starting state. A finite irreducible chain is positive recurrent automatically. For countably infinite chains, positive recurrence is an additional requirement; continuous-state theorems use measure-theoretic irreducibility and suitable Harris-recurrence hypotheses. Exact-point reachability is not the right definition for a continuous density.
Rejections can establish aperiodicity if they produce a positive self-transition in an irreducible finite chain. Metropolis does not guarantee that this happens. With a uniform target and a forced two-state flip, every proposal is accepted and the chain alternates forever. It has a valid stationary law and valid time averages, but its one-time distribution does not converge from a fixed initial state. A lazy update, retaining the state with some fixed positive probability, removes that periodicity while preserving the target.
Nor can acceptance rules repair disconnected proposals. Moves restricted to one basin or one conserved sector cannot sample a target that also assigns mass elsewhere. At zero temperature, uphill acceptance vanishes and finite-temperature irreducibility arguments may fail.
4.7 Moves inherit the geometry of the state space
For atomistic NVT sampling, select a particle uniformly and displace it by a symmetric random vector. Periodic wrapping preserves that symmetry when implemented consistently. Only interactions involving the moved particle change for a pairwise model, so the energy difference can often be evaluated locally. Very small displacements give high acceptance but slow exploration; very large ones mostly fail. The useful criterion is uncertainty per computation, not acceptance alone.
For an Ising configuration from Chapter 2, a symmetric single-spin proposal gives
Rotations of rigid molecules, vector-spin rotations, collective displacements and occupation exchanges require proposals defined with respect to their appropriate measures. Particle insertions and deletions target open ensembles, with chemical potential, particle-number factors and proposal volumes in the acceptance ratio; the fixed- displacement rule cannot be reused unchanged. Pressure-controlled simulations combine position moves with the volume acceptance ratio.
MCMC constructs a tool for integration. Its step count does not generally represent physical time. We can use it to predict equilibrium energy or structure, but not infer a transport coefficient from an arbitrary sequence of accepted displacements. The next chapter separates these observables and quantifies the information in correlated samples.
Exercises
- Verify in the two-state example and show that the accepted-jump chain has a different stationary distribution.
- Prove that preserves any stationary measure of . What happens to its finite-state period?
- Derive the Ising energy change by cancelling all bonds not incident on the flipped site.