Suppose we have a function $f:[-1,1]\rightarrow\mathbb{R}$ defined by $$ f(x)= \begin{cases} -1, & -1\leq x\leq 0 \\ 1, & 0<x\leq 1 \end{cases} $$ Using the Riemann definition of the integral, prove that $\int_{-1}^xf=|x|-1$ for any $x\in[-1,1]$.
My attempt: By Riemann's definition of the integral we can say $$ \int_{-1}^x f = \sum_{k=1}^{\infty} f(c_k) \Delta x_k = \sum_{k=1}^{\infty}-1\Delta x_k +\sum_{k=1}^{\infty}x\Delta x_k = -1 + |x|. $$
so for any $-1\le x\le0$ we have: $$\int_{-1}^xf\,dx=(-1)\times (x+1)$$ now for any $0\le x\le 1$ we have: $$\int_{-1}^xf dx=\int_{-1}^0(-1)dx+\int_0^x\,d\mathbb{x}=-1+x=x-1$$ so if we have $F'=f$ then we know that: $$F=\begin{cases}-x-1 & -1\le x<0\\ -1 & \,\,\,\,\,\,\,\,\,\,\,\,\,\,x=0\\ x-1 & \,\,\,0< x\le 1\end{cases}$$