In my probability/stats course, they have defined a probability density function as:
$$f(x) = |x|\quad,\quad -1 < x < 1$$
I am having difficulty with how they have integrated this to find the cumulative distribution function:
$F(x) = (1-x^2)/2, \quad -1 \leq x \leq 0$, and
$F(x) = (1+x^2)/2, \quad 0 \leq x \leq 1$.
We have $$f(x) = \begin{cases} |x|, & -1 \leq x \leq 1 \\ 0, & \text{otherwise}. \end{cases} = \begin{cases} -x, & -1 \leq x < 0 \\ x, & 0 \leq x \leq 1 \\ 0, & \text{otherwise}. \end{cases}$$
When finding the CDF, you must partition the interval $(-\infty, \infty)$ appropriately and consider each case. In this situation, we must consider $(-\infty, 1)$, $[-1, 0)$, $[0, 1)$, and $[1, \infty)$.
Case 1 is the interval $(-\infty, -1)$:
For any $x < -1$, $F(x) = 0$, since if $x < -1$: $$F(x) = \int_{-\infty}^{x}\underbrace{f(t)}_{=\text{ }0\text{ for } t < -1}\text{ d}t = \int_{-\infty}^{x}0\text{ d}t = 0$$
Case 2 is the interval $[-1, 0)$:
Suppose now that $-1 \leq x < 0$. Then $$\begin{align} F(x) &= \int_{-\infty}^{x}f(t)\text{ d}t \\ &= \int_{-\infty}^{-1}\underbrace{f(t)}_{=\text{ }0\text{ for } t < -1}\text{ d}t + \int_{-1}^{x}\underbrace{f(t)}_{=\text{ }-t\text{ for } -1 \leq t < 0}\text{ d}t\\ &= 0 + \int_{-1}^{x}-t\text{ d}t \\ &= -\left[\dfrac{t^2}{2} \right]^{x}_{-1} \\ &= \dfrac{1}{2}\left(1 - x^2\right)\text{.} \end{align}$$
Case 3 is the interval $[0, 1)$:
Suppose that $0 \leq x < 1$. Then $$\begin{align} F(x) &= \int_{-\infty}^{x}f(t)\text{ d}t \\ &= \int_{-\infty}^{-1}\underbrace{f(t)}_{=\text{ }0\text{ for } t < -1}\text{ d}t + \int_{-1}^{0}\underbrace{f(t)}_{=\text{ }-t\text{ for } -1 \leq t < 0}\text{ d}t + \int_{0}^{x}\underbrace{f(t)}_{=\text{ }t\text{ for } 0 \leq t < 1}\text{ d}t\\ &=0 + \int_{-1}^{0}-t\text{ d}t + \int_{0}^{x}t\text{ d}t \\ &= \underbrace{\dfrac{1}{2}(1-0^2)}_{\text{from Case 2}} + \left[\dfrac{t^2}{2} \right]^x_{0} \\ &= \dfrac{1}{2}+\dfrac{x^2}{2} \\ &= \dfrac{1+x^2}{2} \end{align}$$
Case 4 is the interval $[1, \infty)$:
If $x \geq 1$, we have $$\begin{align} F(x) &= \int_{-\infty}^{x}f(t)\text{ d}t \\ &= \int_{-\infty}^{1}f(t)\text{ d}t + \int_{1}^{x}\underbrace{f(t)}_{=\text{ }0\text{ for } t > 1}\text{ d}t \\ &= \underbrace{\dfrac{1+1^2}{2}}_{\text{from Case 3}} + 0 \\ &= 1 \end{align}$$
Thus, $$F(x) = \begin{cases} 0, & x < -1 \\ \dfrac{1-x^2}{2}, & -1 \leq x < 0 \\ \dfrac{1+x^2}{2}, & 0 \leq x < 1 \\ 1, & x \geq 1\text{.} \end{cases}$$