# Prove the triangle inequality [duplicate]

I want to porve the triangle inequality:

$x, y \in \mathbb{R} \text { Then } |x+y| \leq |x| + |y|$

I figured out that probably the cases:

1. $x\geq0$ and $y \geq 0$
2. $x<0$ and $y < 0$
3. $x\geq0$ and $y < 0$
4. $x<0$ and $y \geq 0$ <- Here I am not sure...

have to be proven. However, I do not figured out a concrete method. Are my assumptions true? How to finish the prove with these assumptions. I really appreciate your answer!!!

-

## marked as duplicate by Grigory M, Sami Ben Romdhane, Najib Idrissi, Dan Rust, mookidApr 20 '14 at 13:17

If you can do $(3)$, you should be able to do $(4)$ by using $(3)$. – Tunococ Aug 1 '13 at 23:27

You can use the following

For any $x,a\in\Bbb R$, we have that $|x|\leq a$ if and only if $-a\leq x\leq a$

Then since we have $-|x|\leq x\leq |x|$ and $-|y|\leq y\leq |y|$ for any pair $x,y$, this gives $$-(|x|+|y|)\leq x+y\leq |x|+|y|$$

which by the claim is equivalent to $|x+y|\leq |x|+|y|$, which is the triangle inequality.

-
-

Hint: If both $x,y \geq 0$ or both $x,y \leq 0$ then we just have,

$$|x+y|=|x|+|y|$$

If one is greater than zero and one is less than zero, then it should be obvious that if it does not matter which one I prove it for.

-

If both $x$ and $y$ are $0$ or $x=-y$ then the inequality is clear. Otherwise we note that for $x,y\in\mathbb{R}$ $x\le|x|$ and similarly $y\le|y|$, which follows from the definition of the absolute value.

This tells us that $x+y\le|x|+|y|$ which implies $\frac{x+y}{|x|+|y|}\le1$ since $|x|+|y|>0$.

Thus, $|x+y|=|\frac{x+y}{|x|+|y|}|(|x|+|y|)=\frac{1}{sgn\bigg(\frac{x+y}{|x|+|y|}\bigg)}\frac{x+y}{|x|+|y|}(|x|+|y|)\le|x|+|y|$.

-

My favorite way to deal with absolute values is to use the definition I learned from Edsger W. Dijkstra's writings, viz. $$|x| = x \:\max\: -x$$ and then use the nice properties of $\;\max\;$ instead of the less nice properties of $\;|\cdot|\;$. Here this helps me a lot, since it prevents a proof by cases.

Working from the right of the left of the equation, the proof becomes a straightforward calculation: \begin{align} & |x|+|y| \\ = & \;\;\;\;\;\text{"the above definition of $\;|\cdot|\;$, twice"} \\ & (x \:\max\: -x) + (y \:\max\: -y) \\ = & \;\;\;\;\;\text{"$\;+\;$ distributes over $\;\max\;$, three times"} \\ & (x + y) \:\max\: (x-y) \:\max\: (-x+y) \:\max\: (-x-y) \\ = & \;\;\;\;\;\text{"reintroduce $\;|\cdot|\;$ using the above definition, twice"} \\ & |x+y| \:\max\: |x-y| \\ \geq & \;\;\;\;\;\text{"basic property of $\;\max\;$"} \\ & |x+y| \\ \end{align} Note that in the middle steps I have implicitly used the fact that $\;\max\;$ is associative and symmetric.

-