Updating One Component at a Time
In Markov chain Monte Carlo, a target distribution may be difficult to sample from jointly even when sampling one variable at a time is straightforward. Gibbs sampling uses this structure: retain the current value of one component, and draw the other from its conditional distribution given the retained value. The resulting transition is designed around the target itself, so its invariance can be checked directly from the definition of conditional probability.
Let \((\Omega,\mathcal{F},\mathbb{P})\) be a probability space, and let the state space be a product \(E_1\times E_2\). Suppose the target distribution has a density \(\pi(x,y)\) with respect to a product reference measure \(\nu_1(dx)\nu_2(dy)\). Assume \(\pi\geq 0\) and \(\int_{E_1}\int_{E_2}\pi(x,y)\nu_2(dy)\nu_1(dx)=1\). Define the marginal densities \(\pi_1(x)=\int_{E_2}\pi(x,y)\nu_2(dy)\) and \(\pi_2(y)=\int_{E_1}\pi(x,y)\nu_1(dx)\).
A Gibbs update of the first component starts from \((X_n,Y_n)=(x,y)\), draws \(X_{n+1}\) from \(\pi(\,\cdot\mid y)\), and sets \(Y_{n+1}=y\). A Gibbs update of the second component instead draws \(Y_{n+1}\) from \(\pi(\,\cdot\mid x)\) and keeps \(X_{n+1}=x\). Thus each update changes one coordinate, and the conditional used for that draw depends on the coordinate that is held fixed.
For clarity, the first-coordinate transition kernel is, for measurable sets \(A\subseteq E_1\) and \(B\subseteq E_2\),
The current value \(x\) does not appear on the right-hand side: after the update, the new first coordinate depends on the old state through \(y\), while the second coordinate remains exactly \(y\). The analogous second-coordinate kernel is \(K_Y((x,y),A\times B)=\mathbf{1}_A(x)\int_B\pi(v\mid x)\nu_2(dv)\).
Why a Full Conditional Update Preserves the Target
Proof. Consider first the update of the first coordinate. The current second coordinate has marginal density \(\pi_2(y)\), and, given \(Y_n=y\), the new first coordinate has density \(\pi(x'\mid y)\). Therefore the joint density of \((X_{n+1},Y_{n+1})\), at \((x',y)\), is \(\pi_2(y)\pi(x'\mid y)\). For every \(y\) with \(\pi_2(y)>0\), the definition of the conditional gives \(\pi_2(y)\pi(x'\mid y)=\pi(x',y)\). Values with \(\pi_2(y)=0\) contribute zero to the joint distribution. Hence the updated density equals \(\pi(x',y)\) almost everywhere. For the second-coordinate update, the same calculation gives \(\pi_1(x)\pi(y'\mid x)=\pi(x,y')\) wherever \(\pi_1(x)>0\), and the zero-marginal values again contribute zero. Thus either update preserves the joint target. \(\square\)
This calculation expresses the key idea: the update keeps the distribution of the fixed coordinate equal to its target marginal and then draws the changed coordinate from the target conditional given that value. Multiplying the marginal and conditional reconstructs the joint distribution. Invariance is a statement about what happens when the chain is already distributed according to \(\pi\); by itself it does not say that a chain started elsewhere will approach \(\pi\).
Proof. The theorem shows that applying either update to a state with distribution \(\pi\) produces a state with distribution \(\pi\). After the first update the distribution is therefore still \(\pi\), so the theorem applies again to the next update. Repeating this argument for each update in the finite sequence proves the assertion. \(\square\)
Worked Conditional Calculations
Worked Example: A Dependent Density on the Unit Square
Let \(E_1=E_2=(0,1)\), with Lebesgue measure, and take an unnormalized density \(f(x,y)=1+xy\). First find the normalized target and both full conditionals.
The normalizing constant is
Thus \(\pi(x,y)=\tfrac45(1+xy)\) on the square. Its second-coordinate marginal is \(\pi_2(y)=\int_0^1\tfrac45(1+xy)\,dx=\tfrac45(1+y/2)\). Dividing the joint density by this marginal gives
Likewise, \(\pi_1(x)=\int_0^1\tfrac45(1+xy)\,dy=\tfrac45(1+x/2)\), so \(\pi(y\mid x)=(1+xy)/(1+x/2)\) for \(0<y<1\). To check a particular conditional, set \(y=\tfrac12\). Then \(\pi(x\mid \tfrac12)=\tfrac45+\tfrac25x\), and its integral is \(\int_0^1(\tfrac45+\tfrac25x)\,dx=\tfrac45+\tfrac15=1\). Its probability of \(0<X<\tfrac12\) is \(\tfrac45\cdot\tfrac12+\tfrac25\cdot\tfrac18=\tfrac25+\tfrac1{20}=\tfrac9{20}\).
Check by reconstruction: multiplying the second marginal by the first-coordinate conditional gives \(\tfrac45(1+y/2)\cdot(1+xy)/(1+y/2)=\tfrac45(1+xy)=\pi(x,y)\). This verifies the conditional formula and, by the theorem, the invariance of the first-coordinate update.
Worked Example: A Uniform Target on a Triangle
Consider the target density \(\pi(x,y)=2\) on the region \(0<y<x<1\), and \(0\) elsewhere. The region has area \(\int_0^1x\,dx=\tfrac12\), so its density integrates to \(2\cdot\tfrac12=1\). For \(0<y<1\), the second marginal is \(\pi_2(y)=\int_y^1 2\,dx=2(1-y)\). Therefore the conditional density of \(X\) given \(Y=y\) is \(\pi(x\mid y)=1/(1-y)\) for \(y<x<1\), and zero otherwise. For \(0<x<1\), the first marginal is \(\pi_1(x)=\int_0^x2\,dy=2x\), so \(Y\mid X=x\) is uniform on \((0,x)\), with density \(1/x\).
For example, when \(y=\tfrac14\), \(X\mid Y=\tfrac14\) is uniform on \((\tfrac14,1)\), with density \(1/(1-\tfrac14)=\tfrac43\). Its probability of \(\tfrac14<X<\tfrac58\) is \(\tfrac43(\tfrac58-\tfrac14)=\tfrac43\cdot\tfrac38=\tfrac12\). The conditional integrates to \(\tfrac43(1-\tfrac14)=1\), as required.
Check by reconstruction: the second marginal times the conditional density is \(2(1-y)\cdot1/(1-y)=2\) for \(y<x<1\), and is zero outside the triangle. This reproduces the target density. The support restriction matters: a draw of \(X\) must lie above the retained value \(y\).
Worked Example: A Gibbs Update on a Finite State Space
Let \(X,Y\in\{0,1\}\), with unnormalized joint weights \(w(0,0)=1\), \(w(0,1)=2\), \(w(1,0)=3\), and \(w(1,1)=4\). Their sum is \(1+2+3+4=10\), so the target probabilities are these weights divided by \(10\). Given \(Y=0\), the first-coordinate probabilities are \(1/4\) for \(X=0\) and \(3/4\) for \(X=1\). Given \(Y=1\), they are \(2/6=1/3\) and \(4/6=2/3\). These conditionals follow by normalizing within each column of the joint weights.
Use the state order \(00,10,01,11\), where the first digit is \(X\) and the second is \(Y\). The transition matrix for updating \(X\) and retaining \(Y\) is
Each row sums to \(1\): the first two rows sum to \(\tfrac14+\tfrac34=1\), and the last two sum to \(\tfrac13+\tfrac23=1\). In the stated order the target row vector is \(\pi=(\tfrac1{10},\tfrac3{10},\tfrac2{10},\tfrac4{10})\). Its mass on states with \(Y=0\) is \(\tfrac1{10}+\tfrac3{10}=\tfrac4{10}\); after the update, this mass is split as \(\tfrac4{10}\cdot\tfrac14=\tfrac1{10}\) on \(00\) and \(\tfrac4{10}\cdot\tfrac34=\tfrac3{10}\) on \(10\). The mass with \(Y=1\) is \(\tfrac2{10}+\tfrac4{10}=\tfrac6{10}\); it is split as \(\tfrac6{10}\cdot\tfrac13=\tfrac2{10}\) on \(01\) and \(\tfrac6{10}\cdot\tfrac23=\tfrac4{10}\) on \(11\). Hence \(\pi P=(\tfrac1{10},\tfrac3{10},\tfrac2{10},\tfrac4{10})=\pi\), and the entries sum to \((1+3+2+4)/10=1\).
What Invariance Does—and Does Not—Tell Us
Gibbs updates are useful when the full conditionals are easier to sample from than the joint target. In the two-variable setting, the basic construction requires only the joint density, its marginals, and the ability to draw from the resulting conditional distributions. The invariance proof does not require a special form for the density, such as independence or a Gaussian structure. It does require correct conditionals, including the correct support and normalizing constants.
A common mistake is to use a conditional distribution that ignores the support imposed by the joint target. For the triangular target above, one might incorrectly draw \(X\) uniformly on \((0,1)\) while holding \(Y=y\). At \(y=\tfrac14\), this incorrect rule assigns probability \(\tfrac14\) to \(0<X<\tfrac14\), since the interval has length \(\tfrac14\). But the target assigns probability zero to that region: its support requires \(X>Y\). The correct conditional is uniform on \((\tfrac14,1)\), which assigns zero probability below \(\tfrac14\). The error is not a harmless change in sampling efficiency; it uses the wrong conditional and fails to preserve the stated target.
There is also a separate limitation to keep in mind. A one-coordinate update leaves the other coordinate unchanged, so that single update cannot explore the whole product state space from every starting point. In the continuous case, for instance, a first-coordinate update retains the initial \(y\) exactly. Invariance is therefore not a convergence theorem. Whether a sequence of updates can explore the relevant support, and whether its distributions converge to the target, are separate questions that require additional conditions.
Check Your Understanding
Use the definitions and invariance argument above to answer these questions.
- For a joint density \(\pi(x,y)\), write the full conditional density of \(X\) given \(Y=y\), and state when this ratio is defined.
- For a first-coordinate Gibbs update, which coordinate is retained? Express the updated joint density as a marginal times a conditional.
- For the density proportional to \(1+xy\) on the unit square, calculate \(\pi(x\mid y)\) and verify that it integrates to \(1\).
- For the triangular target \(0<y<x<1\), what is the support of \(X\mid Y=y\), and why would a uniform draw on \((0,1)\) be incorrect?
- In the finite example, verify the updated probability of state \(11\) by multiplying the mass with \(Y=1\) by the conditional probability of \(X=1\) given \(Y=1\).
- Explain why invariance of a Gibbs update, by itself, does not establish convergence from an arbitrary initial state.