To write $ f(x)=|x+1|-|2x-1| $ as a piecewise linear function, we split at the points where the absolute values change sign:
So we consider three intervals.
f(x)=−(x+1)−(−(2x−1))=−x−1+2x−1=x−2 f(x)=-(x+1)-\big(-(2x-1)\big) = -x -1 +2x -1 = x -2
f(x)=(x+1)−(−(2x−1))=x+1+2x−1=3x f(x)= (x+1)-\big(-(2x-1)\big) = x+1 +2x -1 = 3x
f(x)=(x+1)−(2x−1)=x+1−2x+1=−x+2 f(x)= (x+1)-(2x-1) = x+1 -2x +1 = -x+2
f(x)={x−2,x<−1,3x,−1≤x<12,−x+2,x≥12. f(x)= \begin{cases} x-2, & x < -1,\\ 3x, & -1 \le x < \tfrac12,\\ -x+2, & x \ge \tfrac12 . \end{cases}