Sub topic 15
Counting Solutions by Intersecting Graphs
This chapter assumes you can sketch linear, quadratic, modulus, floor and exponential/logarithmic graphs. It also assumes you know how shifts and reflections change a graph, and that you can find the vertex of a parabola. Here you use those sketches to answer "how many real solutions?" without solving the equation.
The core idea
A solution of f(x) = g(x) is an x-value where the two outputs agree. On a graph, that is a point where y = f(x) and y = g(x) meet. The number of real solutions therefore equals the number of intersection points, counted as distinct x-values.
This is useful when:
- the question asks only for a count, not the roots;
- the equation mixes types (exponential with polynomial, modulus with quadratic, floor with linear), so algebra is awkward;
- a parameter k appears and the question asks how the count changes with k.
A workflow that works under time pressure
The split in step B matters most. Move terms so that one side is a graph you know well and the other is a line, a horizontal line y = k, or a constant. For a parameter k, isolate k so that the equation reads (expression in x) = k. Then count where the horizontal line y = k cuts the graph of the expression.
Example 1: a horizontal line sweeping a modulus graph
Find the number of solutions of |x² − 4x + 3| = k for each k.
- Start with y = x² − 4x + 3 = (x − 1)(x − 3). Its roots are 1 and 3. Its vertex is at x = 2, where y = −1.
- Taking the modulus reflects the part below the x-axis upward. The dip of depth 1 becomes a peak of height 1 at x = 2, between two arms that rise forever.
- The graph looks like a "W" whose two lower points touch the axis at x = 1 and x = 3. The middle peak has height 1.
- Slide the line y = k upward from below the axis.
| Value of k | Intersections | Reason |
|---|---|---|
| k < 0 | 0 | A modulus is never negative |
| k = 0 | 2 | Line touches at x = 1 and x = 3 |
| 0 < k < 1 | 4 | Line cuts both arms and both sides of the peak |
| k = 1 | 3 | Line passes through the peak top at x = 2 and cuts both arms |
| k > 1 | 2 | Line is above the peak and cuts only the outer arms |
The special values k = 0 and k = 1 are where CAT usually sets its traps. Check them by algebra: for k = 1, x² − 4x + 3 = 1 gives x = 2 ± √2, and x² − 4x + 3 = −1 gives x = 2 (a double root). That is 3 distinct solutions.
You can confirm the table by solving the two quadratics x² − 4x + (3 − k) = 0 and x² − 4x + (3 + k) = 0 and counting distinct roots.
def roots(c):
"""Real roots of x^2 - 4x + c = 0 as a set."""
d = 16 - 4 * c
if d < 0:
return set()
r = d ** 0.5
return {(4 - r) / 2, (4 + r) / 2}
def count(k):
if k < 0:
return 0
return len(roots(3 - k) | roots(3 + k))
for k in [-1, 0, 0.5, 1, 2]:
print(k, count(k))The output is 0, 2, 4, 3, 2 for those values of k, matching the table. The set union removes repeated roots, which is exactly the "distinct x-values" rule.
Example 2: exponential against a polynomial
How many real solutions does 2^x = x² have?
Plot y = 2^x, which is always positive and passes through (0, 1), and y = x², a parabola through the origin.
- At x = −1, the parabola is higher (1 against 0.5). At x = 0, the exponential is higher (1 against 0). The graphs must cross between −1 and 0. This is one solution, near x ≈ −0.77.
- They meet at x = 2 (4 = 4).
- At x = 3, the parabola is higher again (9 against 8). So the graphs cross back.
- They meet at x = 4 (16 = 16). After that, 2^x grows faster and stays above.
That gives 3 solutions. The picture matters because the exponential overtakes the parabola, falls behind, then overtakes it for good. A check that looked only at x = 2 and x = 4 would miss the negative root.
A numerical check counts sign changes of h(x) = 2^x − x² on a fine grid. The grid step is chosen so no grid point lands exactly on a root.
def h(x):
return 2 ** x - x ** 2
step = 0.0013
xs = [-5 + i * step for i in range(int(15 / step))]
changes = sum(1 for a, b in zip(xs, xs[1:]) if h(a) * h(b) < 0)
print(changes)This prints 3.
Example 3: a line against a step graph
How many solutions does ⌊x⌋ = x/2 have?
The graph of y = ⌊x⌋ is a staircase with flat segments of height n on [n, n + 1). The line y = x/2 meets the segment at height n only when x = 2n lies in [n, n + 1).
- That requires n ≤ 2n < n + 1, so n ≥ 0 and n < 1.
- Only n = 0 fits, giving x = 0.
There is one solution. Compare this with ⌊x⌋ = x − 1/2, whose line is parallel to the staircase's overall slope but never touches a step at its left endpoint. It has no solution. Lines with slope 1 are the delicate case for floor graphs. Lines with a smaller slope cross steps in a limited range, and lines with a larger slope cross a few.
Edge cases to check every time
- Domain restrictions. Graphs of log x and √x exist only for part of the axis, and 1/x has a break at 0. An intersection must lie in the domain of both sides.
- Asymptotes. A curve such as y = 2^x approaches y = 0 but never reaches it. The equation 2^x = k has no solution for k ≤ 0 and exactly one for k > 0.
- Tangency. A touch counts as one solution at that x. It is the boundary between two counts, so exam questions that ask "exactly n solutions" often mean the tangent case.
- Counting x, not points. Two intersection points with the same x-value are impossible for a function graph, but with parameters you may list the same root twice. Count distinct x-values.
- Infinitely many solutions. If a graph has a flat segment lying on the line, as in |x − 1| + |x − 5| = 4 for 1 ≤ x ≤ 5, the count is infinite.
- Integer or restricted solutions. If the question asks for integer solutions or solutions in an interval, read the intersections off the graph and then filter them.
Choosing a split
Different splits of the same equation give different pictures. For ln x = x − 2, the graph of ln x against the line y = x − 2 shows the line above the curve near x = 0.1 and below it at x = 1, so there is a crossing in (0.1, 1). At x = 4 the line is above again, so there is a second crossing beyond 1. That gives two solutions. If you instead moved everything to one side and tried to sketch ln x − x + 2, you would need calculus to see the shape. Keep the split where both sides are standard graphs from earlier chapters.
Exercise
For each k, find the number of real solutions of |x − 1| + |x − 5| = k: (a) k = 3, (b) k = 4, (c) k = 10.
Show answer
The left side is the sum of distances from x to 1 and to 5. Its minimum is 4, reached on the whole segment 1 ≤ x ≤ 5, and it grows with slope ±2 outside it. (a) k = 3 is below the minimum, so there are 0 solutions. (b) k = 4 meets the flat bottom, so there are infinitely many solutions (every x in [1, 5]). (c) k = 10 cuts the two arms once each, at x = −2 and x = 8, so there are 2 solutions.
Exercise
For what value of a does |x² − 4| = a have exactly 3 real solutions?
Show answer
The graph of y = |x² − 4| has roots at x = ±2, and the dip below the axis (vertex at (0, −4)) is reflected up to a peak of height 4 at x = 0. A horizontal line cuts it three times only when it passes through that peak, so a = 4. Check: x² − 4 = 4 gives x = ±2√2, and x² − 4 = −4 gives x = 0.
Exercise
How many real solutions does ln x = x − 2 have? Justify with signs of ln x − (x − 2) at x = 0.1, 1 and 4.
Show answer
Two. At x = 0.1, ln x ≈ −2.30 and x − 2 = −1.9, so the line is above the curve. At x = 1, ln x = 0 and x − 2 = −1, so the curve is above the line. At x = 4, ln x ≈ 1.39 and x − 2 = 2, so the line is above again. The difference changes sign twice, once in (0.1, 1) and once in (1, 4). The curve is concave and the line is straight, so there are no further crossings.