# Math Help - Need help with a joint density function

1. ## Need help with a joint density function

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

Here is the joint density function:

$
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 $E(Y-X)$ and subsequenty $V(Y-X)$.

I started by finding the marginal density functions:

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

$

and

$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 $E(Y)$ and $E(X)$

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

$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.

2. Haven't done this in a while, so I just looked on wikipedia. This is what it said (for expected value):

Expected value - Wikipedia, the free encyclopedia
result is valid even if X is not statistically independent of Y.

So in your case E(Y - X) = E(Y) - E(X).

To find your V(Y-X), you'll need to use the following property:

Variance - Wikipedia, the free encyclopedia
since in your case X and Y are not independent, their covariance is not 0.

3. Thank you.

Could you maybe look over my integrations for E(Y) and E(X). I'm not really confident I've done them correctly and would appreciate any help

4. In your calculations of E(Y) and E(X), did you use integration by parts? If you didn't, then you made a mistake.

5. That's the mistake I made. Now it makes sense. Thanks again for your help.