negative variance... (getting correlation from joint density)

Question. Consider random variables X and Y with joint density

$\displaystyle f(x)=\left\{\begin{array}{cc}8xy,&\mbox{ if }

0<x<y<1\\0, & \mbox{ if } otherwise\end{array}\right$

Evaluate Corr (X,Y).

Answer.

To use Corr (X,Y) formula, I will need to know Cov(X,Y)=E(XY)-E(X)E(Y) and Var(X) and Var(Y). This is a simple question but I keep getting negative variance for X and I re-checked several times. Help!!

$\displaystyle f_X(x)=\int^{\infty}_{-\infty}f_{X,Y}(x,y)dy=\int^1_x8xydy=8x[\frac{y^2}{2}]^1_x=8x(\frac{1}{2}-\frac{x^2}{2})=4x(x-x^2)=4x-x^3$ (on the interval 0<x<1, and 0 otherwise)

$\displaystyle E(X)=\int^{\infty}_{-\infty}xf_{X}(x)dx=\int_0^1x(4x-x^3)dx=\int_0^1(4x^2-x^4)dx=$

$\displaystyle =[\frac{4x^3}{4}-\frac{x^5}{5}]_0^1=4/3-1/5=17/15$

$\displaystyle E(X^2)=\int^{\infty}_{-\infty}x^2f_{X}(x)dx=\int_0^1x^2(4x-x^3)dx=$

$\displaystyle =\int_0^1(4x^3-x^5)dx=$

$\displaystyle =[4x^4/4-x^6/6]_0^1=1-1/6=5/6$

Then $\displaystyle Var(X)=E(X^2)-E(X)^2=5/6-(17/15)^2=-203/450 <0$ (Headbang)

(For Y, $\displaystyle f_Y(y)=4y^3$ and Var(Y)=2/75, so I should be able to proceed to find Cov and Corr if I have a positive result for Var(X)).

thanks!