Is it possible that two independent variables become dependent conditioning on a third random variable

Is that possible that random variables $X$ and $Y$ are independent but they are no longer independent if condition on another random variable $Z$? Is there a mathematical example and an approximate real life example for it? What does it mean intuitively that two random variables are independent but condition on another random variable, these two old random variables suddenly have relation?

I was thinking about the following real life example. Say a doctor wants to know if a new medicine is effective of reduce the blood pressure of the population (for all men and women). Let $Y_{1i}$ be the random variable represents the distribution of the blood pressure of the population if they all take the medicine and $Y_{0i}$ be the random variable represents the distribution of the blood pressure of the population if they all did not take the medicine. Let $D_i$ be the random outcome of the $i^{th}$ coin flip. So if it is head, then subject $i$ takes the medicine and if it is tail, then subject $i$ drinks pure water. So in this case, $D_i$ is independent of $Y_{1i}$, i.e., learning the value of $D_i$ does not help you to know better about the distribution of $Y_{1i}$. But now, what if I tell you subject $i$ is male, then condition on this information, will $D_i$ and $Y_{1i}$ be independent?

Suppose that we flip a fair coin twice, and let $X,Y$ be the indicator random variables that the first or second flip is heads. Then $X$ and $Y$ are independent.

However, if $Z=X+Y$, then $X$ and $Y$ are not independent conditioned on $Z$, since for instance $$\mathbb{P}(X=1,Y=1\mid Z=1)=0$$ while $$\mathbb{P}(X=1\mid Z=1)\mathbb{P}(Y=1\mid Z=1)=\frac{1}{2}\cdot\frac{1}{2}=\frac{1}{4}$$

• Each of $X$ and $Y$ is dependent on $Z$ but they are still independent of each other. The question is a little unclear about whether this is the kind of relationship being sought. – David K Aug 22 '16 at 20:13
• My interpretation of the question was find a random variable $Z$ such that $X$ and $Y$ are no longer independent under the probability law obtained by conditioning on an event in $\sigma(Z)$. – carmichael561 Aug 22 '16 at 20:16
• That's a plausible interpretation. I'm just not sure what the question is asking. (There's also still the question, what is the intuition behind this?) – David K Aug 22 '16 at 20:18

Yes. Consider The result of two independent Coin.

Conditioning on sum of results Works!

• carmichael561 posted this answer a minute earlier. – David K Aug 22 '16 at 20:11
• @DavidK when i answered the question there was no any answer... – MR_BD Aug 22 '16 at 20:14
• This has happened to my own answers more than once, that in the time it took to write the answer, someone already posted a very similar answer that I did not see until afterward. But their answer occurred first. You can check the time by mousing over the "answered N minutes ago" under each answer. – David K Aug 22 '16 at 20:15
• Thanks for these theoretical examples, that makes sense. I made up a "real life" example and I just updated my post – KevinKim Aug 22 '16 at 20:36
• @DavidK not really... I scrolled down to this answer, said "ah!" and I didn't have to read carmichael's answer. – djechlin Nov 9 '18 at 17:15 These are two examples illustrating conditional independence. Each cell represents a possible outcome. The events R, B and Y are represented by the areas shaded red, blue and yellow respectively. The overlap between the events R and B is shaded purple. The probabilities of these events are shaded areas with respect to the total area. In both examples R and B are conditionally independent given Y because:

$\Pr(R\cap B\mid Y)=\Pr(R\mid Y)\Pr(B\mid Y)$,

but not conditionally independent given not Y because:

$\Pr(R\cap B\mid {\text{not }}Y)\not =\Pr(R\mid {\text{not }}Y)\Pr(B\mid {\text{not }}Y)..$

• Nice answer. (+1) – MR_BD Apr 13 '17 at 14:25