The single most important inequality in
analysis is the *triangle inequality*, and it will be
used a lot throughout this course. Later on it
becomes the main building block for a more general
theory of analysis that you learn about when you
study metric spaces.

The triangle inequality concerns *distance*
between points and says that the straight line

distance between $A$ and $B$ is less than
the sum of the distances from $A$ to $C$
and from $C$ to $B$. It is very much
part of our everyday intuition about distances
and easy to remember. It is, however, very useful.

Given real numbers $x$ and $y$ the value $\left|x-y\right|$ represents the distance along the numberline from $x$ to $y$. By definition, it is equal to $x-y$ if $x\u2a7ey$ and to $y-x$ if $y>x$. So $\left|x-y\right|=\left|y-x\right|$. We will sometimes denote this distance by $d(x,y)$ or $d(y,x)$.

The triangle inequality.

For all $x,y,z\in \mathbb{R}$ we have

**Proof.**

This is just by looking at all the cases.

**Subproof.**

**Case 1:**
$x\u2a7ey$. Then $d(x,y)=\left|x-y\right|=x-y$.
There are three subcases. They are all very similar.

**Subproof.**

*Case 1a:*
$z\u2a7ex$, so $d(x,z)=\left|x-z\right|=z-x\u2a7e0$
and $d(z,y)=\left|z-y\right|=z-y\u2a7ex-y=d(x,y)$ giving
$d(x,z)+d(z,y)\u2a7ed(x,y)$.

**Subproof.**

*Case 1b:*
$x>z\u2a7ey$, so $d(x,z)=\left|x-z\right|=x-z$
and $d(z,y)=\left|z-y\right|=z-y$ giving
$d(x,z)+d(z,y)=x-z+z-y=x-y=d(x,y)$.

**Subproof.**

*Case 1c:*
$y>z$, so $d(x,z)=\left|x-z\right|=x-z\u2a7ex-y$
and $d(z,y)=\left|z-y\right|=y-z\u2a7e0$ giving
$d(x,z)+d(z,y)\u2a7e=x-y=d(x,y)$.

Also:

**Subproof.**

**Case 2:**
$x<y$. Then $d(x,y)=\left|x-y\right|=y-x$.
There are three subcases.

**Subproof.**

*Case 2a:*
$z\u2a7ey$, so $d(x,z)=\left|x-z\right|=z-x\u2a7ed(x,y)$
and $d(z,y)=\left|z-y\right|=z-y\u2a7e0$ giving
$d(x,z)+d(z,y)\u2a7ed(x,y)$.

**Subproof.**

*Case 2b:*
$y>z\u2a7ex$, so $d(x,z)=\left|x-z\right|=z-x$
and $d(z,y)=\left|z-y\right|=y-z$ giving
$d(x,z)+d(z,y)=z-x+y-z=y-x=d(x,y)$.

**Subproof.**

*Case 2c:*
$x>z$, so $d(x,z)=\left|x-z\right|=x-z\u2a7e0$
and $d(z,y)=\left|z-y\right|=y-z\u2a7ey-x$ giving
$d(x,z)+d(z,y)\u2a7e=y-x=d(x,y)$.

The triangle inequality in $\mathbb{R}$ takes the form

Note the $\u2a7d$, the $+$ sign and the introduced intermediate point $z$ on the right. By rearranging we have $\left|x-y\right|-\left|z-y\right|\u2a7d\left|x-z\right|$, or

which also has an intermediate

point $y$
added on the right in the same way,
but the $\u2a7d$ has changed to $\u2a7e$ and
the $+$ has changed to $-$. Both forms are
equally useful. I find the first easy to remember; the
hints here will help you remember the second just as easily.

We can also write the triangle inequality in $\mathbb{R}$ in the form

To derive this from the other versions just note that

Hence the result. Its alternative form,

can be derived in a similar way. If we switch $-y$ for $y$ we can even get

and

which can also be useful, especially if we don't know if $y$ is negative or positive.