First let me apologise for my poor english, it's not my first language.

Here is the joint density function:

$\displaystyle

f(y,x)=\left\{\begin{array}{cc}e^{-y},&\mbox{ if }

0 \leq x \leq y \leq 0,\\0, & \mbox{ elsewhere. } \end{array}\right.

$

I'm trying to find $\displaystyle E(Y-X)$ and subsequenty $\displaystyle V(Y-X)$.

I started by finding the marginal density functions:

$\displaystyle f_1(Y)= \int_{0}^{y} e^{-y} dx = xe^{-y}\Big|^{y}_{0}=ye^{-y}

$

and

$\displaystyle f_2(X)= \int_{x}^{\infty} e^{-y} dy = -e^{-y}\Big|^{\infty}_{x} =e^{-x}$

Integration isn't really my strong suit, but I think I'm on the right path here. Next, finding $\displaystyle E(Y)$ and $\displaystyle E(X)$

$\displaystyle E(Y)= \int_{x}^{\infty} y^2e^{-y}dy= -\frac{y^3}{3}e^{-y}\Big|^{\infty}_{x}=\frac{x^3}{3}$

$\displaystyle E(X)= \int_{0}^{y} xe^{-x}dx=-\frac{x^2}{2}e^{-x}\Big|^{y}_{0}=-\frac{y^2}{2}e^{-y}$

This seems really counter-intuitive, but I'm not sure what I'm doing wrong (or right for that matter). I'd really appreciate any help. Thanks in advance.