# Two value random variables which are independent

I am a bit confused about some notions from probabilities, and I'm asking for clarifications. The problem is the following:

Let $X$ and $Y$ be two random variables, each taking values either $a$ or $b$. Assume that $\mathbb{E}(XY)=\mathbb{E}(X)\mathbb{E}(Y)$. Prove that $X$ and $Y$ are independent.

So, if say $a$ and $b$ are the values that they can take, to show that they are independent, we have to check that $\mathbb P(X=x,Y=y)= \mathbb P(X=x) \mathbb P(Y=y)$ for all $x,y \in \left\{a,b\right\}$, right?

How does that follow from the equality on expectations?

-
Have you written out the three expectations? – cardinal Mar 4 '12 at 0:19
By the way, it appears you've asked more than 20 questions but have not registered your account. You should consider doing so. – cardinal Mar 4 '12 at 0:20
I didn't realize I have to sign in; sure! – Anna Mar 4 '12 at 0:40
So, $\mathbb{E}(XY)=a^{2}P(X=a,Y=a) + ab (P(X=a,Y=b)+P(x=b,y=a))+ b^{2} (P(X=b,Y=b)$ and $\mathbb{E}(X)\mathbb{E}(Y)=...$. Why does it follow that the coefficients of the values should be equal? – Anna Mar 4 '12 at 0:42
Hint: What is $P\{X=a,Y=a\}+P\{X=a,Y=b\}$? Use this together with cardinal's suggestion to express $E[X]E[Y]$ in terms of the joint pmf instead of the marginal pmfs, and compare the expressions for $E[XY]$ and $E[X]E[Y]$. – Dilip Sarwate Mar 4 '12 at 1:36

Step 1: Prove the result for a simple subcase. Here the most obvious choice (why?) is to take $a = 0$ and $b = 1$. What do you need to check?
Step 2: Think about how your approach in Step 1 might generalize. In many cases (Hint: This one!) it is possible to go from the specific case to the general one with very little extra work. Can you take a random variable $X$ on $\{a,b\}$ and convert it in a simple way to another random variable $\tilde X$ on $\{0,1\}$? How does this allow you to conclude the general result?