Why is $\sqrt{x^2} = |x|$? Why is $\sqrt{x^2 } = |x|$ ? 
Squaring always produces a positive result, and you obviously square the equation before taking the root of it. So where exactly is the problem? 
 A: The square root $\sqrt{x}$ for a nonnegative real number $x$ is defined as the nonnegative root of $x$. This causes the following problem:
$$\sqrt{(-3)^2} = \sqrt{9} = 3.$$
A: Think about it in cases:
If $x\geq 0$, then $\sqrt{x^2}=x$.
If $x<0$, then $\sqrt{x^2}$ is positive; it is actually $-x$ (which is positive because $x<0)$.
So, we find that
$$\begin{align*}
\sqrt{x^2}&=\begin{cases}x & \text{if }x\geq0\\-x & \text{if }x<0\end{cases}\\&=\lvert x\rvert.
\end{align*}$$
A: This is true because bothe sides , squared, are equal, and because they're both non-negative.
A: The other answers already correctly address why the identity holds: because of the definition of square root. That's fine, and I won't overlap on their answers here. But you may ask, why is the square root function so defined? To this additional question, I will provide an explanation.
The square root is defined to be nonnegative because otherwise it wouldn't be a function. Note that the function $x \mapsto x^2$ strictly can't be inverted because every non-zero value in the range has two values mapping to it in the domain. E.g. $(-1)^2 = 1^2 = 1$. But the idea of a square root is so useful, that we do a bit of extra work and define the square root function $x \mapsto \sqrt{x}$ such that $\sqrt{x}$ is the unique nonnegative real number such that $\sqrt{x}^2 = x$. It agrees with common sense that, by convention, the meaning of $\sqrt{x}$ is the nonnegative square root of $x$. To express the negative counterpart we just need to write $-\sqrt{x}$.
