<s>[INST] How to get CDF from given function I get this function 

$$f(x) = \begin{cases}
         \frac{0}{3} ,&\text{$|x|\geq 2$}\\
         \frac{1}{3}, &\text{$|x|\leq 1$}\\
         \frac{2-|x|}{3},& \text{$1\le|x|\leq2$}\\
       \end{cases}$$

I need to convert in CDF but I do not know how I get som part of solution, I know how function look,I know that for $x\le-2$ I get $F(x)=0$, now I know how to get $-2<x\le-1$, $\int_{-2}^{x}\frac{2+x}{3}=\frac{(x+2)^2}{6}$, I think that for $1<x\le2$ is not good I get  $\int_{1}^{x}\frac{2-x}{3}=\frac{-x^2+4x-3}{6}$, but for $-1<x\le1$, I have no idea how he get that, can you help me?
This is solution that I get in book

$$F(x) = \begin{cases}
         0 , & \text{$x\le-2$}\\
         \frac{(x+2)^2}{6}, &\text{$-2<x\le-1$}\\
         \frac{2x+3}{6}, &\text{$-1<x\le1$}\\
          \frac{-x^2+4x+2}{6},& \text{ $1<x\le2$}\\
           1, &\text{$x>2$}
       \end{cases}$$

 [/INST] For $-1 < x \le 1$ we have
$$F(x) = F(-1) + \int_{-1}^x \frac13 \,dt = \frac{(-1+2)^2}{6} + \frac{x+1}3 = \frac{2x+3}6$$
For $1 < x \le 2$ we have
$$F(x) = F(1) + \int_1^x \frac{2-t}3 = \frac56 + \frac{-x^2+4x-3}6 = \frac{-x^2+4x+2}6$$
</s>