# Help finding the Marginal PDF of Y given a Density Function of Two Variables

Problem:
The join pdf of $(X,Y)$ is given by
$f(x,y) = \begin{cases} \Big( \frac{5}{32} \Big) x^2(4 - y) & \text{for } x < y < 2x, 0 < x < 2 \\ 0 & \text{otherwise} \\ \end{cases}$
where $k = \frac{5}{32}$. Find the marginal pdf of $Y$.
Answer: \begin{eqnarray*} f_y(y) &=& \int_{-\infty}^{\infty} f(x,y) \,\, dx \\ f_y(y) &=& \int_{0}^{2} \Big( \frac{5}{32} \Big) x^2(4 - y) \,\, dx \\ f_y(y) &=& \Big( \frac{5}{32} \Big) \frac{x^3}{3}(4 - y) \Big|_{x = 0}^{x = 2} \\ f_y(y) &=& \Big( \frac{5}{32} \Big) \frac{2^3}{3}(4 - y) \\ f_y(y) &=& \Big( \frac{5}{12} \Big) (4 - y) \\ \end{eqnarray*} My answer is: \begin{eqnarray*} f_y(y) &=& \begin{cases} \Big( \frac{5}{12} \Big)(4x^3 - \frac{3x^4}{2}) & \text{for } 0 < y < 4 \\ 0 & \text{otherwise} \\ \end{cases} \\ \end{eqnarray*} but the books answer is:
\begin{eqnarray*} f_y(y) &=& \begin{cases} \Big( \frac{5}{12} \Big) (4 - y) & \text{for } 0 < y < 2 \\ \Big( \frac{5}{32} \Big)\Big( \frac{1}{3} \Big)(4-y)(8 - \frac{y^3}{8}) & \text{for } 2 < y < 4 \\ 0 & \text{otherwise} \\ \end{cases} \\ \end{eqnarray*} I would like to know what I did wrong.
Thanks
Bob

• You obeyed the bound $0<x< 2$ but not the bound $y/2<x<y$. – kimchi lover Sep 11 '17 at 23:12

The support for the joint distribution is $\{(x,y): 0<x<2, x<y<2x\}$

• That is the triangle $\triangle(0,0)(2,2)(2,4)$

This is the same region as $\{(x,y): 0<y<4, y/2< x< \min\{2,y\}\}$

Which is the union: $\{(x,y): 0<y<2, y/2<x<y\}\cup\{(x,y): 2\leqslant y< 4, y/2<x<2\}$

• That is $\triangle(0,0)(1,2)(2,2)\cup\triangle(1,2)(2,2)(2,4)$

Plot the points and you see how the triangle is divided into two parts at the $y=2$ horizon.   Draw horizonal likes through the upper and lower triangles and see why the bounds for the integral producing the $Y$-marginal pdf are different for each part.

Hence why:

$$f_Y(y) =\frac{5}{32} \begin{cases}\displaystyle \int_{y/2}^y x^2(4-y)\;\mathrm d\, x &:& 0<y<2 \\[1ex]\displaystyle \int_{y/2}^2 x^2(4-y)\;\mathrm d\, x &:& 2\leqslant y< 4 \\[1ex] 0 &:& \text{otherwise}\end{cases}$$

It seems like you have a good idea of what to do but just made a tiny mistake, I'll clear that up and leave you the work of finishing up.

The problem is that the set of possible values of $y$ depends on the value of $x$. You are not taking this into account. To do so you can write the joint pdf in terms of characteristic functions.

So, rewrite the pdf as follows:

$$f(x,y) = \left( \frac{5}{32} \right) x^2 (4-y) \mathbf{1}_{ [x,2x]} (y) \cdot \mathbf{1}_{[0,2]}(x)$$

Now aply the same method you did before, integrating with respect to all possible values of $x$.

Take into account that if $y$ must be between $x$ and $2x$, this is equivalent to $x$ being smaller than $y$ and $2x$ being bigger than $y$. (Draw the region for easier integration)

Hope this helps!

• I now understand why my answer is wrong and my guess is that $f_y(y) = \int_{\frac{y}{2}}^{y} \Big( \frac{5}{32} \Big) x^2(4 - y) \,\, dx$ is the right integral. Is it? – Bob Sep 11 '17 at 23:54
• @Bob not exactly. That one is not considering the bound on $x$. When you do integration on two variables it is a very good practice to draw the region (set of $(x,y)$ values). Whenever yo draw this region you'll find out exactly where the solution of the book comes from. It is just from integrating. – Joaquin San Sep 12 '17 at 5:21