Conditioning can destroy independence (source code)

= Conditioning can destroy independence
{title2=$X\mathrel{\perp\!\!\!\perp}Y\;\not\!\Longrightarrow\;X\mathrel{\perp\!\!\!\perp}Y\mid Z$}

Return to <pairwise independence does not imply joint independence>, where $X,Y$ are <independent> fair <bits> and $Z=X\mathbin\oplus Y$ is their <exclusive or>. Given $Z=0$, only $000$ and $110$ remain, each with conditional <probability> $1/2$. Given $Z=1$, only $011$ and $101$ remain, again each with conditional <probability> $1/2$. Consequently,
$$
J_{X,Y\mid Z=0}=\begin{pmatrix}1/2&0\\0&1/2\end{pmatrix},\qquad
J_{X,Y\mid Z=1}=\begin{pmatrix}0&1/2\\1/2&0\end{pmatrix}.
$$
The conditional <marginal distributions> are still fair, so their product has four entries $1/4$ in either case. The actual tables differ: $Y=X$ given $Z=0$, and $Y=1-X$ given $Z=1$. Thus unconditional <independence> need not survive conditioning. Observing whether two <bits> agree restricts their possible combinations; no physical interaction between the original trials is required to produce that information constraint.