If there was a package manager for math theorems and every proof had to install all its dependencies, I am sure that the triangle inequality would have a tremendous amount of downloads. It would be one of those utility packages from npm1 that everyone knew and used. With programming I believe that investigating how such a package works or even writing your own version of it is a great way to learn. Applying that analogy to math suggests that we should investigate where these utility theorems are coming from. Or put in other words: We should study their proofs.

The triangle inequality

The triangle inequality 2 is such a simple yet useful theorem that I decided to revisit its proof and write it down in my own words. For real numbers, it says the following:

Where denotes the absolute value of , which is just the number without the sign. For example we have . It is a simple statement that can be applied whenever an upper bound for the absolute value of a sum is needed. Sometimes it is not good enough, but often this gives good estimations of upper bounds and is used in theorems of this kind.

A proof

Proving this theorem not complicated and requires zero intuition, ideas or knowledge of other theorems. One could think such a simple theorem cannot be very powerful, but it actually is. There are many ways to go about this proof, I write this one here with the intent of showing the theorems simplicity. We consider two arbitrary numbers and use definitions to conclude the inequality. For the sum of the two numbers, one of two things can happen:

Let’s consider the first case where the sum is nonnegative. We know that the absolute value of a nonnegative number is the number itself. Therefore we also know that the absolute value of a number is always greater or equal than the number itself (greater for negative numbers, equal otherwise). This yields:

This holds because replacing and with their absolute values means adding potentially larger numbers yielding a potentially larger result. Nothing fancy happened here, just adding and comparing numbers.

Now, you might think that the second case is the difficult one. It’s not: Consider . Since the sum is negative, its absolute value will have flipped sign:

This is my own proof, so if you spot a mistake please let me know! But I think the general idea is clear: Make some case distinction based on positive and negative numbers and then apply the definition of the absolute value. In the first case we used and similarly for the second.