[Math] How to express 2 absolute values as a piecewise function?

absolute value

I understand how to solve 1 absolute value as a piecewise function.
$f(x)=|x-1|$
$$
f(x)=
\begin{cases} x-1& \text{if }x\ge1\\
1-x&\text{if }x<1 \end{cases}
$$

But when a function involving 2 absolute values (or maybe more), I get stuck.

What are the steps to take in order to solve function like this?
$f(x)=|x-1|-|x+3|$

Best Answer

Note that the "changes" happen only at the points 1 and -3. If $x<-3$ then $|x+3|=3-x$ and $|x-1|=1-x$ (by definition of ||). Can you complete the problem now by considering what happens when $-3 \leq x \leq 1$ and $x > 1$?