I have the following probability density function
$$f(x) =\begin{cases} 4x & \mbox{for }0< x < 1/2 \\ 4-4x & \mbox{for }1/2 \leq x < 1 & \\ 0 & \mbox{otherwise}\end{cases}$$
I am tasked to now find its probability distribution function in the same piece wise format. I have the solution to this problem however I do not really understand the solution.
The solution is the integral from 0 to x of 4x(for the first interval of 0 < x<= 1/2)+ integral of 0 to 1/2 of 4x + integral of 1/2 to x of 4-4x(for the second interval).
I understand the first interval but I am stumped as to why we add the integral of 0 to 1/2 of 4x to the integral of 1/2 to x for the second interval.
Any explanation would be appreciated.
I guess it is asking for the CDF. It's hard to tell what you are writing since you didn't format.
Essentially, it should be
$$F_X(x) = P(X\leq x)=\begin{cases} 0& x<0\\ \int_0^x 4t\,dt& 0\leq x< \frac{1}{2}\\ \int_0^{1/2} 4t\,dt+\int_{1/2}^x4-4t\,dt&\frac{1}{2}\leq x <1\\ 1& x\geq 1\end{cases}$$
Loosely speaking, this is the case because the CDF is the accumulation of probability (area) under the curve up to $x$.