I have the following problem:
The variables $X$ and $Y$ have the joint probability: $f(x,y)=2 $ for $0 \le y \le x \le 1$. What is the covariance between $X$ and $Y$?
The answer is 1/36
I know that $\operatorname{Cov}(x,y) = E[XY] - E[X]E[Y]$
First I calculated the marginal PDFs since it was the first part of the question.
$f_x(x)=2x $ and $f_y(y) = 2(1-y)$
To calculate $E[X], E[Y]$ I need to multiply with $x$ and $y$ and integrate. Do I need to integrate for both $x$ and $y$ from 0 to 1? If not what will be the integration boundaries?
How do I calculate $E[XY]$? I tried with the following integral:
$$\int_0^{1} \int_0^{x} (2xy) \mathrm{d}y \mathrm{d}x$$
But I'm not sure if this is correct, since I don't get the right answer.
You could use the expression $Cov(X,Y)=E((X-\mu_X)(Y-\mu_Y))$ instead. Since you have the marginals, $\mu_X$ and $\mu_Y$ should be easy to compute.