# How do I find the marginal probability density function of 2 continuous random variables?

Ok, I've been looking at this problem:

Let $$f(x,y) = \frac{3}{16}xy^2, \quad 0 \le x \le 2, \quad 0 \le y \le 2$$ be the joint probability density function(pdf) of $X$ and $Y$. Find $f_1(x)$ and $f_2(y)$, the marginal pdfs.

Then it asks if the two variables are independent and I understand how to answer that, I just keep getting the wrong marginal pdfs.

Here is my attempted work so far:

At first I did what was was necessary to find marginal pdfs for discrete random variables and summed leading me to the pdfs

$$f_1(x) = \frac{7x}{16} \text{ and } f_2(y) = \frac{3y^2}{16}.$$

Clearly this is wrong.

I realized my mistake and attempted to do what is necessary to find the marginal pdf for continuous random variables. So I used integrals and setup the following:

$$f_1(x) = \int_0^2 \frac{3}{16}xy^2 ~dy = \left. \frac{1}{3}y^3 \right|_0^2 = \frac{24}{48}.$$

$$f_2(y) = \int_0^2 \frac{3}{16}xy^2 ~dx = \left.\frac{3x^2}{32}\right|_0^2 = \frac{12}{32}.$$

My book however gives the answers for these two continous pdfs as:

$$f_1(x) = \frac{x}{2} \text{ and } f_2(y) = \frac{3y^2}{8}.$$

Can anyone shed some light on the process of how they arrived at these functions and what I'm doing wrong?

You have the right idea to integrate against $y$ to find the $x$-marginal, and integrate against $x$ to find the $y$-marginal, but you've forgotten to pull out the other variable as a constant:
$$f_1(x)=\int_0^2f(x,y)dy=\int_0^2\frac{3xy^2}{16}dy=\frac{3x}{16}\int_0^2y^2dy=\frac{3x}{16}\frac{8}{3}=\frac{x}{2}$$
$$f_2(y)=\int_0^2\frac{3xy^2}{16}dx=\frac{3y^2}{16}\int_0^2 xdx=\frac{3y^2}{16}\cdot 2=\frac{3y^2}{8}$$