# How to express 2 absolute values as a piecewise function??

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|$

## 1 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$?

• when - 3<= x <= 1, (1-x)-(x+3), when x > 1, (x-1)-(x+3),is it correct? I don't understand what do you express x>1 but not x>=1, because when x=1, |x-1|=0,why do we change the sign? – Joshua Jan 16 '14 at 1:38
• You are right. I already considered x=1 in the case $-3 \leq x \leq 1$ – voldemort Jan 16 '14 at 1:43
• but when x=1 |x-1|=0, it is not negative, why don't we express x >= 1 but x > 1?? – Joshua Jan 16 '14 at 1:51
• They are the same at point $1$ @Joshua – gaoxinge Jan 16 '14 at 1:52
• It's like the definition of $|x - 1|,$ which has a case for $x \ge 1$ and another case for $x < 1.$ You could just as well make one case $x > 1$ and the other case $x \le 1.$ Either way is fine, as long as every value fits in one of the cases. We usually don't let a value belong to two cases simultaneously. – David K Sep 10 '14 at 2:01