Finding marginal density from a joint density when range of random variables are dependent on one another. I have two joint density problems, where I would like to find the marginal density.
The first one: $f(x,y) = 24xy, 0 \leq x \leq 1, 0 \leq y \leq 1, 0 \leq x+y \leq 1$
So, I "integrate out y" and get $f_x(x)=\int_{-\infty}^{\infty} 24xydy =12x $
I don't feel like this is right because I no longer have an handle on the extra condition of $x+y\leq1$, and if I integrate $12x$ over $[0,1]$, I just would get 6, instead of 1.
The second one: $\frac{1}{8}(y^2-x^2)e^{-y} -y \leq x \leq y, 0 < y < \infty$
Again, integrating out the y here seems to be the wrong approach because I'm not taking into consideration the relationship between x and y.
How would I proceed then in these two cases to find the marginal densities?
Thanks!

You can compute $F_X(t) = P(x<t)$.
$$F_X(t) = \int_0^t \left(\int_{0}^{1-x}f(x,y)dy \right)dx$$
 for $t\in [0,1]$, $F_X(t) = 0$ for $t<0$ and $F_X(t) = 1 $ for $t>1$. Then, $f_X(t) = F_X'(t)$ for all $t\in \mathbb{R}$, except for $t\in \{0,1\}$. Expected value $E[X]$ can now be easily computed.
The second case can be treated in the same way.
