Spivak Calculus: Chapter 1 Problem 10 ii) I've been trying to figure out how do they get to the awnser and I realised I might have problems dealing with absolute value.
Heres the question
Express the following without the absolute values:
$$|(|x|-1)|$$
And here is how I develop:
If $ |x|-1 > 0 \Rightarrow |x| > 1$ then  $|(|x|-1)|$ = $|x|-1$
If $ |x|-1 < 0 \Rightarrow |x| < 1$ then  $|(|x|-1)|$ =  $1 - |x|$
Moreover,
If $x>0 \Rightarrow |x| = x$
If $x<0 \Rightarrow |x| = -x$
Which leads to 3 possibilites
If $x>1 \Rightarrow |(|x|-1)| = |x|-1 = x -1$ (since x>0)
If $0<x<1 \Rightarrow |(|x|-1)| = 1- |x| = 1 -x$ (since x>0)
If  $0>x \Rightarrow |(|x|-1)| = 1- |x| = 1 - (-x) = 1+x $ (since x<0)
Here are my questions:


*

*How do I know in which interval the case x =1, x=0 belongs?

*Do I treat the absolute value of x before the one for the whole expression or is it the other way around?


And finally, I dont get how in the corrected exercises they get 4 cases?
The book's awnser
$x-$ 1 if x $ \geqslant 1$.
$1 - x$ if $0 \leqslant x \leqslant 1$.
$1 + x$ if $-1 \leqslant x \leqslant 0$.
$-1 - x$ if $ x \leqslant -1$.
Thank you!
 A: Let's start from inside:
$$||x|-1| = \begin{cases} |x-1| \quad \mathrm{if} \quad x >0 \\|-x-1| \quad \mathrm{if} \quad x  \leq0\end{cases}$$
$$= \begin{cases} |x-1| \quad \mathrm{if} \quad x >0 \\  |x+1| \quad \mathrm{if} \quad x  \leq0\end{cases}$$
$$= \begin{cases} x-1 \quad \mathrm{if} \quad x >0 \quad \mathrm{and} \quad x-1 >0 \\ 1-x \quad \mathrm{if} \quad x >0 \quad \mathrm{and} \quad x-1 \leq 0\\  x+1 \quad \mathrm{if} \quad x  \leq0 \quad \mathrm{and} \quad x+1>0 \\-x-1 \quad \mathrm{if} \quad x \leq0 \quad \mathrm{and} \quad x+1 \leq0\end{cases}$$
$$= \begin{cases} x-1 \quad \mathrm{if} \quad x >0 \quad \mathrm{and} \quad x>1 \\ 1-x \quad \mathrm{if} \quad x >0 \quad \mathrm{and} \quad x \leq 1\\  x+1 \quad \mathrm{if} \quad x  \leq0 \quad \mathrm{and} \quad x>-1 \\-x-1 \quad \mathrm{if} \quad x \leq 0 \quad \mathrm{and} \quad x \leq -1\end{cases}$$
$$= \begin{cases} x-1 \quad \mathrm{if}  \quad x>1 \\ 1-x \quad \mathrm{if} \quad x \in (0,1]\\  x+1 \quad \mathrm{if} \quad x  \in (-1,0] \\-x-1 \quad \mathrm{if} \quad x \leq -1\end{cases}$$
and this is the book's answer.
A: For the most part your work is correct. Your error lies here:
If  $0>x \Rightarrow |(|x|-1)| = 1- |x| = 1 - (-x) = 1+x $ (since x<0)
$0 > x$ doesn't imply that $|(|x|-1)| = 1- |x|$. For example if $x = -2$, $|(|x|-1)| = 1$ and $1- |x| = -1$. You need to break this into two cases, hence where your extra case comes from.
As for $x = 0,1$ you can just lump them in with the case $0 < x < 1$ by the exact same reasoning you used (just change less than to less than or equal to), ie:
If $0 \leq x \leq 1 \Rightarrow |(|x|-1)| = 1- |x| = 1 -x$ (since $x \geq 0$)
To answer your other question (Do I treat the absolute value of x before the one for the whole expression or is it the other way around?) I think it would be easier to treat the innermost absolute value first and work your way out.
A: You are dealing with a composite of functions .First  y=|x|= x if x>=0 and = -x if x<0 . 
Next(2) u=y-1 =x-1 if x>=0 and = -x-1 if x<0 .
Next w=|u| = u if u>=0 and =-u if u<0  So when is u>=0 ? First let x>=0 . u=x-1 >=0 exactly when x>=1  . Now let x<0 (2)then gives u >=0 exactly when -x-1 >=0 or equivalently x<=-1 . So w = u= x-1 for x>=1 and also for x<=- 1.
 Everywhere else ,namely when -1< x < 1 we have w =-u  . 
Now by (2) again w=-(x-1) if 0<=x<1 and w=-(-x-1) for -1< x <0 .
