# Proving If and Only If When X and Y are independent

Let X,Y be two random variables, defined on some probability space $(\Omega , A , P)$., each only has two district values: X $\to $$\{x_1,x_2\} , Y \to$$\{y_1,y_2\}$.

Recall that, in this case , X and Y are independent if, of any i , j (i , j = 1,2):

P(X= $x_i$ , Y = $y_i$) = P(X = $x_i$)P(Y =$y_i$)

Show that, in this vase, X and Y are independent if and only if

E(XY) = E(X)E(Y)

My proving Part( if ) Show that

Suppose X and Y are independent. Then for any (x,y) $\in$ $\mathbb{R}$

p(x,y) = P(X=x , Y=y) = P(X=x) P(Y=y) = p$_x$(x) p$_y$(y)

When p(x,y) = p$_x$(x) p$_y$(y) for all ($x,y)$ $in$ Then for any A $\subset$ $\mathbb{R}$ and B$\subset$ $\mathbb{R}$ So that

P(X $\in$A , Y $\in$ B) $=\sum_{X \in A} \sum_{y \in B}$ P(X=x , Y=y)

$=\sum_{X \in A} \sum_{y \in B}$ p$_x$(x) p$_y$(y)

$=\sum_{X \in A}$.p$_x$(x) $\sum_{y \in B}$ p$_y$(y)

=P(X $\in$A , Y $\in$ B)

Hence X and Y are independent

My proving True or False in part "if"

-
It seems like you're showing that $X$ and $Y$ being independent implies that $X$ and $Y$ is independent. –  Stefan Hansen Jul 13 '13 at 7:51

$\newcommand{E}{\mathbf{E}}$

Here is a sketch of a proof. Normalize the random variables by letting $\tilde{X} = \frac{X - x_1}{x_2-x_1}$ and $\tilde{Y} = \frac{Y - y_1}{y_2 - y_1}$. Show that $X$ and $Y$ are independent if and only if $\tilde{X}$ and $\tilde{Y}$ are, and use linearity of expectation to show $$\E[XY] = \E[X]\E[Y] \iff \E[\tilde{X}\tilde{Y}] = \E[\tilde{X}]\E[\tilde{Y}]$$

So it is sufficient to prove the claim for two 0-1 random variables. If $X$ and $Y$ are 0-1 random variables, $$\E[XY] = \E[X]\E[Y] \iff \Pr(X=1, Y=1)=\Pr(X=1)\Pr(X=1)$$

It is easy to confirm that the latter equality is equivalent to independence of $X$ and $Y$.

Note: Since all the implications in this proof are bidirectional, this proves both the "if" and "only if" parts of the question.

-
An exercise for the original poster: Show that (by an example!) this conclusion is <b>incorrect</b> if the two random variables each can take on three or more values. –  kjetil b halvorsen Jul 13 '13 at 13:50