How do you determine if a pair of random variables are independent?

If $$A$$ is a subset of $$R$$ and $$X$$ is a random variable. I have two variables $$X_1$$ and $$X_2$$. $$I$$ being $$1$$ if $$X$$ in subset $$A$$ and $$0$$ if not in $$A$$. Let $$U$$~$$U(0;1)$$ and determine if this pair is independent. Verify your claim using simulation in Matlab.

$$X_1 = I_U \epsilon\left[\left.0,\frac{1}{3}\right.\right), X_2 = I_U\epsilon\left[\left.\frac{1}{3},\frac{2}{3}\right.\right)$$

I usually show my work done, but I cannot find how to determine if these are independent. My question: Please, can someone explain how to show if this pair is independent? From there, then I can attempt how to verify using Matlab.

• You might start by carefully writing down the definition of independence: what does it mean for two random variables to be independent? – Xander Henderson Apr 21 at 1:29

Intuitively, if we know that $$X_1$$ is one, then we know that $$X_2$$ is zero, so knowing $$X_1$$ means we know something about $$X_2$$, which suggests that they are not independent.

Explictly:

Let $$A=\{1\}$$. Compute $$P[X_1 \in A], P[X_2 \in A], P[X_1 \in A, X_2 \in A]$$.

Is $$P[X_1 \in A, X_2 \in A] = P[X_1 \in A] P[X_2 \in A]$$?

• I'm sorry. I am just getting caught up on notation and the simplest things. I am thrown off by the U being uniform (0,1), and then $X_1$ and $X_2$ have the additional U notation subscript. Is this correct: $f(x_1) =$ integral from 0 to 1/3 $(f(x)dx)$, but here $f(x)$ is just 1, so $f(x_1) = 1/3$. Same for $f(x_2)$, so $f(x_2) = 2/3-1/3 = 1/3$. $1/3*1/3 =1/9$, which is $P(x_1,x_2)$and it does equal to$P(x_1)*P(x_2), 1/3*1/3 = 1/9$. Or did I just compute the same thing 2 different ways? – PattyWatty27 Apr 21 at 4:40
• The notation is a little confusing. The variable $U$ is uniformly distributed on $[0,1]$. $X_1$ is one if $U \in [0,{1 \over 3})$ and zero otherwise. Similarly for $X_2$. You can just compute the probabilities directly, $P[X_1 =1] = P[U \in [0,{1 \over 3})] = {1 \over 3}$ and similarly for $X_2$. However, $P[X_1=1, X_2 = 1] = 0$. – copper.hat Apr 21 at 4:58
• Ok, so if I changed $X_2$ to $[\frac{2}{9}, \frac{2}{3})$: $P[X_1 =1]=P[U∈[0,\frac{1}{3} )]=\frac{1}{3}$ and $P[X_2 =1]=P[U∈[\frac{2}{9},\frac{5}{9} )]=\frac{1}{3}$, and the $P[X_1 =1,X_2 =1]=\frac{1}{9}$. which equals $P(X_1)*P(X_2) = \frac{1}{3}*\frac{1}{3} = \frac{1}{9}$, therefore, they are independent. And say I changed $X_2$ again, $P[X_2 =1]=P[U∈[\frac{2}{9},\frac{2}{3} )]=\frac{4}{9}$. In this case, it still holds that $P[X_1 =1,X_2 =1]=\frac{1}{9}$, but this does not equal $P(X_1)*P(X_2) = \frac{1}{3}*\frac{4}{9} = \frac{4}{27}$, therefore these would be dependent? – PattyWatty27 Apr 21 at 5:23
• Sorry, you lost me there. What are you trying to do? For $X_1,X_2$ to be independent you must show that $P[X_1 \in A, X_2 \in B] = P[X_1 \in A] P[X_2 \in B]$ for all $A,B$. – copper.hat Apr 21 at 5:40
• Sorry! I just wanted to make sure I understood you correctly, so I created 2 new scenarios. I just changed the bounds on $X_2$ given initially and recomputed the problem. – PattyWatty27 Apr 21 at 5:44