# Inverse Functions: Square Root (Part 6)

In this post, I take a deeper look at the standard mistake of “simplifying” $\sqrt{x^2}$ incorrectly as just $x$.

In the previous post, we noted that the function $f: \mathbb{R} \to \mathbb{R}$ defined by $f(x) = x^2$ fails the horizontal line test and thus does not have an inverse function.

However, we can restrict the domain of $f$ to make a new function that does satisfy the horizontal line test. This new function is identical to $f$ where both $f$ and $g$ are defined. Following tradition, we restrict the domain to $[0,\infty)$:

$g: [0,\infty) \to [0,\infty)$ defined by $g(x) = x^2$.

So by essentially erasing the left half of the parabola, we form a function that passes the horizontal line test which therefore has an inverse. Naturally, this function is $g^{-1}(x) = \sqrt{x}$. When I teach Precalculus, I like to write this as a sentence:

$y = \sqrt{x}$ means that $x = y^2$ and $y \ge 0$.

Since $g$ and $g^{-1}$ are inverse functions, it’s always true that $g(g^{-1}(x)) = x$ and $g^{-1}(g(x)) = x$ whenever these functions are defined. For example,

$g(g^{-1}(16)) = g(\sqrt{16}) = g(4) = 4^2 = 16$ and

$g^{-1}(g(3)) = g^{-1}(3^2) = g^{-1}(9) = \sqrt{9} = 3$

In other words, we are guaranteed that $g^{-1}(g(x)) = g^{-1}(x^2) = \sqrt{x^2}$ is always equal to $x$ — as long $x$ lies in the domain of $g$… or, in other words, as long as $x$ is nonnegative.

Because if $x$ is negative, all bets are off.

Remember, the original function $f$ does not have an inverse. In particular, $g^{-1}$ and $f$ are not inverse functions, and so it’s possible for $g^{-1}(f(x))$ to be something other than $x$. For example,

$g^{-1}(f(3)) = \sqrt{3^2} = \sqrt{9} = 3$, but

$g^{-1}(f(-3)) = \sqrt{(-3)^2} = \sqrt{9} = 3 \ne -3$

Of course, I don’t expect my Precalculus students to remember the subtle reason that this fails when they do their homework problems. But I do tell my Precalculus students that the nontrivial simplification of $\sqrt{x^2}$ is a natural consequence of restricting the domain of a function that does not pass the horizontal line test to define an inverse function. In this example, $\sqrt{x^2} = x$ as long as $x \ge 0$. However, if $x < 0$, then the result really could be just about anything else. For the current example, we have the pairwise simplification

$\sqrt{x^2} = x$ if $x \ge 0$;

$\sqrt{x^2} = -x$ if $x < 0$.

The last line is often uncomfortable for students, and so I remind them that $x$ is assumed to be negative so that $-x$ is positive. Of course, there’s a new notation that mathematicians have developed so that this two-line simplification of $\sqrt{x^2}$ can be compressed to a single line:

$\sqrt{x^2} = |x|$

Unfortunately, in my opinion, this remains the problem that can be stated in two seconds or less (“Simplify the square root of $x$ squared”) that, in my opinion, is missed most often by mathematics students.