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?