The PDF of a random variable $X$ is:
$f(x) = \begin{cases} 0 , x<2 \ \text{or} \ x >4 \\ a(x-2)(4-x), 2 \leq x \leq 4 \end{cases} $
Find $a$ and $F_X (x)$.
My attempt: By taking $\int_{2}^{4} f_X (x) = 1$, I worked out $a = \frac{3}{4}$. Then
$F_x (x) = \begin{cases} 0 , x<2 \ \text{or} \ x >4 \\ - \frac{x^3}{4} + \frac{9}{4}x^2 - 6x, 2 \leq x \leq 4 \\ 1, x >4 \end{cases} $
But the solution in my book is:
$F_x (x) = \begin{cases} 0 , x<2 \ \text{or} \ x >4 \\ - \frac{x^3}{4} + \frac{9}{4}x^2 - 6x + \textbf{5}, 2 \leq x \leq 4 \\ 1, x >4 \end{cases} $
I don't know where $\textbf{5}$ comes from. I suspect it's from the $C$ when we take the anti-derivative of $f(x)$ but I couldn't figure out how to calculate it.
Yes, you are correct that $5$ comes from the anti-derivative. Remember that to find the cdf, you compute the following integral:
$$\int_{-\infty}^xf(t)dt$$
where $f(t)$ is the pdf of the continuous random variable. In this question, it is:
$$\int_{2}^x\frac34(t-2)(4-t)dt$$
and if you evaluate the lower limit of the integral (at $t=2$), you get $-5$