Getting negative variance

38 Views Asked by At

The joint probability density function of 2 random variables X and Y is given by : $f_{X,Y} (x, y) = c x (2 - y)$, $x > 0$, $y > 0$, $x + y < 2$.

I calculated that $c = \frac{1}{2}$

I must find E[Y] and Var(Y) so I calculated the marginal density for y : $f_Y(y) = \int_{0}^{2}f_{X,Y}(x,y)dx = \int_{0}^{2} (2cx - cxy)dx = [cx^2 - \frac{1}{2}cx^2y]_0^2 =$ $2 - y$

So $E[Y] = \int_{0}^{2} yf_Y(y)dy = \int_{0}^{2} (2y - y^2)dy = [y^2 - \frac{1}{3}y^3]_0^2 = 4 - \frac{8}{3} =\frac{4}{3}$

and $Var(Y) = E[Y^2] - (E[Y])^2$.

$E[Y^2] = \int_{0}^{2} y^2f_Y(y)dy = \int_{0}^{2}(2y^2 - y^3)dy = \frac{16}{3} - 4 = \frac{4}{3}$

So finally $Var(Y) = \frac{4}{3} - \frac{16}{9} = -\frac{4}{9}$

Which is impossible...

What did I do wrong ?