[Math] Find marginal density function from joint density function

probability distributions

If I have a joint density function for X and Y:

$f_{X,Y}(x,y) = \begin{cases}
\pi x \cos(\frac {\pi y} 2) & 0 \le x \le 1, 0 \le y \le 1 \\
0 & \text{otherwise} \\
\end{cases}$

How do I find the marginal density function for X?

I think I need to integrate $f_{X,Y}(x,y)$ over $dy$ but what do I integrate it from? Should it be 0 and 1 or 0 and x or x and 0? I've looked over a lot of examples with different domains but I can't figure out their method in getting the range for integration. They always skip that step in the working because apparently it should be obvious, but I can't figure it out. Can anyone help me please?

Best Answer

The marginal density is given by $$ f_X(x)=\int_{-\infty}^\infty f_{X,Y}(x,y)\,\mathrm dy,\quad x\in\mathbb{R}. $$ Now, this equals $$ \int_{0}^1 \pi x\cos\left(\frac{\pi y}{2}\right)\,\mathrm dy,\quad \text{if }\;0\leq x\leq 1 $$ and $0$ otherwise.