Tutorials › Real Analysis › Triangle Inequality

Number Systems · Tutorial 100 of 1000

Triangle Inequality

Learn how to apply the Triangle Inequality to finite sums, and identify when the resulting bound is exact.

Beginner 8 min read

What You'll Learn

  • Extend the Triangle Inequality to a sum of any finite number of real numbers
  • Apply the finite-sum bound to expressions with cancellation
  • Determine exactly when equality holds in the finite-sum inequality
  • Use absolute values to bound the total of several errors
  • Recognize why an upper bound need not be an exact value

From Two Terms to Finite Sums

The Triangle Inequality, established in the Absolute Value tutorial, says that \(|x+y|\leq |x|+|y|\) for real numbers \(x\) and \(y\). Its practical strength is that it bounds a combined quantity without requiring us to know its sign. This tutorial extends that idea to any finite list of real numbers. The extension is useful when an expression has several terms, or when several separate errors contribute to one total.

The key is to apply the two-term inequality repeatedly. For example, first group the first two terms, then combine their sum with the third term. At each stage, the absolute value of the partial sum is bounded by the sum of the absolute values already included. This gives an upper bound even if some terms cancel one another.

Convention (Finite sum). For a positive integer \(n\) and real numbers \(x_1,\ldots,x_n\), write \(\sum_{k=1}^{n}x_k\) for \(x_1+x_2+\cdots+x_n\). The sum \(\sum_{k=1}^{n}|x_k|\) means \(|x_1|+|x_2|+\cdots+|x_n|\).
Theorem (Finite-Sum Triangle Inequality). For every positive integer \(n\) and all \(x_1,\ldots,x_n\in\mathbb{R}\),
$$ \left|\sum_{k=1}^{n}x_k\right| \leq \sum_{k=1}^{n}|x_k|. $$

Proof. We use induction on \(n\). If \(n=1\), then the two sides are both \(|x_1|\), so the inequality holds. Now suppose it holds for some positive integer \(n\). For real numbers \(x_1,\ldots,x_n,x_{n+1}\), the Triangle Inequality for two real numbers gives

$$ \left|\sum_{k=1}^{n+1}x_k\right| = \left|\left(\sum_{k=1}^{n}x_k\right)+x_{n+1}\right| \leq \left|\sum_{k=1}^{n}x_k\right|+|x_{n+1}|. $$

By the induction hypothesis, \(\left|\sum_{k=1}^{n}x_k\right|\leq\sum_{k=1}^{n}|x_k|\). Adding \(|x_{n+1}|\) to both sides preserves the inequality. Therefore,

$$ \left|\sum_{k=1}^{n+1}x_k\right| \leq \sum_{k=1}^{n}|x_k|+|x_{n+1}| = \sum_{k=1}^{n+1}|x_k|. $$

This proves the statement for \(n+1\), and induction proves it for every positive integer \(n\). \(\square\)

The theorem says that the magnitude of a sum cannot exceed the sum of the magnitudes of its terms. It does not say that the two quantities are always equal. When terms have different signs, their contributions can cancel in the sum, while the right-hand side counts every magnitude as nonnegative.

Worked Example: Bounding a Sum with Mixed Signs

Consider the sum \(-8+3-2\). The finite-sum Triangle Inequality gives an upper bound by adding the magnitudes of the three terms:

$$ |-8+3-2| \leq |-8|+|3|+|-2| =8+3+2 =13. $$

The sum itself is \(-7\), so its magnitude is \(7\). Thus the inequality reads \(7\leq13\). The bound is valid but not exact: the positive term \(3\) partly cancels the negative terms. The theorem gave a bound without needing that calculation of the sum first.

Using the Inequality with Grouped Terms

A finite sum can be grouped before applying the Triangle Inequality. This is useful when some parts of an expression are easier to handle together. For example, the two-term theorem gives \(|a+b|\leq|a|+|b|\) for one group, and it can then be applied to the sum of that group and another term. The finite-sum theorem guarantees that this repeated process is valid no matter how many terms are present.

The bound also applies when the terms are fractions, powers, or values of functions, provided each term is a real number. It is often useful to choose whether to calculate the sum exactly or to bound it directly. If the individual terms are easy to estimate but the sum is awkward, the inequality may give the information needed with less calculation.

Worked Example: Bounding a Fractional Sum

Use the finite-sum Triangle Inequality to bound the magnitude of \(\frac{1}{2}-\frac{2}{3}+\frac{1}{4}\). First, take the absolute value of each term separately:

$$ \left|\frac{1}{2}-\frac{2}{3}+\frac{1}{4}\right| \leq \left|\frac{1}{2}\right| +\left|-\frac{2}{3}\right| +\left|\frac{1}{4}\right| = \frac{1}{2}+\frac{2}{3}+\frac{1}{4}. $$

Putting the right-hand side over the common denominator \(12\) gives

$$ \frac{1}{2}+\frac{2}{3}+\frac{1}{4} = \frac{6}{12}+\frac{8}{12}+\frac{3}{12} = \frac{17}{12}. $$

Thus the magnitude of the original sum is at most \(\frac{17}{12}\). To check the bound, combine the original terms using the same denominator:

$$ \frac{1}{2}-\frac{2}{3}+\frac{1}{4} = \frac{6}{12}-\frac{8}{12}+\frac{3}{12} = \frac{1}{12}. $$

Its magnitude is \(\frac{1}{12}\), which is indeed no greater than \(\frac{17}{12}\). The difference between these values reflects cancellation in the original sum.

When Is the Bound Exact?

