The value of X must be between 0 and 4.
The Y is defined as
\(Y = \left\{ \begin{aligned}0\,\,\,\,if\,0 \le X < 1/2\\1\,\,\,\,\,if\,1/2 \le X < 3/2\\2\,\,\,\,if\,3/2 \le X < 5/2\\3\,\,\,\,if\,5/2 \le X < 7/2\\4\,\,\,\,if\,7/2 \le X < 4\end{aligned} \right.\)
Here do not need to worry about how to define Y if \(X \in \left\{ {1/2,3/2,5/2,7/2} \right\}\), because the probability that X will be equal to one of these four values is 0. It now follows that
\(\begin{aligned}\Pr \left( {Y = 0} \right) &= \int_0^{1/2} {f\left( x \right)dx} \\ &= \int_0^{1/2} {\frac{1}{8}xdx} \\ &= \frac{1}{8}\left[ {\frac{{{x^2}}}{2}} \right]_0^{1/2}\\ &= \frac{1}{{64}}\end{aligned}\)
\(\)\(\begin{aligned}\Pr \left( {Y = 1} \right) &= \int_{1/2}^{3/2} {f\left( x \right)dx} \\ &= \int_{1/2}^{3/2} {\frac{1}{8}xdx} \\ &= \frac{1}{8}\left( {\frac{{{x^2}}}{2}} \right)_{1/2}^{3/2}\\ &= \frac{1}{8}\end{aligned}\)
\(\begin{aligned}\Pr \left( {Y = 2} \right) &= \int_{3/2}^{5/2} {f\left( x \right)dx} \\ &= \int_{3/2}^{5/2} {\frac{1}{8}xdx} \\ &= \frac{1}{8}\left( {\frac{{{x^2}}}{2}} \right)_{3/2}^{5/2}\\ &= \frac{1}{4}\end{aligned}\)
\(\begin{aligned}\Pr \left( {Y = 3} \right) &= \int_{5/2}^{7/2} {f\left( x \right)dx} \\ &= \int_{5/2}^{7/2} {\frac{1}{8}xdx} \\ &= \frac{1}{8}\left( {\frac{{{x^2}}}{2}} \right)_{5/2}^{7/2}\\ &= \frac{3}{8}\end{aligned}\)
\(\begin{aligned}\Pr \left( {Y = 4} \right) &= \int_{7/2}^4 {f\left( x \right)dx} \\ &= \int_{7/2}^4 {\frac{1}{8}xdx} \\ &= \frac{1}{8}\left( {\frac{{{x^2}}}{2}} \right)_{7/2}^4\\ &= \frac{{15}}{{64}}\end{aligned}\)
Therefore the probability function is
\(f\left( y \right) = \left\{ \begin{aligned}\frac{1}{{64}}\,\,\,\,\,for\,y = 0\\\frac{1}{8}\,\,\,\,\,\,\,for\,y = 1\\\frac{1}{4}\,\,\,\,\,\,for\,y = 2\\\frac{3}{8}\,\,\,\,\,for\,y = 3\\\frac{{15}}{{64}}\,\,\,for\,y = 4\end{aligned} \right.\)