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?
 A: $\sqrt{(-1)^2} = \sqrt1 = 1$ whereas $(\sqrt{-1})^2 = i^2 = -1$.
A: It is true for all positive and zero $x$, but if $x \lt 0, \sqrt x$ is not defined in the reals, so $(\sqrt x)^2$ is also not defined.  On the other hand $\sqrt {x^2}$ is defined and equals $|x|$ for all real $x$
A: $\sqrt{a}$ is just a symbol for the following problem: solve for $x$ the equation: $x^2=a$. For positive $a$, this equation has 2 solutions with the same absolute value and opposite sign. Usually the positive solution is indicated by $\sqrt[+]{a}$. So in the end:
$$\sqrt{a}=\pm\sqrt[+]{a},~\forall a\ge0$$
Back to your example:
$$(\sqrt{5})^2=(\pm\sqrt[+]{5})^2=(\sqrt[+]{5})^2=5$$
while
$$\sqrt{5^2}=\pm\sqrt[+]{5^2}=\pm\sqrt[+]{25}=\pm5$$
A: 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.)
