I was reading a math SE post following inequality with absolute value and found that it seemed to be common knowledge that you may square both sides of an absolute value function and it maintain correctness. For example: $$ |x-5| = 1\\ (x-5)^2 = 1 \\ x^2-10x+24=0\\ (x-6)(x-4)=0\\ x=6 , x=4 $$ would be perfectly acceptable. Why does it work? Can someone provide intuition?
4 Answers
It works because $$|A|=B \implies A^2=|A|\cdot|A|=B\cdot B=B^2$$
Note that the converse is not true, for example
$$3^2=(-3)^2 \not\Rightarrow 3=-3$$
Note also that for your example the solution can be obtained considering two cases by the definition of absolute value
- $x-5\ge0\implies x-5 = 1 \implies x=6$
- $x-5<0\implies -x+5 = 1 \implies x=4$

- 154,566
Squaring the equation $A=B$ to get $A^2=B^2$ can be a dangerous thing to do unless you are careful. The second equation is satisfied also by $A=-B$.
Here you are saved because $|x-5|=|5-x|$ - the absolute value effectively ignores/absorbs the sign (to write informally/intuitively)
You are right to be careful, though. If squaring makes things easier use it, but then check back that the solutions you find are also solutions of the original equation you were trying to solve.
Note: Squaring problems with absolute values can be useful, because it reduces the need to consider cases. Each absolute value gives you two cases to consider. Each squaring takes you from a linear equation to a quadratic (or something similar) and you get two solutions of a higher degree equation rather than two cases of lower degree.

- 100,194
-
is there an example where squaring both sides doesn't work? – Mohammad muazzam ali Oct 05 '21 at 10:52
-
@Mohammadmuazzamali If you have $x=-y$ and square it you can easily end up with $x=y$ - if $x$ and $y$ are algebraic expressions this can be hidden. And it gets even more hazardous if they involve square roots. It is a legitimate procedure, but you should check which of the solutions you find satisfy the original equation rather. – Mark Bennet Oct 05 '21 at 11:44
This is because, on the one hand, (on $\mathbf R $) |x|^2=x^2, and on the other hand $\sqrt{x^2}=|x|$, so the first two lines of the above calculation are equivalent.

- 175,478
$|x-5|=1$ equals
$x-5=1$ and $x-5=-1$
If you square $x-5=1$, you get $(x-5)^2=1$.
If you square $x-5=-1$, you get $(x-5)^2=1$.
Which proves $|x-5|=1$ gives $(x-5)^2=1$