Sub topic 13
The Triangle Inequality and When Equality Holds
This chapter assumes you can work with the definition of modulus, read |x − a| as a distance on the number line, and split an expression at its critical points. It also uses the basic modulus properties from earlier chapters, such as |ab| = |a||b| and |a|² = a².
The triangle inequality lets you skip case work. Many CAT questions that look like they need a two- or three-case split can be answered in one line. You recognise the triangle inequality, then ask when equality holds. The equality condition usually matters more than the inequality, because it gives you the solution set or the place where a minimum is reached.
The Statement and Its Proof
For any real numbers a and b:
|a + b| ≤ |a| + |b|
Squaring both sides gives a short proof. Both sides are non-negative, so comparing their squares is valid:
- Left side squared: (a + b)² = a² + 2ab + b²
- Right side squared: (|a| + |b|)² = a² + 2|ab| + b²
Since ab ≤ |ab| always, the left square is never larger than the right square. The two sides are equal exactly when ab = |ab|, which means ab ≥ 0.
The zero case is easy to forget. If a = 0, equality holds no matter what b is. On CAT this decides whether an endpoint belongs in the answer, so it shows up directly when you count integer solutions.
The Family of Related Forms
Replacing b with −b, or rearranging terms, gives the other versions you need.
| Form | Equality holds when | Typical use | Column | Column | Column | Column | Column | Column | Column | Column |
|---|---|---|---|---|---|---|---|---|---|---|
| \ | a + b\ | ≤ \ | a\ | + \ | b\ | ab ≥ 0 | Upper bound on a sum | |||
| \ | a − b\ | ≤ \ | a\ | + \ | b\ | ab ≤ 0 | Upper bound on a difference | |||
| \ | a − b\ | ≥ \ | \ | a\ | − \ | b\ | \ | ab ≥ 0 | Lower bound on a difference | |
| \ | a\ | − \ | b\ | ≤ \ | a − b\ | b(a − b) ≥ 0 | Bounding a difference of moduli | |||
| \ | a₁ + a₂ + … + aₙ\ | ≤ \ | a₁\ | + … + \ | aₙ\ | all aᵢ ≥ 0 or all aᵢ ≤ 0 | Sums of many terms |
Rows two and three use opposite sign conditions, which is a common source of mistakes. You can always rederive the condition. Write the larger expression as a sum of two pieces and require those pieces to share a sign. For row four, a = (a − b) + b, so |a| ≤ |a − b| + |b|, with equality when (a − b) and b have the same sign.
The Distance Picture
On the number line, |x − p| is the distance from x to p. The inequality
|x − p| + |x − q| ≥ |p − q|
says that a trip from p to x and then on to q is at least as long as the direct trip from p to q. Equality holds exactly when x lies between p and q. Algebraically, set a = x − p and b = q − x. Then a + b = q − p, and equality needs (x − p)(q − x) ≥ 0, which means x is between p and q, endpoints included.
Worked Example 1: Minimum Without Cases
Find the minimum of |x − 2| + |x + 5| and the values of x where it occurs.
Write |x − 2| = |2 − x|. The inner expressions (2 − x) and (x + 5) add to 7, so
|2 − x| + |x + 5| ≥ |7| = 7.
Equality needs (2 − x)(x + 5) ≥ 0, which gives −5 ≤ x ≤ 2. The minimum is 7, and it is reached on the whole interval [−5, 2]. The next chapter extends this flat-bottom behaviour to three or more points through the median property.
Worked Example 2: An Equation That Is Really an Equality Condition
Solve |x + 3| + |x − 4| = |2x − 1|.
The inner expressions satisfy (x + 3) + (x − 4) = 2x − 1. The equation therefore says that the triangle inequality holds with equality. That happens exactly when
(x + 3)(x − 4) ≥ 0, which gives x ≤ −3 or x ≥ 4.
The solution set is (−∞, −3] ∪ [4, ∞). Splitting at the critical points −3, 1/2 and 4 would give the same answer but would need four cases.
sols = [x for x in range(-10, 11) if abs(x + 3) + abs(x - 4) == abs(2 * x - 1)]
print(sols)
# [-10, -9, -8, -7, -6, -5, -4, -3, 4, 5, 6, 7, 8, 9, 10]The integers from −2 through 3 fail, which matches the predicted gap.
Worked Example 3: Range of a Difference of Moduli
Find the range of f(x) = |x + 1| − |x − 5|.
By the reverse form, ||x + 1| − |x − 5|| ≤ |(x + 1) − (x − 5)| = 6, so −6 ≤ f(x) ≤ 6. Both bounds are reached:
- f(x) = 6 needs (x − 5) and (x + 1) − (x − 5) = 6 to share a sign, so x − 5 ≥ 0, giving x ≥ 5.
- f(x) = −6 needs x ≤ −1, by the same argument with the roles of the two terms swapped.
f is continuous, so it takes every value in between. The range is [−6, 6].
xs = [i / 10 for i in range(-200, 201)]
vals = [abs(x + 1) - abs(x - 5) for x in xs]
print(min(vals), max(vals)) # -6.0 6.0Worked Example 4: Bounds From Given Ranges
If |a| ≤ 3 and |b| ≤ 5, find the maximum of |a − 2b|.
|a − 2b| ≤ |a| + 2|b| ≤ 3 + 10 = 13. Equality in |a − 2b| ≤ |a| + |2b| needs a and b to have opposite signs, or one of them to be zero. Taking a = 3 and b = −5 gives |3 + 10| = 13, so the bound is reached. Before you accept a bound, check that every inequality in the chain can be an equality at the same time.
Common Errors
- Using strict inequality. |a + b| < |a| + |b| is false whenever ab ≥ 0. An answer option such as "no solution" is often a trap built on this error.
- Dropping the zero case. The condition is ab ≥ 0, not ab > 0. Endpoints such as x = −3 and x = 4 in Example 2 belong in the solution.
- Mixing up the conditions for sums and differences. For |a − b| ≤ |a| + |b|, equality needs ab ≤ 0. Rederive the condition when in doubt.
- Claiming a bound that cannot be reached. A chain of inequalities gives the true extreme value only if all of its equality conditions can hold together.
- Forcing the method. If the inner expressions do not combine to a constant or to another modulus argument, go back to splitting at critical points.
Exercises
Exercise
Solve |x − 1| + |x − 6| = 5 and count the integer solutions.
Show answer
(x − 1) + (6 − x) = 5, so the equation is the equality case of |x − 1| + |6 − x| ≥ 5. It holds when (x − 1)(6 − x) ≥ 0, which means 1 ≤ x ≤ 6. There are 6 integer solutions: 1, 2, 3, 4, 5 and 6.
Exercise
Solve |2x − 3| + |x + 4| = |3x + 1|.
Show answer
(2x − 3) + (x + 4) = 3x + 1, so equality needs (2x − 3)(x + 4) ≥ 0. The solution set is x ≤ −4 or x ≥ 3/2, written (−∞, −4] ∪ [3/2, ∞).
Exercise
Find the range of g(x) = |x − 7| − |x + 2|, and the values of x where g reaches its maximum.
Show answer
|g(x)| ≤ |(x − 7) − (x + 2)| = 9, so the range is [−9, 9]. The maximum 9 needs (x + 2) and (x − 7) − (x + 2) = −9 to share a sign, so x + 2 ≤ 0, which means x ≤ −2.
Exercise
If |p| ≤ 4 and |q| ≤ 2, what is the minimum possible value of |p| − |3q| subject to |p − 3q| = 10?
Show answer
|p − 3q| ≤ |p| + 3|q| ≤ 4 + 6 = 10, so the value 10 forces |p| = 4, |q| = 2, and p and q of opposite signs (for example p = 4, q = −2). Then |p| − |3q| = 4 − 6 = −2, and this is the only possible value, so the minimum is −2.