<s>[INST] Why $\sqrt{x^2}$ is not equal to $\big(\sqrt{x}\big)^2$? I'm reading Precalculus from James Stewart. In the book, the author says that $\sqrt{x^2}$ is not equal to $\big(\sqrt{x}\big)^2$. I was performing a couple of proofs and I ended up here:
If you have, for example:
$\sqrt{5^2} ≟ \big(\sqrt{5}\big)^2 \implies (\sqrt{5})² = \sqrt{5}\cdot\sqrt{5} = \sqrt{5}\cdot5 = \sqrt{25} = \big(\sqrt{5}\big)^2$
So, for me, $\sqrt{5^2}= \big(\sqrt{5}\big)^2$.
Can you proof that I'm wrong?
 [/INST] You are not wrong about $\sqrt{(5)^2} = \left( \sqrt{5}\right) ^2$.
But if you think that this proves that $\sqrt{(-5)^2}$ is equal to  $\left( \sqrt{-5}\right) ^2$, then you are mistaken.
$\sqrt{(-5)^2} = \sqrt{25} = 5$
While $\left( \sqrt{-5}\right) ^2 = \left( \sqrt{-5}\right)\left( \sqrt{-5}\right) = -5$ (or it does not exist if our domain of discourse if the real numbers.)
</s>