The joint pdf of $X$ and $Y$ is given by $$ f_{X,Y}(x,y) = \frac{1}{8} (y^2 - x^2) e^{-y} I_{(0, \infty)}(y) I_{(-y,y)}(x)$$
Find the marginal pdf of $X$
My attempt:
$f_X(x) = \int_0^{\infty} \frac{1}{8} (y^2 - x^2) e^{-y} I_{(-y,y)}(x)dy = \\= \int_{-x}^{\infty} \frac{1}{8} (y^2 - x^2) e^{-y} I_{(-\infty,0)}(x)dy + \int_{x}^{\infty} \frac{1}{8} (y^2 - x^2) e^{-y} I_{(0, \infty)}(x)dy = \\= \frac{1}{4} e^x(x^2 - x + 1) I_{(-\infty,0)}(x)+ \frac{1}{4} e^{-x}(x^2 +x + 1) I_{(0, \infty)}(x)$
but this is not a pdf.
What am I doing wrong?
Thanks!
Hint: $$ I_{(0, \infty)}(y) I_{(-y,y)}(x)=I_{(|x|, \infty)}(y). $$ Consequence of the hint: the general identity $$ f_X(x)=\int_\mathbb R f_{X,Y}(x,y)\mathrm dy$$ reads in the present case $$ f_X(x)=\int_{|x|}^{+\infty}\frac18(y^2-x^2)\mathrm e^{-y}\mathrm dy, $$ that is, $$ f_X(x)=\left.-\frac18(y^2+2y+2-x^2)\mathrm e^{-y}\right|_{|x|}^\infty=\frac14\mathrm e^{-|x|}(1+|x|). $$