Finding $E(XY)$ from a uniform distribution I have this question where I got $E(X)$ already but I'm struggling with $E(XY)$:
Let $U$ be a random variable uniformly distributed over $[ 0,2π ]$ . Deﬁne $X = \cos U$ and $Y = \sin U$. Show that $X$ and $Y$ are dependent but that $\mathrm{Cov}(X,Y) = 0$.
Given that $E(X)=0$, I skipped $E(Y)$ and I'm now finding $E(XY)$.
What I did was
$$\int^{2/π}_{0}\int^{2/π}_{0} xy \cdot \cos(x) \sin(y) \, \mathrm{d}x \, \mathrm{d}y$$
But the answer was different
$$E(XY )= \frac{1}{2π}∫_0^{2 π} \cos(u ) \sin(u ) \, \mathrm{d}u = 0$$
which I don't understand the reasoning behind. I tried solving mine after following this equation:
$$E(XY) = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} xy f_{X,Y} (x,y) \, \mathrm{d}x \, \mathrm{d}y.$$
Can someone please explain why it's not right? Also how are my bounds? I'm kind of concerned about whether the outer one is correct or not.
 A: Your mistake is to think of $X$ and $Y$ as though they could have taken values independently, but they are both determined by $U$. The expectation of $XY$ is hence
$$E(XY) = \int_{\mathbb{R}} \frac{1}{2\pi} \cos(u) \sin(u) \, \mathrm{d}u = \frac{1}{2\pi} \int_0^{2 \pi} \cos(u) \sin(u) \, \mathrm{d}u.$$
This is the so-called "Law of the Unconscious Statistician": If $X$ is distributed according to some PDF $p$ and $f$ is continuous (more lenient assumptions also work, but let's just go with continuous so as not to overcomplicate). Then the expectation of $f(X)$ is given by
$$\int_{\mathbb{R}} p(x) f(x) \, \mathrm{d}x.$$
In our case $p \equiv \frac{1}{2 \pi}$ since $U$ is uniform on the given interval and $f(x) = \cos(x) \sin(x).$
A: 
I tried solving mine after following this equation:
$$E(XY) = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} xy f_{X,Y} (x,y) \, \mathrm{d}x \, \mathrm{d}y.$$
Can someone please explain why it's not right?

That is correct.  However, the joint probability function, $f_{X,Y}(x,y)$, is not $\cos(x)\sin(y)\mathbf 1_{x\in[0,2/\pi),y\in[0,2/\pi)}$ .
It is possible to determine the joint distribution, but involves a fair amount of effort.

So we use the fact that $XY=\cos(U)\sin(U)$, and therefore we can use the density function for the distribution of $U$ :
$$\begin{align}\mathsf E(XY)&=\mathsf E(\cos(U)\sin(U)\\[2ex]&=\int_\Bbb R\cos(u)\sin(u)\,f_U(u)\,\mathrm d u\\[2ex]&=\dfrac 1{2\pi}\int_0^{2\pi}\cos(u)\sin(u)\,\mathrm d u\end{align}$$
