# Making Connection Between Distance and Absolute Value

We have learned about the distance formula and we also have discussed how to get the distance between two points given their coordinates.  In this post, we are going to explore a simpler concept: getting the distance between two points on the number line.

Suppose we want to get the distance between two p0ints on the number line whose coordinates are integers, we can just do it by counting. In the figure below, the distance from $0$ to $5$ is $5$, and the distance from $5$ to $9$ is $4$.

image via nctm illuminations

It is also obvious that we can get the distance by subtraction: $5-0=5$ and $9-5=4$.  It is clear that if we let $a$ be the larger integer, and $b$ be the smaller, then the distance can between the two integers is $a-b$. It is also clear that this formula applies to non-integral coordinates.

The distance between $5$ and $9$, however, is just the same as the distance between $9$ and $5$, so the values of $a$ and $b$ should be interchangeable.  However, if we do, if $a = 4$ and $b = 9$, then $a - b = -4$. But distance is not supposed to be negative, so we get the negative of $-5$ which is $-(-5)=5$. It follows from above that if  $b > a$, the distance between $a$ and $b$ is $-(a-b)$.  Of course, if $a=b$, then $a - b = 0$.

If we denote the distance between $a$ and $b$ as $|a-b|$, then, the distance equals

1. $a- b$ if $a > b$
2. $0$ if $a = b$
3. $a- b$ if $a < b$.
The preceding definition can be shortened using the following notation:
$|a-b| = \begin{cases} a-b, a > b \\0, a = b\\-(a-b), a.
Although the notation is a bit fancy,  it only translates the definition of distance above.   Note that this definition is also the definition of absolute value. The notation $latex $|a-b|$ is read as the absolute value of $a - b$. From above, it follows that the the absolute value of $n$, denoted by$latex $|n|$, is defined as

$|n| = \begin{cases} n, n > 0 \\0, n = 0\\-n, n <0 \end{cases}$.

Geometrically, if $n$ is any real number, then $|n|$ means $n$ units from 0; that is, the distance of $n$ from $0$.

Some Examples

Example 1: We can easily see that |5| = 5 and that |-5| = 5. Hence, the |-5| is the distance from 0 to -5 which equals 5 units.

Example 2: Of course $- |-5| = -5$.
Example 3: $|x - 4| < -5$ means that  $(x - 4) < 5$ and $-(x-4) < 5$

A more compact notation

Notice that the notation above can be simplified to

$|n| = \begin{cases} n, n \geq 0 \\-n, n <0 \end{cases}$ .
It also important to note that $|n| = \sqrt{n^2}$.