# Can two random variables, both of which are dependent on a 3rd random variable, be independent of each other?

Let's say we have three random variables $$X, Y, Z$$.

We know that $$X$$ and $$Y$$ are dependent, and also that $$Y$$ and $$Z$$ are dependent.

Under this setting, is it possible for $$X$$ and $$Z$$ to be independent?

(Intuitively, I think the answer is no. Knowing the value of $$X$$ would give us some information about $$Y$$, which in turn would give us some information of $$Z$$, making $$X$$ and $$Z$$ dependent. Although I can't seem to prove it.)

• Intuitively, the part of Y that correlates with X can be different from the part of Y that correlates with Z, such that X and Z are independent of each. So this is very common. In fact, it is the situation in which ANCOVA is recommended; X is categorical, while Z and Y are continuous. Commented Aug 7, 2018 at 15:09
• Imagine $X$ and $Z$ are the result of independent coin flips. Can you define $Y$ in such a way that it depends on both $X$ and $Z$? Commented Aug 7, 2018 at 21:28

\begin{align} X&=\text{outcome on first coin}\\ Y&=\text{sum of both outcomes}\\ Z&=\text{outcome on second coin} \end{align}
Continuous variable example Let $$(x,Y,Z)$$ have the multivariate normal distribution $$(X,Y,Z) \sim \mathcal{MN}(\begin{pmatrix}0\\0\\0\end{pmatrix},\begin{pmatrix}1&1/2&0\\1/2&1&1/2\\0&1/2&1\end{pmatrix}$$