TITLE: Why is it that $E(xy) = E(x)E(y)$ if $x$ and $y$ are uncorrelated random variables?
QUESTION [7 upvotes]: Also, why does $E(xy) = E(x)E(y)$ not hold if $x$ and $y$ are correlated? Perhaps at a more basic, intuitive level, what's the difference between $E(xy)$ and $E(x)E(y)$?

REPLY [15 votes]: Where $X$ and $Y$ are continuous random variables, by definition they are independent when $f_{XY}(x,y)=f_X(x)f_Y(y)$. Then we have$$\begin{align}E(XY)&=\int_{-\infty}^\infty f_{XY}(x,y)xydxdy \\
&=\int_{-\infty}^{\infty}f_X(x)f_Y(y)xydxdy \\
&=\int_{-\infty}^\infty f_X(x)xdx\int_{-\infty}^\infty f_Y(y)ydy \\
&=E(X)E(Y)
\end{align}$$
The proof in the discrete case is analogous. This shows why independence of $X$ and $Y$ implies that $E[XY]=E[X]E[Y]$. The converse does not necessarily hold—that is, we can come up with examples of random variables $X,Y$ with $E[XY]=E[X]E[Y]$ but which are not independent. Whenever $E[XY]=E[X]E[Y]$, $X$ and $Y$ are uncorrelated by definition: $$\text{Cov}(X,Y) = E[XY]-E[X]E[Y]=0\implies E[XY]=E[X]E[Y]$$