*I teach three interchangeable definitions of the absolute value function, encouraging students to choose a favorite and be able to swap between them freely.*

In each definition, the absolute value function is a [real function][(\(\mathbb{R}\to\mathbb{R},\) meaning that for every real input there is exactly one real output)] that I denote with \(\DeclareMathOperator{\absop}{abs}

\newcommand\abs[1]{\absop\left({#1}\right)}\abs{x}.\)

## Distance

*This is the geometric definition, the intuition and the purpose.*

\(\abs{x}\) represents the distance between \(x\) and the origin. This is equivalent to the definition that \(\abs{x-y}\) represents the distance between \(x\) and \(y\). (Why?)(why-equiv-distance)

(start why-equiv-distance)

We will show equivalence by first assuming the distance definition for \(\abs{x}\) and deriving that of \(\abs{x-y}\) from it, and second by assuming the definition for \(\abs{x-y}\) and deriving \(\abs{x}\) from it.

Going from \(\abs{x}\) as the distance between \(x\) and the origin \(0\) to \(\abs{x-y}\) is a matter of shifting<!TODO> to the right by \(y.\) This means that \(\abs{x-y}\) as a function of \(x\) feels like \(\abs{x}\) if the origin were at \(y\) instead of \(0,\) and thus we have \(\abs{x-y}\) as the distance between \(x\) and \(y\) instead of \(0.\)

Going the other direction is easy: Simply let \(y=0,\) and then the distance \(\abs{x-y}\) between \(x\) and \(y=0\) becomes \(\abs{x},\) and so \(\abs{x}\) must be the distance between \(x\) and the origin.

(stop why-equiv-distance)

## Piecewise

*This is the definition most courses use, the most direct for computation.*

When computing the value of \(\abs{x},\) if \(x\) isn't negative, leave it alone; if it is, swap it to positive. In precise notation, that means:

\[

\abs{x} = \begin{cases}

x & \text{if $x\ge 0$} \\

-x & \text{if $x< 0$}

\end{cases}

\]

## Square Root

*This is a convenient trick.*

For calculators that don't have an absolute value, you can use \(\abs{x}=\sqrt{x^2}\) to compute it. This is also surprisingly useful for proving a few properties, especially for understanding why the solution to \(x^2=4\) is \(x=\pm 2.\) (Why?)(why-square-root-solution)

(start why-square-root-solution)

After taking the square root of both sides of \(x^2=4,\) we get \(\sqrt{x^2}=2.\) Many students try to simplify \(\sqrt{x^2}\) to \(x,\) but as mentioned above and proven below, \(\sqrt{x^2}=\abs{x}\) instead. So we have \(\abs{x}=2,\) which is easy to solve using one of the other definitions to get \(x=\pm2.\)

(stop why-square-root-solution)

## Equivalence

*How do we know these definitions are interchangeable?*

The first two definitions are equivalent somewhat by fiat: we define the distance of a nonnegative number from the origin to be the number itself. It then makes sense that the distance for a negative number be the opposite of itself, since you've gone that far in the negative direction.

This square root definition works because the square root function is actually the *principal* square root function. (That is...)(that-is-principal-square-root)

(start that-is-principal-square-root)

When looking for a square root of \(y,\) you want to find an \(x\) for which \(x^2=y,\) and when there is a solution, there's usually two, since \((-x)^2=(-1)^2x^2=x^2.\) When there's a positive and a negative choice for square roots, the principal square root function \(\sqrt{y}\) is conveniently defined to return the positive choice.

(stop that-is-principal-square-root)

So that means \(\abs{x}=\sqrt{x^2}\) is the same as saying \(\abs{x}^2=x^2\) together with \(\abs{x}\ge 0.\) When \(x\) is also not negative, this is the same as \(\abs{x}=x,\) and when \(x\) is negative, it is \(\abs{x}=-x,\) so this definition is equivalent to the piecewise definition.