So I understand that given $|x|$, it will be in the form $|x|= \{-x: \text{if } x<0\}$ or $|x|= \{x: \text{if } x >= 0\}$. Also, I know that $|x-1| = \{-(x-1): \text{if } x-1 <0 \text{ or } x<1\}$ and $|x-1|= \{(x-1):\text{if } x >= 0 \text{ or } x >= 1\}$.
From here I have no idea how to combine these two equations to a function that could be plotted as a piecewise function, and I do not understand how to combine the boundaries since I am also confused about the negative sign in front of $|x − 1|$ and if it has an effect on the boundary.




Guide:
Consider cases:
Figure out the expression of $|x|-|x-1|$ when
case $1$: $x < 0$, find expression $f_1$
case $2$: $0 \le x < 1$, find expression $f_2$.
case $3$: $x \ge 1$, find expression $f_3$.
For each case, consider whether it can be equal to $\frac12$.
$$|x|-|x-1|=\begin{cases} f_1(x) , & x<0 \\ f_2(x) & 0 \le x < 1 \\ f_3(x) &, x \ge 1\end{cases}$$