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.


1. For (x < -1)

f(x)=(x+1)((2x1))=x1+2x1=x2 f(x)=-(x+1)-\big(-(2x-1)\big) = -x -1 +2x -1 = x -2


2. For 1x<12)-1 \le x < \frac12)

f(x)=(x+1)((2x1))=x+1+2x1=3x f(x)= (x+1)-\big(-(2x-1)\big) = x+1 +2x -1 = 3x


3. For x12x \ge \tfrac12

f(x)=(x+1)(2x1)=x+12x+1=x+2 f(x)= (x+1)-(2x-1) = x+1 -2x +1 = -x+2


Final Piecewise Function

f(x)={x2,x<1,3x,1x<12,x+2,x12. f(x)= \begin{cases} x-2, & x < -1,\\ 3x, & -1 \le x < \tfrac12,\\ -x+2, & x \ge \tfrac12 . \end{cases}