Sub topic 14
Finding maxima and minima from graphs
This chapter assumes you can sketch linear, quadratic, modulus and greatest-integer graphs, and that you can solve basic quadratic equations and inequalities. It also assumes you know what a piecewise function is. Here you will use those graphs to find the largest or smallest value of a function quickly, often without any calculus.
What a maximum or minimum means
A function f has a maximum at x = c if f(c) ≥ f(x) for every x in the domain. It has a minimum at x = c if f(c) ≤ f(x) for every x in the domain. The maximum or minimum is the value f(c). The place x = c where it occurs is a different thing. CAT questions ask for one or the other, so read the question twice.
Two cautions apply from the start:
- A function may have no maximum or no minimum. The line f(x) = 2x + 1 on all real numbers has neither.
- The domain matters. The same formula can have an extreme value on one domain and none on another.
Strategy: match the shape to the method
| Function shape | Where the extreme sits | Method |
|---|---|---|
| Quadratic ax² + bx + c | Vertex, x = -b/(2a) | Formula or completing the square |
| Sum of modulus terms | At a breakpoint | Evaluate at each breakpoint |
| Piecewise linear | At a breakpoint or an endpoint of the domain | Evaluate at each corner |
| Linear on a closed interval | At an endpoint | Evaluate at both ends |
| Greatest-integer pieces | At the start or end of a step | Check each step |
Quadratics: the vertex
For f(x) = ax² + bx + c, the graph is a parabola with its vertex at x = -b/(2a).
- If a > 0, the parabola opens upward and the vertex is the minimum.
- If a < 0, it opens downward and the vertex is the maximum.
The extreme value is c - b²/(4a). For f(x) = x² - 6x + 5, the vertex is at x = 3 and f(3) = -4.
def f(x):
return x ** 2 - 6 * x + 5
a, b = 1, -6
vertex_x = -b / (2 * a)
print(vertex_x, f(vertex_x))The output is 3.0 -4.0.
Completing the square gives the same answer and is often faster by hand: x² - 6x + 5 = (x - 3)² - 4. A square is never negative, so the smallest value is -4, reached when x = 3.
Restricted domains
If the domain is a closed interval, the vertex may fall outside it. Then the extreme lies at an endpoint. Take f(x) = x² - 6x + 5 on 4 ≤ x ≤ 8. The vertex x = 3 is outside the interval, and f is increasing on it. So the minimum is f(4) = -3 and the maximum is f(8) = 21.
def f(x):
return x ** 2 - 6 * x + 5
print(f(4), f(8))The output is -3 21.
A reliable habit: for a closed interval, compare f at the vertex (if it lies inside) and at both endpoints. The smallest and largest of those values are the minimum and maximum.
Two-variable constraints
A common CAT setup gives a constraint and asks you to optimise an expression. Suppose x + y = 10 and you want the maximum of xy. Substitute y = 10 - x, so xy = 10x - x². This is a downward parabola with vertex at x = 5, and the maximum is 25. The product of two numbers with a fixed sum is greatest when they are equal.
Modulus functions: the V shape
The graph of |x - a| is a V with its corner at x = a, and its minimum value is 0. A sum such as |x - 2| + |x - 5| measures the total distance from x to the points 2 and 5.
- If x lies between 2 and 5, the total distance is always 3.
- If x lies outside, the total distance is larger.
So the minimum is 3, reached for every x in [2, 5]. The graph has a flat bottom between the two breakpoints.
def f(x):
return abs(x - 2) + abs(x - 5)
values = [f(i / 2) for i in range(0, 15)]
print(min(values))The output is 3.0.
The median rule
For f(x) = |x - a₁| + |x - a₂| + ... + |x - aₙ| with the points sorted:
- If n is odd, the minimum occurs at the middle point, x = a₍ₙ₊₁₎/₂.
- If n is even, the minimum occurs at every x between the two middle points.
For |x - 1| + |x - 4| + |x - 9|, the middle point is 4. The minimum is f(4) = 3 + 0 + 5 = 8.
A sum of moduli is a piecewise linear function that bends only at the breakpoints, and its graph is convex. Therefore the minimum is always at a breakpoint (or along a flat stretch between two), and you only need to test those points.
Maximum of a modulus expression
A V shape opens upward, so |x - a| alone has no maximum on all real numbers. A negated modulus, such as 7 - |x - 3|, is an inverted V. It has a maximum of 7 at x = 3. The pattern k - |x - a| peaks at (a, k). The pattern k + |x - a| bottoms at (a, k).
Piecewise linear functions
Consider f(x) = min(x + 2, 8 - x). The first line rises and the second falls. The function follows whichever is lower, so its graph is an inverted V. The peak is where the two lines meet: x + 2 = 8 - x gives x = 3, and f(3) = 5. The maximum of a min of lines is at the crossing. The minimum of a max of lines is also at a crossing.
Greatest-integer functions
The floor function ⌊x⌋ gives the greatest integer not exceeding x. Its graph is a staircase with steps that include the left end and exclude the right end. Note that ⌊-2.3⌋ = -3, not -2.
import math
print(math.floor(2.7), math.floor(-2.3), math.ceil(-2.3))The output is 2 -3 -2.
For an expression like x - ⌊x⌋ (the fractional part), the values run from 0 up toward 1 on every step. The minimum is 0, reached at every integer. There is no maximum, because the value gets arbitrarily close to 1 but never equals it. This is a classic trap: the supremum is 1 but it is not attained.
Combining ideas: a worked example
Find the minimum of f(x) = |x - 1| + |x - 6| + (x - 3)², which mixes both kinds of term.
- The modulus part is 5 for 1 ≤ x ≤ 6 and larger outside.
- The quadratic part is smallest, 0, at x = 3, and 3 lies inside [1, 6].
- Both parts reach their individual minimums at x = 3, so the sum is smallest there: f(3) = 5 + 0 = 5.
When the individual minimums occur at the same x, add them. When they do not, you must compare values, usually at the breakpoints, because the sum is no longer minimised by either part alone.
Common errors
- Reporting x instead of the value. The vertex x = 3 is not the minimum. The minimum is f(3) = -4.
- Ignoring the domain. On a restricted interval, the vertex may not count.
- Using the vertex formula on a modulus graph. A V has a corner, not a smooth vertex. Use breakpoints.
- Claiming a maximum that is only approached. For fractional-part expressions, check whether the endpoint value is actually attained.
- Sign slips with a. The sign of a decides whether the vertex is a minimum or a maximum. Check it first.
Exercises
Exercise
Find the minimum value of f(x) = 2x² - 8x + 11, and the x at which it occurs.
Show answer
Here a = 2 > 0, so the parabola opens upward. The vertex is at x = -(-8)/(2·2) = 2. Then f(2) = 8 - 16 + 11 = 3. The minimum value is 3, at x = 2.
Exercise
Find the minimum of |x - 3| + |x - 7| + |x - 10|, and say where it occurs.
Show answer
There are three points, so the minimum is at the middle one, x = 7. The value is |7 - 3| + 0 + |7 - 10| = 4 + 0 + 3 = 7.
Exercise
Find the maximum of f(x) = -x² + 4x + 1 for 3 ≤ x ≤ 6.
Show answer
The parabola opens downward with its vertex at x = 2, which is outside [3, 6]. On this interval f is decreasing, so the maximum is at the left endpoint: f(3) = -9 + 12 + 1 = 4.
Exercise
Does g(x) = x - ⌊x⌋ have a maximum value? Does it have a minimum value?
Show answer
It has a minimum of 0, reached at every integer. It has no maximum. The values approach 1 on each step but never reach it.