Suppose I want to find $$ \min f(x) = \min(\sqrt{x^2-4x+5}+\sqrt{4+x^2}) $$ I'd start with computing derivative and set it to $0$ $$ f'(x) = \frac{x-2}{\sqrt{x^2-4x+5}} + \frac{x}{\sqrt{4+x^2}} $$ Then $$ \frac{x-2}{\sqrt{x^2-4x+5}} + \frac{x}{\sqrt{4+x^2}} = 0 $$ $$ (x-2)\sqrt{4+x^2} + x\sqrt{x^2-4x+5}=0 $$ My first instinct is to rewrite it as $$ (2-x)\sqrt{4+x^2} = x\sqrt{x^2-4x+5} $$ and square both sides. The thing is, I get $$ 3x^2 -16x +16=0 $$ with $x_1 = 4/3$ and $x_2 = 4$. So $f'(x_1^-) <0$ and $f'(x_1^+) > 0$ thus in $x = 4/3$ there is a minimum of our function.
Question: is it valid to square both sides of an equation as I did above? Is there a possibility that because of that I lose or introduce a solution that shouldn't exist and might mess everything up?

Squaring both sides gives you the solutions to $(2-x)\sqrt{4+x^2} = x\sqrt{x^2-4x+5}$ and to $(2-x)\sqrt{4+x^2} = -x\sqrt{x^2-4x+5}$. So if our possible candidates are $x = 4/3, 4$, we can substitute these values into the equation before squaring.
We find that only $x_1 = 4/3$ satisfies the original equation.
Of course it remains to check that $(x_1, f(x_1))$ is a minimum. Therefore $f(x)$ has exactly one minimum point and no other extrema, as the graph confirms: