# From independence to conditional independence

Consider two random variables $X,Y, Z$. Suppose $X\perp Z$ and $Y\perp Z$, where $\perp$ denotes independence.

Is it true that ($X\perp Y$) implies ($X\perp Y$ conditional on $Z$)? I know that in general independence does not imply conditional independence, but I was wondering whether the fact that $X$ and $Y$ are independent of $Z$ simplifies things.

• No. Say you are tossing two fair coins. $X$ is the event "the first coin comes up $H$". $Y$ is the event "the second coin comes up $H$". $Z$ is the event "the two coins come up the same" – lulu Apr 27 '17 at 15:03
• Is in your example $X$ independent of $Z$? – STF Apr 27 '17 at 15:06
• Of course. Knowing that the two coins match doesn't tell me what the first coin came up. – lulu Apr 27 '17 at 15:07
• OK, what additional condition I would need to go from independence to conditional independence? – STF Apr 27 '17 at 15:08
• Well, you could just assume conditional independence. Not sure there's some natural intermediate assumption.... – lulu Apr 27 '17 at 15:09

It is well known that there exist events $$A,B,C$$ such that any two of them are independent but $$P(A\cap B\cap C) \neq P(A)P(B)P(C)$$. Take $$X=I_A.Y=I_B,Z=I_C$$ to get a counterexample.

$$X\perp Y | Z$$ implies that $$p(X \cap Y|Z) = p(X|Z)p(Y|Z)$$.

And further we can obtain:

\begin{align} \begin{array}{rc} X\perp Y | Z \implies& p(X \cap Y|Z) = p(X|Z)p(Y|Z) \\ \implies& \frac{p(X \cap Y|Z)}{p(Y|Z)}=p(X|Z) \\ \implies& p(X|Y,Z) = p(X|Z) \end{array} \end{align}

And if $$X \perp Z$$, $$Y\perp Z$$ and $$X\perp Y$$ we can get:

\begin{align} p(X|Y,Z) &= \frac{p(X, Y, Z)}{p(X,Z)} \\ & = \frac{p(X)p(Y|X)p(Z|Y, X)}{p(X)p(Z|X)} \\ & = \frac{p(Y)p(Z|X,Y)}{p(Z)} \end{align}

So the first case $$X \perp Z$$, $$Y\perp Z$$ and $$X\perp Y$$ cannot imply the second $$X\perp Y | Z$$.

I hope the above reduction and reasoning hold.