The finite-sum inequality becomes an equality precisely when cancellation does not reduce the magnitude of the sum. For real numbers, that happens when all the terms are nonnegative or all are nonpositive. Zeros are allowed in either case: they contribute nothing to the sum of the magnitudes and do not oppose any other term.

Definition (Terms of the same weak sign). A finite list of real numbers has the same weak sign if either every term is nonnegative or every term is nonpositive. In particular, a list consisting only of zeros has the same weak sign.
Theorem (Equality in the Finite-Sum Triangle Inequality). For real numbers \(x_1,\ldots,x_n\), where \(n\geq1\),
$$ \left|\sum_{k=1}^{n}x_k\right| = \sum_{k=1}^{n}|x_k| $$
if and only if \(x_1,\ldots,x_n\) have the same weak sign.

Proof. First suppose that all the terms are nonnegative. Then their sum is nonnegative, so its absolute value equals the sum itself. Also \(|x_k|=x_k\) for each \(k\). Consequently,

$$ \left|\sum_{k=1}^{n}x_k\right| = \sum_{k=1}^{n}x_k = \sum_{k=1}^{n}|x_k|. $$

If instead all the terms are nonpositive, then their sum is nonpositive. Its absolute value is the negative of that sum, and \(|x_k|=-x_k\) for each \(k\). Hence

$$ \left|\sum_{k=1}^{n}x_k\right| = -\sum_{k=1}^{n}x_k = \sum_{k=1}^{n}(-x_k) = \sum_{k=1}^{n}|x_k|. $$

This proves equality whenever the terms have the same weak sign, including the case in which every term is zero.

Conversely, suppose that

$$ \left|\sum_{k=1}^{n}x_k\right| = \sum_{k=1}^{n}|x_k|. $$

Let \(P\) be the sum of the positive terms among \(x_1,\ldots,x_n\), taking \(P=0\) if there are no positive terms. Let \(N\) be the sum of the magnitudes of the negative terms, taking \(N=0\) if there are no negative terms. Both \(P\) and \(N\) are nonnegative. The sum of all the terms is \(P-N\), and the sum of their absolute values is \(P+N\). Our assumed equality is therefore

$$ |P-N|=P+N. $$

If \(P\geq N\), then \(|P-N|=P-N\), so the equation implies \(P-N=P+N\), and hence \(2N=0\). Since \(N\geq0\), this gives \(N=0\): there are no negative terms. If \(P<N\), then \(|P-N|=N-P\), so the equation implies \(N-P=P+N\), and hence \(2P=0\). Thus \(P=0\), and there are no positive terms. In either case, all the terms have the same weak sign. This proves the converse and completes the proof. \(\square\)

Worked Example: Checking When Equality Holds

For the terms \(-5,0,-2\), every term is nonpositive. The equality theorem therefore guarantees equality in the finite-sum bound. Direct calculation confirms it:

$$ |-5+0-2| = |-7| = 7 = 5+0+2 = |-5|+|0|+|-2|. $$

For the terms \(4,-1,0\), one term is positive and one is negative. They do not have the same weak sign, so equality does not hold. Indeed,

$$ |4-1+0|=3 \qquad\text{while}\qquad |4|+|-1|+|0|=5. $$

The positive and negative terms partly cancel, making the magnitude of the sum strictly smaller than the sum of the magnitudes.

Bounding the Total of Several Errors

One important use of the finite-sum Triangle Inequality is to control a total error. Suppose real numbers \(e_1,\ldots,e_n\) represent separate signed errors. A positive error and a negative error can cancel in the total, but cancellation may not be reliable or even known in advance. The inequality gives a bound that remains valid regardless of the signs:

$$ |e_1+\cdots+e_n| \leq |e_1|+\cdots+|e_n|. $$

For example, if each of four errors has magnitude at most \(0.02\), then the magnitude of their total is at most \(0.08\). In detail, if \(|e_k|\leq0.02\) for each \(k=1,2,3,4\), adding those inequalities gives

$$ |e_1|+|e_2|+|e_3|+|e_4| \leq 0.02+0.02+0.02+0.02 = 0.08. $$

Combining this with the finite-sum Triangle Inequality yields \(|e_1+e_2+e_3+e_4|\leq0.08\). This does not claim that the total error actually reaches \(0.08\). It is a guaranteed upper bound, and the equality theorem explains that equality can occur only if the errors have the same weak sign.

A common pitfall is to treat the inequality as an equality without checking signs. For instance, \(|4+(-1)|=3\), not \(4+1=5\). The right-hand side is a safe bound, not necessarily the exact magnitude. When exactness matters, calculate the signed sum or use the equality criterion. When only a guaranteed bound is needed, the finite-sum inequality avoids having to track every cancellation.

Key takeaway. For any finite list of real numbers, the magnitude of the sum is at most the sum of the magnitudes. Equality holds exactly when all terms are nonnegative or all terms are nonpositive.

Check Your Understanding

Use the finite-sum Triangle Inequality and its equality criterion to answer the following questions.

  1. Give an upper bound for \(|6-4+(-3)|\) by adding the magnitudes of the three terms.
  2. For the terms \(-2,0,-9\), determine whether the finite-sum inequality is an equality, and verify your answer by calculation.
  3. For the terms \(7,-2,1\), determine whether equality holds and explain what happens to the bound.
  4. If \(|e_1|\leq0.03\), \(|e_2|\leq0.04\), and \(|e_3|\leq0.01\), what upper bound does the finite-sum Triangle Inequality give for \(|e_1+e_2+e_3|\)?
  5. State the condition on \(x_1,\ldots,x_n\) that is necessary and sufficient for \(\left|\sum_{k=1}^{n}x_k\right|=\sum_{k=1}^{n}|x_k|\).