Solution (source code)

= Solution

Let $\bar\pi$ be the normalized target and $\bar\pi_{-i}$ its <marginal distribution>. A coordinate-$i$ kernel $P_i$ leaves $x_{-i}=x'_{-i}$ and has the joint old-new measure
$$
\bar\pi(dx)P_i(x,dx')=
\bar\pi_{-i}(dx_{-i})\,
\pi_i(x_i\mid x_{-i})\,dx_i\,
\pi_i(x_i'\mid x_{-i})\,dx_i'\,
\delta_{x_{-i}}(dx'_{-i}).
$$
This is symmetric in the old and new state: the common remaining coordinates are fixed and the two conditional factors exchange places. Thus each coordinate kernel satisfies <detailed balance>. Averaging them with the fixed weights $1/p$ proves
$$
\boxed{\bar\pi(dx)P(x,dx')=\bar\pi(dx')P(x',dx).}
$$
Integrating out the old state proves invariance of $\bar\pi$. The common normalization cancels, so detailed balance can also be written with the unnormalized target. This establishes <detailed balance of a random-scan Gibbs sampler> and a <reversible Markov chain>. Fresh independent random choices make the update a <Markov chain>, as explained above; invariance is not an assertion that an arbitrarily initialized chain starts in stationarity.