# How to know when two random variables are independent?

A pair of r.v (X,Y) is equally likely to be of any of these pairs of values $$(0,1), (1,0), (-1,0), (0,-1)$$. Both X and Y have mean = 0.

1. $$E[XY]=$$?
2. Is $$Var(X+Y) = Var(X) + Var (Y)$$?

I know that if X and Y are independent, $$E[XY] = E[X]E[Y] = µxµy$$. But my doubt is that nowhere in the question above it is stated that X and Y are independent. Same with the second question, I know that it is valid only if X and Y are independent (Please correct me if I am wrong).

So how do I know if they are independent only using the info from the question above?

To solve this one, let's go back to first principles: what does it actually mean for two events $$A, B$$ to be independent?

There're many ways to formulate this, but we'll go with this one: the probability of event $$A$$ conditioning on event $$B$$ is equal to the probability of event $$A$$. That is: $$P(A|B) = P(A)$$, or alternatively, $$P(A \cap B) = P(A)P(B)$$. For two random variables to be independent, we treat each assignment to $$k$$ variables as $$k$$ events. This guarantee must hold for all value assignments to the random variables for them to be independent.

What we are given here? We have the joint distribution of $$X$$ and $$Y$$. Let's just take the first point, $$(0,1)$$, and go from there:

Claim. Random variables $$X, Y$$ are independent.

Disproof. By contradiction; suppose $$X, Y$$ are independent. Then $$P(X = 0 \cap Y=1) = P(X=0)P(Y=1)$$. We can then write $$\frac{1}{4} = \frac{1}{2}\cdot\frac{1}{4}$$, which is clearly false, so $$X$$ and $$Y$$ are not independent.

Hope this helps!

• Not quite sure I understand. How do you get P(x=0) = 1/2 and P(y=1) =1/4? And what formulas should I use for the problem if they are not independent? Since I assume that they are independent, just have no idea how. Feb 17, 2020 at 3:26
• I counted the number of times they each appeared in the joint distribution, which you gave above. Under the assumption that all of these points are equally likely, this should be valid. This seems to yield the result that X and Y are non-independent. Feb 17, 2020 at 3:29
• Oh I see, thanks tchainzz. I was too presumptuous to say that they were assumed to be independent. Feb 17, 2020 at 4:44

You don't need to determine whether the random variables are independent or not to answer the questions in the text of your question.

For discrete random variables $$X$$ and $$Y$$ taking on values in the respective sets $$\{u_i\}$$ and $$\{v_j\}$$, $$E[XY] = \sum_i\sum_j u_iv_jp_{X,Y}(u_i, v_j)\tag{1}$$ where $$p_{X,Y}(u_i, v_j)$$ is the joint probability mass function of the random variables. For your problem, $$\{u_i\} = \{v_j\} = \{-1,0,+1\}$$ and it is easily seen that in the nine terms in $$(1)$$, either $$u_iv_j = 0$$ or $$p_{X,Y}(u_i, v_j)=0$$ and so $$E[XY] = E[X]E[Y]$$ just as would happen if $$X$$ and $$Y$$ were independent (they are not independent in this case).

Turning to the matter of the variances, $$X+Y$$ is a random variable taking on values $$-1$$ and $$+1$$ with respective probabilities \begin{align}P(X+Y=-1) &= p_{X,Y}(0, -1) + p_{X,Y}(-1, 0) = \frac 12\\ P(X+Y=+1) &= p_{X,Y}(0, +1) + p_{X,Y}(+1, 0) = \frac 12 \end{align} where the claim that both probabilities equal $$\frac 12$$ is justified by the fact that the means of $$X$$ and $$Y$$ are given to be zero and so it must be that $$p_{X,Y}(-1, 0) = p_{X,Y}(+1, 0)$$ and $$p_{X,Y}(0, -1)= p_{X,Y}(0, +1)$$. Consequently, $$\operatorname{var}(X+Y) = 1$$. I leave it to you to determine what the variances of $$X$$ and $$Y$$ are and whether $$\operatorname{var}(X+Y)$$ equals the sum of $$\operatorname{var}(X)$$ and $$\operatorname{var}(Y)$$ or not. You will definitely be surprised since I know that it is valid only if X and Y are independent is not correct. It is not what you don't know that will kill you; it is what you know that just a'int so.

• Hi Dilip, thanks for your explanation. Yeah, I guess I took the independence of the r.v.s for granted and thought everything really depended on the independence of things. Will definitely keep this in mind. Thanks again! Feb 18, 2020 at 6:53