Our joint density function is
$f_{(x,y)} (x,y) = \frac{1}{4}(y-x)e^{-y}$ for $-y<x<y$ and $y>0$ and 0 elsewhere.
I know $Cov(X,Y) = E(XY) -E(X)E(Y).$
But I get that E(X) is not finite:
$f_x(x) = \int_{0}^{\infty} .25*(y-x)e^{-y}dy = \frac{1}{4}(1-x)$
$E(X)=\int_{0}^{\infty}x*\frac{1}{4}(1-x)dx$ which I got to diverge.
Where did I mess up or does the covariance not exist?
Your formula for marginal distribution should be $f_X(x) = \frac{1}{4}e^{-|x|}(|x|-x+1)$), but we don't need it. We can just use a double integral to compute all the moments from the the joint distribution: $$ \begin{aligned} E[X^m Y^n] &= \int_{-\infty}^\infty \int_{-\infty}^\infty \frac{e^{-y}}{4}x^m y^n (y-x) \left[|x| < y\right] \ dx \ dy \\ &= \int_{0}^\infty \int_{-y}^y \frac{e^{-y}}{4}x^m y^n (y-x)\ dx \ dy \\ &= \int_{0}^\infty \frac{y^n e^{-y}}{4} \int_{-y}^y (yx^m - x^{m+1}) dx \ dy \\ &= \int_{0}^\infty \frac{y^n e^{-y}}{4} \left. \left(\frac{yx^{m+1}}{m+1}-\frac{x^{m+2}}{m+2}\right) \right|_{-y}^y \ dy \\ &= \left(\frac{1-(-1)^{m+1}}{m+1}-\frac{1-(-1)^{m+2}}{m+2}\right) \int_{0}^\infty \frac{y^{n+m+2} e^{-y}}{4} \ dy \\ &= \begin{cases} \frac{(m+n+2)!}{2(m+1)}& m \text{ even}\\ -\frac{(m+n+2)!}{2(m+2)} & m \text{ odd}\end{cases} \end{aligned} $$ Where we use $\int_{0}^\infty y^{n} e^{-y} \ dy =\Gamma(n+1) = n!$. Hence $$ \begin{aligned} E[X] &= -\frac{3!}{2(3)} = -1 \\ E[Y] &= \frac{3!}{2(1)} = 3\\ E[XY] &= -\frac{4!}{2(3)} -4 \\ \mathrm{Cov}(X,Y) &= -4 - (-1)(3)=-1 \end{aligned} $$