The idea: one function, one interval, a short list

An optimization problem asks for the best size of something: the biggest box, the largest field. The work is always the same. Turn the picture into one function f(x) of one length x. Find the allowed x: a closed interval a ≤ x ≤ b set by the picture. Then the largest value of f on that interval can only be at a point where f′(x) = 0 (a flat tangent) or at an end. That gives a short list of candidates; work out f at each and take the largest.

Five boxes in a row joined by arrows: 1 write f(x) from the picture, 2 find the allowed x a ≤ x ≤ b, 3 solve f′(x) = 0, 4 add the ends a and b, 5 evaluate f at every candidate and pick the largest.
The recipe: the candidates are the points where f′ = 0 inside the interval, plus the two ends.

The box from a 12 × 12 sheet

Cut an x × x square from each corner of a 12 × 12 sheet and fold up the sides. The base is (12 − 2x) × (12 − 2x) and the height is x, so the volume is V(x) = x(12 − 2x)². The cut can be anything from x = 0 (no cut, a flat sheet) to x = 6 (the cuts meet, no base), so 0 ≤ x ≤ 6. The product rule gives V′(x) = (12 − 2x)² − 4x(12 − 2x) = (12 − 2x)(12 − 6x), which is 0 at x = 2 and at x = 6. (Demo: box from a 12 × 12 sheet)

candidatexboxV(x)
left end012 × 12 × 00
V′ = 028 × 8 × 2128 (max)
right end (V′ = 0 too)60 × 0 × 60

Sweep x and watch the sign of V′: positive up to x = 2 (a bigger cut makes a bigger box), negative after it (the base shrinks faster than the height grows). (Demo: sweep the box, watch V′ change sign)

The fence along a river

A farmer has 120 m of fence for a rectangular field by a river; the river side needs no fence. Call the two sides that meet the river x. They use 2x, so the side along the river is 120 − 2x and the area is A(x) = x(120 − 2x) on 0 ≤ x ≤ 60. A′(x) = 120 − 4x = 0 gives x = 30: a 30 m × 60 m field of 1800 m². Both ends give 0, so 1800 m² is the max. The river side ends up twice as long as each other side. (Demo: fence along a river (120 m))

Why the ends must be checked

f′ = 0 finds the flat places, but a max does not have to be flat. Keep the same fence, but now the lot ends 24 m from the river, so 0 ≤ x ≤ 24. A′ = 0 still gives x = 30, and 30 is not allowed. On the whole interval A′(x) = 120 − 4x > 0, so the area only rises, and the max is at the end: x = 24, a 24 m × 72 m field of 1728 m². A′(24) = 24 is not 0 there. (Demo: lot only 24 m deep (max at an end))

Two graphs of A(x) = x(120 − 2x). Left: the interval 0 to 60; the top of the hill at x = 30 has a flat tangent and is marked max ✓. Right: the interval 0 to 24 only; the curve is still rising at the right end, the end point x = 24 is marked max ✓ with a sloped tangent, and x = 30 is outside the shaded interval.
Same function, different interval: inside, the max is at the flat tangent; cut short, it moves to the end.

Max or min?

f′ = 0 also holds at a valley, so the list of candidates is the safe test: on a closed interval, the largest value on the list is the absolute max and the smallest is the absolute min (the extreme value theorem says both exist when f is continuous). For one critical point you can also read the sign of f′ (+ before, − after means a max) or the second derivative: V″(2) = −48 < 0, concave down, a max. Minimum problems work the same way: the least fence for a 1800 m² field by the river has L(x) = 2x + 1800/x, and L′(x) = 2 − 1800/x² = 0 at x = 30 again.

Reading the shape of f from f′ and f″ is on f, f′, f″: Reading Derivative Graphs; critical points where f′ does not exist are on critical and singular points. With two variables and a constraint, the same idea becomes Lagrange multipliers, and when f′ = 0 cannot be solved by hand, Newton's method or gradient descent find the point numerically. The Mean Value Theorem is why f′ > 0 on an interval means f rises there.

What the page leaves out

Only three problems with one variable each are drawn, and every f is a polynomial whose f′ = 0 can be solved by hand. Open intervals (where a max may not exist), points where f′ does not exist, cylinders and cans, distance and cost problems, and problems with two or more variables are only mentioned or not covered.