Sub topic 11
Multiple Modulus Terms: Splitting at Critical Points
This chapter assumes you can solve single-modulus equations and inequalities such as |x − 3| < 5. You should also be able to solve linear inequalities and write answers in interval notation. Here those skills extend to expressions such as |x − 3| + |x + 2|, |x − 1| − |x + 3| and |x| + 2|x − 3|. CAT often uses expressions like these, both as "solve this" questions and as "how many integers satisfy this" questions.
Why one modulus rule is not enough
With a single modulus you can use the shortcut |f(x)| < k ⇔ −k < f(x) < k. With two or more modulus terms that shortcut no longer works, because each term can be positive or negative on its own. You have to find where each term changes sign. On each piece of the number line between those points, every modulus has a fixed sign, so you can remove the bars and solve an ordinary linear problem.
Critical points
A critical point is a value of x where the expression inside a modulus equals zero. For |x − 3| + |x + 2| the critical points are x = 3 and x = −2. Two critical points cut the number line into three intervals, and n critical points cut it into n + 1 intervals.
| Interval | Sign of x − 3 | Sign of x + 2 | Expression without bars |
|---|---|---|---|
| x < −2 | negative | negative | (3 − x) + (−x − 2) = 1 − 2x |
| −2 ≤ x ≤ 3 | negative or zero | positive or zero | (3 − x) + (x + 2) = 5 |
| x > 3 | positive | positive | (x − 3) + (x + 2) = 2x − 1 |
To find a sign quickly, test any number inside the interval. For example, x = −10 makes both insides negative.
The procedure
The intersection check in the decision box is where most errors happen. A piece's algebra can produce a value outside that piece's interval. That value is not a solution.
Worked example 1: a sum inequality
Solve |x − 3| + |x + 2| < 9.
Use the table above.
- For x < −2: 1 − 2x < 9 gives x > −4. Intersect with x < −2 to get (−4, −2).
- For −2 ≤ x ≤ 3: 5 < 9 always holds, so the whole interval [−2, 3] is kept.
- For x > 3: 2x − 1 < 9 gives x < 5. Intersect with x > 3 to get (3, 5).
The union is (−4, 5). The integers in it run from −3 through 4, which is 8 integers. You can confirm this by brute force:
count = sum(1 for x in range(-100, 101) if abs(x - 3) + abs(x + 2) < 9)
print(count) # 8, the integers -3 through 4Worked example 2: an equation with no middle solution
Solve |x − 1| + |x − 4| = 5. The critical points are 1 and 4.
- For x < 1: (1 − x) + (4 − x) = 5 − 2x = 5, so x = 0. This lies in x < 1, so keep it.
- For 1 ≤ x ≤ 4: 3 = 5, which is false. There is no solution here.
- For x > 4: 2x − 5 = 5, so x = 5. Keep it.
The solutions are x = 0 and x = 5. Note what happens when the right side changes. If it were less than 3, the distance between 1 and 4, there would be no solution at all. If it were exactly 3, every x in [1, 4] would be a solution, which gives infinitely many solutions.
Worked example 3: a difference of moduli
Solve |x − 1| − |x + 3| ≥ 2. The critical points are −3 and 1.
- For x < −3: (1 − x) − (−x − 3) = 4, and 4 ≥ 2 is true. Keep all of x < −3.
- For −3 ≤ x < 1: (1 − x) − (x + 3) = −2 − 2x ≥ 2, so x ≤ −2. The kept part is [−3, −2].
- For x ≥ 1: (x − 1) − (x + 3) = −4, and −4 ≥ 2 is false.
The solution is (−∞, −2]. A difference of two moduli with equal coefficients is constant on both outer intervals. Here it equals +4 on the left and −4 on the right. In general, |x − a| − |x − b| always lies between −|a − b| and |a − b|.
def g(x):
return abs(x - 1) - abs(x + 3)
for x in [-10, -3, -2.5, -2, -1.5, 0, 5]:
print(x, g(x) >= 2)
# True for x <= -2, False after; solution is (-inf, -2]Weighted moduli and the slope shortcut
Every sum of terms like c·|x − a| is piecewise linear. Its slope changes only at critical points. That gives a quick way to get a picture of the function.
Take f(x) = |x| + 2|x − 3|.
| Interval | Expression | Slope |
|---|---|---|
| x < 0 | −x + 6 − 2x = 6 − 3x | −3 |
| 0 ≤ x ≤ 3 | x + 6 − 2x = 6 − x | −1 |
| x > 3 | x + 2x − 6 = 3x − 6 | +3 |
Evaluate f at the critical points: f(0) = 6 and f(3) = 3. The slope goes from negative to positive at x = 3, so the minimum value is 3, at x = 3. Because the weight 2 is larger than 1, the minimum sits at the critical point with the larger coefficient. The median-style result for equal weights comes in a later chapter.
To solve f(x) = 5, test each piece:
- 6 − 3x = 5 gives x = 1/3. This is not < 0, so reject it.
- 6 − x = 5 gives x = 1. This lies in [0, 3], so keep it.
- 3x − 6 = 5 gives x = 11/3. This is > 3, so keep it.
The solutions are x = 1 and x = 11/3. The function has minimum 3, and 5 > 3, so two solutions is the expected count.
Nested modulus
Some questions put a modulus inside another, such as ||x − 2| − 3| = 1. Work from the outside in, without listing intervals:
- |x − 2| − 3 = ±1, so |x − 2| = 4 or |x − 2| = 2.
- |x − 2| = 4 gives x = 6 or x = −2. |x − 2| = 2 gives x = 4 or x = 0.
That gives four solutions. Each outer equation has to give a non-negative value for the inner modulus. If one of them came out as |x − 2| = −1, you would throw that branch away.
Common errors
| Error | Example | Fix |
|---|---|---|
| Keeping a solution outside its interval | Accepting x = 1/3 from the x < 0 piece | Always intersect with the interval |
| Missing an interval | Checking only x < −2 and x > 3 | Count: n points give n + 1 intervals |
| Losing a boundary point | Using strict signs on every interval | Put each critical point in exactly one interval and test it directly |
| Sign slip on a negative term | Writing −(x + 3) as −x + 3 | Expand with brackets: −(x + 3) = −x − 3 |
| Ignoring constant pieces | Treating "5 < 9" as no information | A true constant keeps the whole interval |
Exercises
Exercise
Solve |x + 1| + |x − 2| + |x − 5| ≤ 10, and count the integers that satisfy it.
Show answer
The critical points are −1, 2 and 5. For x < −1 the expression is 6 − 3x ≤ 10, so x ≥ −4/3. For −1 ≤ x < 2 it is 8 − x, which is always ≤ 10 here. For 2 ≤ x < 5 it is x + 4, which is always ≤ 10 here. For x ≥ 5 it is 3x − 6 ≤ 10, so x ≤ 16/3. The solution is [−4/3, 16/3]. The integers in it are −1 through 5, which is 7 integers.
Exercise
How many integer values of x satisfy |x − 2| + |x + 4| = 6?
Show answer
The distance between −4 and 2 is exactly 6. So every x in [−4, 2] satisfies the equation, and no x outside that segment does. The integers are −4 through 2, which is 7 values.
Exercise
Solve |x − 1| − |x − 4| = 3.
Show answer
For x < 1 the expression is (1 − x) − (4 − x) = −3, so there is no solution. For 1 ≤ x < 4 it is 2x − 5 = 3, so x = 4, which is not in this interval. For x ≥ 4 it is 3, which always holds. The solution is x ≥ 4, that is [4, ∞).
Exercise
Find the minimum value of |x − 1| + 3|x − 6| and the value of x where it occurs.
Show answer
The slopes are −4 for x < 1, −2 for 1 ≤ x < 6 and +4 for x ≥ 6. The slope first becomes positive at x = 6, so the minimum is at x = 6. The value is |6 − 1| + 0 = 5.