<s>[INST] 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
 [/INST] 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}$$
</s>