# Independence of two intertwined random variables

Let $$X_0$$, $$X_1$$ and $$X_2$$ be three mutually independent random variables. We define two more random variables $$D_1$$ and $$D_2$$ as follows: $$D_1 = X_1 + X_0\\[1ex] D_2 = X_2 + X_0$$ We're interested in arguing (in the most effective and simple way) if

1. $$D_1$$ and $$D_2$$ are independent
2. $$D_1|X_0=x_0$$ and $$D_2|X_0=x_0$$ are independent

If $$D_1$$ and $$D_2$$ are independent, it must be $$\text{Cov}(D_1,D_2)=0$$:

$$\text{Cov}(D_1, D_2)=\mathbb{E}[D_1 D_2]-\mathbb{E}[D_1]\mathbb{E}[D_2] =\\ =\mathbb{E}\left[ (X_1+X_0)(X_2+X_0) \right] - \mathbb{E}\left[ X_1+X_0 \right]\mathbb{E}\left[ X_2+X_0 \right]=\\ =\mathbb{E}\left[ X_1 X_2 + X_1 X_0 + X_0 X_2 + X_0^2 \right] - \mathbb{E}\left[ X_1 \right]\mathbb{E}\left[ X_2 \right] - \mathbb{E}\left[ X_1 \right]\mathbb{E}\left[ X_0 \right] - \mathbb{E}\left[ X_0 \right]\mathbb{E}\left[ X_2 \right] - \left(\mathbb{E}\left[ X_0 \right]\right)^2=\\ =\mathbb{E}\left[ X_1 \right]\mathbb{E}\left[ X_2 \right] + \mathbb{E}\left[ X_1 \right]\mathbb{E}\left[ X_0 \right] + \mathbb{E}\left[ X_0 \right]\mathbb{E}\left[ X_2 \right] + \mathbb{E}\left[ X_0^2 \right] - \mathbb{E}\left[ X_1 \right]\mathbb{E}\left[ X_2 \right] - \mathbb{E}\left[ X_1 \right]\mathbb{E}\left[ X_0 \right] - \mathbb{E}\left[ X_0 \right]\mathbb{E}\left[ X_2 \right] - \left(\mathbb{E}\left[ X_0 \right]\right)^2=\\ =\mathbb{E}\left[ X_0^2 \right] - \left(\mathbb{E}\left[ X_0 \right]\right)^2 = \text{Var}(X_0)\neq 0$$

So, if not for the trivial case in which $$X_0 = \text{constant}$$, $$\mathbf{D_1}$$ and $$\mathbf{D_2}$$ are not independent.

2. One could do the same thing of point 1. all over again or just notice that this case is exactly the trivial one in which $$X_0 = x_0$$, a fixed "constant". So, $$\mathbf{D_1|X_0 =x_0}$$ and $$\mathbf{D_2|X_0 =x_0}$$ are independent.

# MY QUESTION

Are my proofs correct? Is there a simpler way to prove the same thing or even just argument the same results in a better, more intuitive way?

# A BONUS QUESTION

How can I test these theoretical results with the following example? (In order to really "see" what I found)

$$X_0$$ is the outcome of the fair coin "COIN": $$X_0=1$$ if Heads, $$X_0=0$$ if Tails.

$$X_1$$ is the outcome of the 6-faced fair dice "DICE1": $$X_1=\{1,2,3,4,5,6\}$$

$$X_2$$ is the outcome of the 6-faced fair dice "DICE2": $$X_2=\{1,2,3,4,5,6\}$$

SOMETHING THAT PERPLEXES ME

Intuitively and "constructively", I would say that the event to observe $$D_1=k$$ is independent from that of observing $$D_2 = h$$, infact the first is the event of obtaining $$X_1 + X_0 = k$$ with a throw of DICE1 and a toss of COIN while the second is the event of obtaining $$X_2 + X_0 = k$$ with a throw of DICE2 and a different toss of COIN: these two "procedures" are totally independent from each other and so should be their probabilities (?)

But this contradicts my analytical results, doesn't it! Why is that?

• For (2) you actually want to argue that $D_1$ and $D_2$ are conditionally independent given $X_0$. The notation "$D_1\mid X_0=x_0$ and $D_2\mid X_0=x_0$ are independent" doesn't make sense.
– user140541
Feb 19, 2021 at 20:21
• @d.k.o. Thanks for the reply and the clarification: this is what was asked during an exam but I get how that makes no sense and, infact, conditionally independent is what I "unconsciously" meant :) What about point (1), is that way of proving it right? If so, could you help me with the SOMETHING THAT PERPLEXES ME that I added at the bottom of the post? Thanks a lot again! Feb 19, 2021 at 20:33
• The key point you added is a "different" toss of the coin. That is not what we mean by the notation $D_1=X_1+X_0$ and $D_2=X_2+X_0$. Instead, that notation means that $D_1$ and $D_2$ are both relying on the same outcome of the $X_0$ experiment. Feb 19, 2021 at 20:37
• @Nick Peterson Shouldn't it mean "same random variable" but (possibly) different outcome? If not, how would one go on about writing that? Feb 19, 2021 at 20:44
• Remember, random variables are functions from an event space to an outcome space; you can more formally write the above as $D_1(\omega)=X_1(\omega)+X_0(\omega)$ and $D_2(\omega)=X_2(\omega)+X_0(\omega)$, which makes the point more clear here. One underlying event ($\omega$) determines the values of each of these. What you are suggesting is more like having two IID variables Feb 19, 2021 at 21:33

Simulation with your coins and dice: With a million replications of the experiment, results should be accurate to two places.

set.seed(220)
x.0 = sample(0:1, 10^6, rep=T)
x.1 = sample(1:6, 10^6, rep=T)
x.2 = sample(1:6, 10^6, rep=T)
d.1 = x.1 + x.0
d.2 = x.2 + x.0
cov(d.1, d.2)
[1] 0.25046        # aprx 0.25
var(x.0)
[1] 0.2500002      # aprx 0.25


Matches your result that $$Cov(D_1,D_2) = Var(X_0).$$

cov(d.1[x.0==1], d.2[x.0==1])
[1] 0.0005137164   # aprx 0


Matches your result that the covariance of the conditional variables $$D_1 | X_0=1$$ and $$D_2 | X_0=1$$ is $$0.$$

If we simulate only 5000 values of each and uniformly jitter them (to avoid over-plotting of the discrete points), we can visualize the nature of the association between $$D_1$$ and $$D_2$$ in your example with coins and dice.

R code for figure:

set.seed(220);  m = 5000
x0 = sample(0:1, m, rep=T)
x1 = sample(1:6, m, rep=T)
x2 = sample(1:6, m, rep=T)
j1 = runif(m, -.2,.2);  j2 = runif(m, -.2,.2)
d1 = x1 + x0 + j1;  d2 = x2 + x0 + j2
plot(d1,d2, pch=".")

• Truly beautiful, thank you! Feb 21, 2021 at 9:38