<s>[INST] Find all solutions to $|x^2-2|x||=1$ Firstly, we have that $$\left\{
  \begin{array}{rcr}
    |x| & = & x, \ \text{if} \ x\geq 0 \\
    |x| & = & -x, \ \text{if} \ x<0 \\
  \end{array}
\right.$$
So, this means that 
$$\left\{
\begin{array}{rcr}
    |x^2-2x| & = & 1, \ \text{if} \ x\geq 0 \\
    |x^2+2x| & = & 1, \ \text{if} \ x<0 \\
  \end{array}
\right.$$
For the first equation, we have
$$|x^2-2x|\Rightarrow\left\{\begin{array}{rcr}
    x^2-2x & = & 1, \ \text{if} \ x^2\geq 2x \\
    x^2-2x & = & -1, \ \text{if} \ x^2<2x \\
  \end{array}
\right.$$
and for the second equation, we have
$$|x^2+2x|\Rightarrow\left\{\begin{array}{rcr}
    x^2+2x & = & 1, \ \text{if} \ x^2+2x\geq 0 \\
    x^2+2x & = & -1, \ \text{if} \ x^2+2x<0 \\
  \end{array}
\right.$$
Solving for all of these equations, we get
$$\left\{\begin{array}{rcr}
    x^2-2x & = 1  \Rightarrow& x_1=1+\sqrt{2} \ \ \text{and} \ \ x_2=1-\sqrt{2}\\
    x^2-2x & =-1  \Rightarrow& x_3=1 \ \ \text{and} \ \ x_4=1\\
    x^2+2x & = 1  \Rightarrow& x_5=-1-\sqrt{2} \ \ \text{and} \ \ x_6=-1+\sqrt{2}\\
    x^2+2x & =-1 \Rightarrow& x_7=-1 \ \ \text{and} \ \ x_8=-1 
  \end{array}
\right.$$
So we have the roots $$\begin{array}{lcl}
x_1 = & 1+\sqrt{2} \\
x_2 = & 1-\sqrt{2} \\
x_3 = & -1+\sqrt{2} \\
x_4 = & -1-\sqrt{2} \\
x_5 = & 1 \\
x_6 = & -1
\end{array}$$
But according to the book, the answer is
\begin{array}{lcl}
x_1 & = & 1+\sqrt{2} \\
x_4 & = & -1-\sqrt{2} \\
x_5 & = & 1 \\
x_6 & = & -1
\end{array}
What happened to $x_2$ and $x_3$? Any other way to solve this equation quicker?
 [/INST] \begin{align*}
|x^2-2|x||&=1\\
x^2-2|x|&=1\quad\text{or}\quad -1\\
|x|^2-2|x|-1&=0\quad\text{or}\quad |x|^2-2|x|+1=0\\
|x|&=1+\sqrt{2} \quad\text{or}\quad 1\qquad(|x|=1-\sqrt{2}<0\text{ is rejected})\\
x&=\pm(1+\sqrt{2}) \quad\text{or}\quad \pm1
\end{align*}
</s>