# Proving square root of a square is the same as absolute value

Lets say I have a function defined as $f(x) = \sqrt {x^2}$. Common knowledge of square roots tells you to simplify to $f(x) = x$ (we'll call that $g(x)$) which may be the same problem, but it isn't the same equation. For example, say I put $-1$ into them:

\begin{align} f(x) &= \sqrt {x^2} \\ f(-1) &= \sqrt {(-1)^2} \\ f(-1) &= \sqrt {1} \\ f(-1) &= 1 \end{align}

\begin{align} g(x) &= x \\ g(-1) &= -1 \end{align}

thereby, we conclude that $f(x)$ and $g(x)$ do not produce the same results even though they are mathematically the same. This is also shown when we try to graph the functions:   From this, we can see that given $f(x) = \sqrt {x^2}$, when simplified is not the same as $f(x) = x$. So, is there any way to prove that $y = \sqrt {x^2}$ is not the same as $y = x$ for negative values, but is infact the same as $y = \mid x \mid$?

• How is $y=\sqrt{x^2}$ a "2d line?" As for how you prove this, first you have to specify how you define things. Specifically, how do you define $|z|$ and $\sqrt{z}$? (I'm not entirely sure why you branch off into infinity. Infinity is not a number, and treating it as one is almost always an error. In a few circumstances, you can, but most of the time it is not worth it.) – Thomas Andrews Dec 14 '12 at 20:03
• Can't you break into two cases, $x>=0$ and $x<0$, and check that for each one it's the same as $|x|$ ? – Ricbit Dec 14 '12 at 20:04

It is the definition of square root of a number. The square root is defined in the sense that $s(x^2) = \sqrt{ x^2 } = |x|$ for all real $x$. Thus, the domain is the real numbers and the codomain is the non-negative real numbers. The reason it is defined this way is to make sure that $s$ is a function. Assume for a minute that $s(x^2) = x$, then: $$\sqrt{(-5)^2} = -5, \qquad \sqrt{5^2} = 5$$ But we know that $\sqrt{(-5)^2} = \sqrt{25} = \sqrt{5^2}$. Thus we see that $s(25) = -5, 5$. And thus $s$ is not a function. To keep it as a function, we have to 'sacrifice' and say that $s(x^2) \neq x$. Rather, $s(x^2) = |x|$. This will be consistent with the definition of a function.
Since it is a definition, it cannot be proven. The problem is that many think that $\sqrt {x^2} = x$ because we study positive numbers before we study negative numbers, which is understandable, because I used to make that mistake all the time.
Given a non-negative real number $\alpha$, the number $\sqrt\alpha$ is defined to be the unique non-negative real number $\beta$ such that $\beta^2=\alpha$. Since $\sqrt{\alpha}\geq 0$ for all $\alpha\geq 0$, then for any real $\gamma$, it follows that $$\sqrt{\gamma^2}=\begin{cases}\gamma & \gamma\geq 0\\-\gamma & \gamma<0,\end{cases}$$ that is, $$\sqrt{\gamma^2}=|\gamma|.$$
When $x < 0$, $|x| = -x > 0$. $-x \ne x$ (unless $x=0$) and $(-x)^2 = x^2$. There are two "square roots" of any positive number $y$, i.e. numbers whose square is $y$, and the positive one is called $\sqrt{y}$. So $\sqrt{x^2} = -x = |x|$ when $x < 0$, and $\sqrt{x^2} = x = |x|$ when $x \ge 0$.