problem with joint probability function The joint probability density function of $X$ and $Y$
is given by
$$f(x,y) = \begin{cases}c(y^2-x^2) e^{-y}, & -y \le x < +y, \ 0 \le y <  \infty,\\
0,  & \text{otherwise}. \end{cases}$$
(a) Find $c$.
(b) Find the marginal densities of $X$ and $Y$.
(c) Find $\operatorname{E}[X]$.
I have some problems with the point (b)
(a) $$
  \int_0^\infty\ \int_{-y}^y c(y^2-x^2)e^{-y}\,dy\,dx = 1 \Leftrightarrow c= \frac 1 8.
$$
(b) I calculate the marginal density of $Y$ as
$$ 
\int_{x=-y}^{x=+y} \frac 1 8 (y^2-x^2)e^{-y}\,dx = \frac 1 6 y^3 e^{-y},
$$
and the density of $X$ as
$$
\int_{y=0}^\infty\  c(y^2-x^2)e^{-y}\,dy, 
$$
but there something wrong because the solution is different.
Can someone help me to understand my mistake?
 A: There is nothing wrong with the marginal distributions looking different, with one being $f_Y(y) = \frac16 y^3 e^{-y}$ and the other being 
$$f_X(x) = \int_{y=|x|}^\infty \frac18 (y^2-x^2)e^{-y}dy =\frac14  (1+|x|) e^{-|x|}$$
They are marginal distributions for two different variables and the joint distribution is in no way symmetric so in general they would be two distinct distributions unless some staggering coincidence occurred. 
Your confusion was probably because you integrated from $y=0$ to infinity, rather than starting at $y=|x|$. Smaller values of $y$ lie outside the region of non-zero distribution function.  So you were probably puzzled about a marginal distribution that looked something like $\frac18 (2-x^2)$, which is what you get if you make that mistake.
A: The marginal density of $Y$ is
$$\int_{-y}^y c(y^2-x^2) e^{-y} \mathop{dx}=ce^{-y}(2y^3 - (2/3)y^3 ) = \frac{4c}{3} y^3 e^{-y}.$$
Integrating this over $y$ gives
$$1=\int_0^\infty \frac{4c}{3} y^3 e^{-y} \mathop{dy} = \frac{4c}{3} \cdot 3! = 8c \implies c=1/8.$$
So, the marginal density of $Y$ is $\frac{1}{6} y^3 e^{-y}$ as you obtained.

The marginal density of $X$ is
$$\int_{|x|}^\infty c(y^2-x^2) e^{-y} \mathop{dy}
.$$
The tricky part is the limits of integration, which comes from the condition $|x| \le y$.
First, integration by parts twice gives
\begin{align}
\int_{|x|}^\infty y^2 e^{-y} \mathop{dy}
&=[-y^2 e^{-y}]_{y=|x|}^\infty + 2\int_{|x|}^\infty ye^{-y} \mathop{dy}\\
&= x^2 e^{-|x|} + 2[-ye^{-y}]_{y=|x|}^\infty + 2\int_{|x|}^\infty e^{-y}\mathop{dy}\\
&= x^2 e^{-|x|} + 2|x|e^{-|x|} + 2e^{-|x|}\\
&= e^{-|x|}(|x|^2+2|x|+2).
\end{align}
So, the marginal density of $X$ is
$$\int_{|x|}^\infty c(y^2-x^2) e^{-y} \mathop{dy}
= c(e^{-|x|}(|x|^2+2|x|+2) - x^2 e^{-|x|}) = \frac{1}{4} e^{-|x|}(|x|+1).$$

Edit (explanation for why the lower limit of integration is $|x|$):
In general, the marginal density of $X$ is
$$f_X(x) = \int_{-\infty}^\infty f(x,y) \mathop{dy}.$$
For a specific $x$, note that by definition $f(x,y)$ is zero if $|x|>y$; otherwise $f(x,y) = c(y^2-x^2)e^{-y}$. So
$$f_X(x) = \int_{-\infty}^\infty f(x,y) \mathop{dy} = \int_{-\infty}^{|x|} f(x,y) \mathop{dy} + \int_{|x|}^\infty f(x,y) \mathop{dy}
= 0 + \int_{|x|}^\infty c(y^2-x^2)e^{-y} \mathop{dy}.$$
A: For the marginal of $X$ you need
$$
\int_0^\infty f_{X,Y}(x,y)\,  dy = \int_{|x|}^\infty \frac 1 8 (y^2-x^2)e^{-y} \, dy.
$$
The point is that the density is nonzero only when either $y>x$ and $y>-x$. That is the same as $y>|x|$.
Let $u=y-x$, so that $du=dy$, and then $y+x= u+2x.$ Then
$$
y^2-x^2 = (y-x)(y+x) = u(u+2x).
$$
If $x\ge0$ then $y$ goes from $x$ to $\infty$, so $u$ goes from $0$ to $\infty$, and you get
$$
\int_0^\infty \frac 1 8 u(u+2x)\, e^{-(u+x)} \,du.
$$
Note that $x$ does not change as $u$ goes from $0$ to $\infty$, so this becomes
$$
\frac 1 8e^{-x} \left( \int_0^\infty u^2 e^{-u} \, du + 2x \int_0^\infty e^{-u} \,du \right)
$$
and this comes to
$$
\frac 1 8 e^{-x}(2+2x) = \frac 1 4 e^{-x} (1+x).
$$
But what if $x<0$? In that case $\displaystyle \int_{|x|}^\infty \cdots \,dy$ is $\displaystyle \int_{-x}^\infty \cdots \,dy,$ and that becomes $\displaystyle \int_{-2x}^\infty \cdots \, du.$
