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
 A: 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}$$
A: 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!  
