Suppose that the joint probability density of two random variables X and Y is given by: f(x,y) = 1/2, 0 < y < x < 2
First, I tried finding marginal densities f(x) and f(y)
$ f_1 (x)= ∫_0^x〖1/2 dy〗 = [1/2y]^x_0 = 1/2x,$ for 0 < x < 2
$ f_2 (y)= ∫_y^2〖1/2 dx〗 = [1/2x]^2_y = 1 – 1/2y, $ for 0 < y < x
Then I went on to find E(X) and E(Y):
$ E(X) = ∫^∞_∞〖xf(x,y) dx〗=∫_0^2〖(1/2 x^2 )dx= 〗 1/6 x^3]^2_0 = 4/3 $
$ E(Y) = ∫^∞_∞〖yf(x,y) dy〗=∫_0^x〖(y-1/2 y^3 )dy $
$ = 1/2 y^2-1/8 y^4]^2_0 = 1/2 x^2-1/8 x^4 = 3/2 $
Then, I calculated E(XY):
$ E(XY) = ∫^∞_∞∫^∞_∞〖xy f(x,y) dx dy〗 = ∫^2_0∫_y^2〖1/2 xy〗 dx dy$ = $∫_0^2〖[1/4 x^2y 〗 ]_y^2 dy = ∫_0^2 y-1/4y^3 dy = [1/2y^2-1/16y^4]^2_0 = 2-1 = 1 $
Finally, Cov(X,Y) = E(XY) - E(X)E(Y) = 1 - (4/3 * 3/2) = 1 - 2 = -1
Is this correct?
I really do not know if I am right and there is no source for me to check my answer. Please help.
I think ,you made some mistake(Green color).
$ f_X (x)= \int_0^x \frac{1}{2} dy = \frac{x}{2}$ for $0<x<2$
$ f_Y (y)= \int_y^2 \frac{1}{2} dx = \frac{x}{2}|^2_y = 1 – \frac{y}{2}, $ for $\color{green}{0 < y < 2}$
$ E(X) = \int_0^2 \frac{x^2}{2} dx= \frac{x^3}{6}|^2_0 =\frac{4}{3} $
$\color{green}{ E(Y) = \int_0^2 yf_Y(y) dy=\int_0^2 y(1 – \frac{y}{2}) dy= \int_0^2 y dy – \int_0^2 \frac{y^2}{2} dy=2-\frac{4}{3}=\frac{2}{3}}$
$$ E(XY) = \int^2_0 \int_y^2 \frac{xy}{2} dx dy$$ $$=\int^2_0 \frac{x^2y}{4}|_y^2 dy = \int_0^2 y-\frac{y^3}{4} dy = \left(\frac{y^2}{2}-\frac{y^4}{16}\right)|^2_0 = 2-1 = 1 $$