(X,Y) is a two-dimensional abolute continuous random vector with the density function fx,y given by:
(1) $f_{X,Y}(x,y) = \begin{cases} \frac{1}{2} & 0 \le x \le 1, 0 \le y \le 4x \\ 0 & \text{otherwise} \\ \end{cases}$
Show the density functions fx and fy for X and Y are:
$f_{X}(x) = \begin{cases} 2x & 0 \le x \le 1\\ 0 & \text{otherwise} \\ \end{cases}$
$f_{Y}(y) = \begin{cases} \frac{1}{2}(1-\frac{y}{4}) & 0 \le y \le 4\\ 0 & \text{otherwise} \\ \end{cases}$
I'm having a hard time figuring out how this works, i have been looking for a while for some similar problems without any luck. I can make the step with $$ f_{X}(x) =\int_{0}^{4x} {\frac{1}{2} dy} = 2x$$ But $f_{Y}$ i can't figure out and makes me wonder if the first one is done correctly.
Another example i can't solve is:
(2) $f_{X,Y}(x,y) = \begin{cases} \frac{3}{4}x & 0 \le x \le y \le 2\\ 0 & \text{otherwise} \\ \end{cases}$
$f_{X}(x) = \begin{cases} \frac{3}{4}x(2-x) & 0 \le x \le 2\\ 0 & \text{otherwise} \\ \end{cases}$
$f_{Y}(y) = \begin{cases} \frac{3}{8}y^2 & 0 \le y \le 2\\ 0 & \text{otherwise} \\ \end{cases}$
From what i gathered i should be able to solve it with $\int{f_{X,Y}(x,y)dx}$, but can't seem to do it right. Any help is appreciated.