Conceptual problem in solving quadratic equation The sum of all real roots of the equation $$|x-2|^2 + |x-2| - 2 = 0$$
is?
I tried this problem by taking two cases $x<2$ and $x>2$ and solving the corresponding equations and I got $8$ as the answer, but in my book the author solves it by taking this equation as a quadratic in $x-2$ and gets $4$ as the answer. What's wrong with my way of solving this problem?
 A: When $x < 2$, the equation becomes
$$
x^2 - 4x + 4 + 2 - x - 2 = 0,
$$
or $x^2-5x+4=0$. This gets solutions $x = 4$ or $x = 1$, but since $x < 2$ we only take $x = 1$.
When $x > 2$, we have
$$
x^2 - 4x + 4 + x - 2 - 2 = 0,
$$
or $x^2 - 3x = 0$. This gets solutions $x = 0$ or $x = 3$, but since $x > 2$ we only take $x = 3$.
EDIT: the book's way is probably nicer though. Let $y = |x-2|$, then $y^2 - y + 2 = 0$ and $y = -2$ or $y = 1$. Since $y \geq 0$, we only take $|x-2| = y = 1$, which again gets $x = 3$ or $x = 1$.
A: If you let $u=|x-2|$, the equation becomes
$$u^2+u-2=0$$
which, as a quadratic in its own right, factors as
$$(u-1)(u+2)=0$$
and has solutions $u=1$ and $u=-2$.  However, we can rule out $u=-2$, since $|x-2|$ is necessarily non-negative.  That leaves
$$|x-2|=1$$
which has two solutions:  $x=3$ and $x=1$.  When you sum these, you get the answer $4$.  (I didn't notice at first that the question was about the sum of the roots, even though it pretty clearly says so!)
A: Hint :
when $x>2$ then $|x-2|=x-2$ and when $x<2$ $|x-2|=2-x$ and  $|x-2|^2=(x-2)^2$
So consider two cases.
Hope this helped
