Practice / Calculus

Maxima and minima: critical points, the closed-interval method and optimization problems

Ten single-variable extremum problems: a cubic classified by the second-derivative test, a flat point that is not an extremum, a minimum the second-derivative test cannot see, the closed-interval method with an endpoint maximum, a cusp where the derivative is undefined, x e^(−x), an open box, the closest point on a curve, a can of least surface area, and the mean as the minimizer of squared error, with worked solutions and the mistakes of forgetting endpoints and cusps and of reading f′ = 0 as a guaranteed extremum.

Before you start

Training a model is minimizing a loss, and in one variable the whole theory fits on a page: an interior minimum or maximum can only sit where the derivative is zero or undefined, and on a closed interval the endpoints are candidates too. The derivative test then sorts the candidates, and comparing values picks the winner. Problem 10 is the one-variable version of least squares: the constant that minimizes squared error is the mean. The work goes wrong in a few places: endpoints left off the list, a zero derivative taken as proof of an extremum, an inconclusive second-derivative test read as "no extremum", a point where the derivative is undefined never checked, and the location of the maximum reported instead of its value. These ten problems cover each of them.

  • A critical point of ff is an interior point where f′(x)=0f'(x) = 0 or f′(x)f'(x) does not exist. Every local maximum or minimum inside the domain is at a critical point, but not every critical point is one.
  • First-derivative test: if f′f' changes from ++ to −- at a critical point, it is a local maximum; from −- to ++, a local minimum; if f′f' keeps the same sign on both sides, it is neither.
  • Second-derivative test: at a point with f′(c)=0f'(c) = 0, f′′(c)<0f''(c) < 0 means a local maximum and f′′(c)>0f''(c) > 0 a local minimum. If f′′(c)=0f''(c) = 0 the test says nothing, and the first-derivative test decides.
  • Closed-interval method: a continuous ff on [a,b][a, b] has a largest and a smallest value. Evaluate ff at every critical point in (a,b)(a, b) and at aa and bb; the largest value is the maximum and the smallest the minimum.
  • Optimization problems: name the quantity to optimize, write it as a function of one variable using the constraint, find that variable's allowed range, and then use the methods above. Answer the question that was asked: a location, a value, or both.
  • x1/3x^{1/3} is the real cube root, defined for negative xx too, so x2/3=(x1/3)2≥0x^{2/3} = (x^{1/3})^2 \ge 0 for every xx.

Builds on: Differentiation rules: chain, product, quotient

Problems

  1. ·

    Find the local maxima and minima of f(x)=x3−6x2+9x+1f(x) = x^3 - 6x^2 + 9x + 1 and classify them with the second-derivative test.

  2. ··

    Find and classify the critical points of f(x)=x4−4x3f(x) = x^4 - 4x^3.

  3. ··

    Find the minimum of f(x)=x4−4x3+6x2−4xf(x) = x^4 - 4x^3 + 6x^2 - 4x.

  4. ·

    Find the maximum and minimum values of f(x)=x3−3xf(x) = x^3 - 3x on [−2,3][-2, 3].

  5. ···

    Find the maximum and minimum values of f(x)=x2/3(5−x)f(x) = x^{2/3}(5 - x) on [−1,4][-1, 4].

  6. ··

    Find the maximum value of f(x)=xe−xf(x) = xe^{-x} for x≥0x \ge 0.

  7. ··

    An open-top box is made from a 1212 cm by 1212 cm sheet by cutting an xx by xx square from each corner and folding up the sides. Which xx gives the largest volume, and what is that volume?

  8. ···

    Find the point on the curve y=xy = \sqrt x closest to (4,0)(4, 0), and the distance.

  9. ··

    A closed cylindrical can must hold 16π16\pi cm³. Which radius and height use the least metal (the least total surface area), and what is that area?

  10. ··

    A model predicts the same number mm for the four targets 11, 22, 66 and 77. Which mm minimizes the squared error E(m)=∑i(m−ai)2E(m) = \sum_i (m - a_i)^2, and what is the minimum error?

Worked solutions

Problem 1

Find the local maxima and minima of f(x)=x3−6x2+9x+1f(x) = x^3 - 6x^2 + 9x + 1 and classify them with the second-derivative test.

  1. f′(x)=3x2−12x+9=3(x−1)(x−3)f'(x) = 3x^2 - 12x + 9 = 3(x - 1)(x - 3)Differentiate and factor out the 3.
  2. Critical points x=1x = 1 and x=3x = 3f′f' is a polynomial, defined everywhere, so the only critical points are its zeros.
  3. f′′(x)=6x−12f''(x) = 6x - 12, so f′′(1)=−6f''(1) = -6 and f′′(3)=6f''(3) = 6Second-derivative test.
  4. f(1)=1−6+9+1=5f(1) = 1 - 6 + 9 + 1 = 5 and f(3)=27−54+27+1=1f(3) = 27 - 54 + 27 + 1 = 1The values at the critical points.
  5. Local maximum 55 at x=1x = 1; local minimum 11 at x=3x = 3f′′(1)<0f''(1) < 0 curves down and f′′(3)>0f''(3) > 0 curves up. Neither is a global extremum: a cubic goes to ±∞\pm\infty.

Problem 2

Find and classify the critical points of f(x)=x4−4x3f(x) = x^4 - 4x^3.

  1. f′(x)=4x3−12x2=4x2(x−3)f'(x) = 4x^3 - 12x^2 = 4x^2(x - 3)Factor out 4x24x^2.
  2. Critical points x=0x = 0 and x=3x = 3The zeros of f′f'.
  3. f′′(x)=12x2−24xf''(x) = 12x^2 - 24x, so f′′(3)=108−72=36>0f''(3) = 108 - 72 = 36 > 0x=3x = 3 is a local minimum, with f(3)=81−108=−27f(3) = 81 - 108 = -27.
  4. f′′(0)=0f''(0) = 0The second-derivative test is inconclusive at 00; use the first-derivative test.
  5. f′(−1)=4⋅1⋅(−4)=−16<0f'(-1) = 4\cdot1\cdot(-4) = -16 < 0 and f′(1)=4⋅1⋅(−2)=−8<0f'(1) = 4\cdot1\cdot(-2) = -8 < 0The factor 4x24x^2 is never negative, so the sign of f′f' near 00 is the sign of x−3x - 3, negative on both sides.
  6. x=3x = 3 is a local (and global) minimum, f(3)=−27f(3) = -27; x=0x = 0 is neither a maximum nor a minimumff is decreasing straight through x=0x = 0: it has a flat tangent there, not a turn. The minimum at 33 is global because f→+∞f \to +\infty in both directions and 33 is the only turning point.

Problem 3

Find the minimum of f(x)=x4−4x3+6x2−4xf(x) = x^4 - 4x^3 + 6x^2 - 4x.

  1. f′(x)=4x3−12x2+12x−4=4(x−1)3f'(x) = 4x^3 - 12x^2 + 12x - 4 = 4(x - 1)^3The coefficients 1,−3,3,−11, -3, 3, -1 are those of (x−1)3(x - 1)^3.
  2. Critical point x=1x = 1 only(x−1)3=0(x - 1)^3 = 0 only at x=1x = 1.
  3. f′′(x)=12(x−1)2f''(x) = 12(x - 1)^2, so f′′(1)=0f''(1) = 0Inconclusive: this does not mean there is no extremum.
  4. f′(x)<0f'(x) < 0 for x<1x < 1 and f′(x)>0f'(x) > 0 for x>1x > 1A cube has the sign of its base. f′f' changes from −- to ++, so x=1x = 1 is a local minimum by the first-derivative test.
  5. f(1)=1−4+6−4=−1f(1) = 1 - 4 + 6 - 4 = -1In fact f(x)=(x−1)4−1f(x) = (x - 1)^4 - 1, which shows the same thing directly.
  6. Minimum −1-1 at x=1x = 1It is global: ff decreases on (−∞,1)(-\infty, 1) and increases on (1,∞)(1, \infty).

Problem 4

Find the maximum and minimum values of f(x)=x3−3xf(x) = x^3 - 3x on [−2,3][-2, 3].

  1. f′(x)=3x2−3=3(x−1)(x+1)f'(x) = 3x^2 - 3 = 3(x - 1)(x + 1)Critical points x=−1x = -1 and x=1x = 1, both inside (−2,3)(-2, 3).
  2. f(−1)=−1+3=2f(-1) = -1 + 3 = 2 and f(1)=1−3=−2f(1) = 1 - 3 = -2Values at the critical points.
  3. f(−2)=−8+6=−2f(-2) = -8 + 6 = -2 and f(3)=27−9=18f(3) = 27 - 9 = 18Values at the endpoints.
  4. Maximum 1818 at x=3x = 3; minimum −2-2, reached at both x=−2x = -2 and x=1x = 1Compare all four values. The maximum is at an endpoint, where f′(3)=24≠0f'(3) = 24 \ne 0: a derivative test alone would never find it.

Problem 5

Find the maximum and minimum values of f(x)=x2/3(5−x)f(x) = x^{2/3}(5 - x) on [−1,4][-1, 4].

  1. f(x)=5x2/3−x5/3f(x) = 5x^{2/3} - x^{5/3}Multiply out so that each term is a power.
  2. f′(x)=103x−1/3−53x2/3=53x−1/3(2−x)=5(2−x)3x1/3f'(x) = \tfrac{10}{3}x^{-1/3} - \tfrac53x^{2/3} = \tfrac53x^{-1/3}(2 - x) = \dfrac{5(2 - x)}{3x^{1/3}}Factor out 53x−1/3\tfrac53x^{-1/3}; then x2/3=x−1/3⋅xx^{2/3} = x^{-1/3}\cdot x.
  3. f′(2)=0f'(2) = 0, and f′(0)f'(0) is undefinedx=0x = 0 makes the denominator 00; ff itself is continuous there, with a cusp. Both are critical points.
  4. f(0)=0f(0) = 0 and f(2)=22/3⋅3≈4.762f(2) = 2^{2/3}\cdot3 \approx 4.762Values at the critical points.
  5. f(−1)=(−1)2/3⋅6=6f(-1) = (-1)^{2/3}\cdot6 = 6 and f(4)=42/3⋅1≈2.520f(4) = 4^{2/3}\cdot1 \approx 2.520Values at the endpoints; (−1)2/3=((−1)1/3)2=1(-1)^{2/3} = \big((-1)^{1/3}\big)^2 = 1.
  6. Maximum 66 at x=−1x = -1; minimum 00 at x=0x = 0The minimum is at the cusp, where f′f' does not exist, and the maximum is at an endpoint. The only point with f′=0f' = 0, x=2x = 2, is a local maximum but not the global one.

Problem 6

Find the maximum value of f(x)=xe−xf(x) = xe^{-x} for x≥0x \ge 0.

  1. f′(x)=e−x−xe−x=(1−x)e−xf'(x) = e^{-x} - xe^{-x} = (1 - x)e^{-x}Product rule; (e−x)′=−e−x(e^{-x})' = -e^{-x}.
  2. Critical point x=1x = 1e−x>0e^{-x} > 0, so f′=0f' = 0 only where 1−x=01 - x = 0.
  3. f′>0f' > 0 on [0,1)[0, 1) and f′<0f' < 0 on (1,∞)(1, \infty)ff rises and then falls, so x=1x = 1 is the global maximum on [0,∞)[0, \infty).
  4. f(1)=e−1f(1) = e^{-1}Evaluate ff at the maximizer.
  5. Maximum value 1e≈0.368\tfrac1e \approx 0.368, at x=1x = 1f(0)=0f(0) = 0 and f→0f \to 0 as x→∞x \to \infty: the exponential beats the linear factor.

Problem 7

An open-top box is made from a 1212 cm by 1212 cm sheet by cutting an xx by xx square from each corner and folding up the sides. Which xx gives the largest volume, and what is that volume?

  1. V(x)=x(12−2x)2V(x) = x(12 - 2x)^2The base is 12−2x12 - 2x on each side and the height is xx.
  2. 0≤x≤60 \le x \le 6The cut cannot be negative or use more than half the side; V(0)=V(6)=0V(0) = V(6) = 0.
  3. V′(x)=(12−2x)2−4x(12−2x)=(12−2x)(12−6x)V'(x) = (12 - 2x)^2 - 4x(12 - 2x) = (12 - 2x)(12 - 6x)Product rule, with ddx(12−2x)2=−4(12−2x)\tfrac{d}{dx}(12 - 2x)^2 = -4(12 - 2x); factor out 12−2x12 - 2x.
  4. Critical point x=2x = 2 inside (0,6)(0, 6)x=6x = 6, the other zero, is an endpoint.
  5. V(2)=2⋅82=128V(2) = 2\cdot8^2 = 128Larger than the endpoint values 00.
  6. x=2x = 2 cm, volume 128128 cm³The box is 88 by 88 by 22.

Problem 8

Find the point on the curve y=xy = \sqrt x closest to (4,0)(4, 0), and the distance.

  1. D(x)=(x−4)2+(x)2=(x−4)2+xD(x) = (x - 4)^2 + (\sqrt x)^2 = (x - 4)^2 + x, for x≥0x \ge 0The squared distance from (x,x)(x, \sqrt x) to (4,0)(4, 0). The square root is increasing, so the distance and its square have the same minimizer, and the square has no root to differentiate.
  2. D′(x)=2(x−4)+1=2x−7D'(x) = 2(x - 4) + 1 = 2x - 7Differentiate.
  3. Critical point x=72x = \tfrac72; D′′=2>0D'' = 2 > 0A minimum, and global since DD is a parabola opening up. The endpoint gives D(0)=16D(0) = 16, larger.
  4. D(72)=14+72=154D(\tfrac72) = \tfrac14 + \tfrac72 = \tfrac{15}4(72−4)2=14(\tfrac72 - 4)^2 = \tfrac14.
  5. The point (72,72)≈(3.5,1.871)\big(\tfrac72, \sqrt{\tfrac72}\big) \approx (3.5, 1.871), at distance 152≈1.936\tfrac{\sqrt{15}}{2} \approx 1.936Take the square root only at the end.

Problem 9

A closed cylindrical can must hold 16π16\pi cm³. Which radius and height use the least metal (the least total surface area), and what is that area?

  1. πr2h=16π\pi r^2h = 16\pi, so h=16r2h = \dfrac{16}{r^2}The volume constraint, solved for the height.
  2. S(r)=2πr2+2πrh=2πr2+32πrS(r) = 2\pi r^2 + 2\pi rh = 2\pi r^2 + \dfrac{32\pi}{r}, for r>0r > 0Two ends plus the side; substitute hh so that SS depends on rr alone.
  3. S′(r)=4πr−32πr2=0S'(r) = 4\pi r - \dfrac{32\pi}{r^2} = 0, so r3=8r^3 = 8Multiply by r2r^2 and divide by 4π4\pi.
  4. r=2r = 2, and S′′(r)=4π+64πr3>0S''(r) = 4\pi + \dfrac{64\pi}{r^3} > 0A minimum, and the only critical point; S→∞S \to \infty as r→0r \to 0 and as r→∞r \to \infty, so it is global.
  5. h=164=4h = \tfrac{16}{4} = 4 and S=8π+16π=24πS = 8\pi + 16\pi = 24\piThe height equals the diameter.
  6. r=2r = 2 cm, h=4h = 4 cm, area 24π≈75.4024\pi \approx 75.40 cm²For any volume the optimal can has h=2rh = 2r.

Problem 10

A model predicts the same number mm for the four targets 11, 22, 66 and 77. Which mm minimizes the squared error E(m)=∑i(m−ai)2E(m) = \sum_i (m - a_i)^2, and what is the minimum error?

  1. E′(m)=∑i2(m−ai)=2(4m−16)E'(m) = \sum_i 2(m - a_i) = 2(4m - 16)Chain rule on each term; ∑iai=16\sum_i a_i = 16.
  2. m=4m = 4E′(m)=0E'(m) = 0 gives m=164m = \tfrac{16}{4}, the mean of the targets.
  3. E′′(m)=2⋅4=8>0E''(m) = 2\cdot4 = 8 > 0A minimum, and global: EE is a parabola opening up. In general E′′=2nE'' = 2n.
  4. E(4)=9+4+4+9=26E(4) = 9 + 4 + 4 + 9 = 26The squared deviations from the mean.
  5. m=4m = 4, the mean; minimum squared error 2626The same calculation for any data shows the constant that minimizes squared error is the mean, which is why a regression's intercept fits the mean of the targets.

Where this goes wrong

1. Forgetting the endpoints

Setting the derivative to zero is the step that gets practiced, so it becomes the whole method.

  1. f(x)=x3−3xf(x) = x^3 - 3x on [−2,3][-2, 3], critical points x=±1x = \pm1Right so far: Problem 4, step 1.
  2. “f(−1)=2f(-1) = 2 and f(1)=−2f(1) = -2, so compare those.”The habit that causes the mistake: only the critical points are evaluated.
  3. The maximum is 22, at x=−1x = -1That is only a local maximum. At the endpoint x=3x = 3, f(3)=18f(3) = 18. On a closed interval the endpoints are always candidates, and here the maximum is at one, where f′(3)=24f'(3) = 24, nowhere near 00.

2. Calling every flat point a maximum or minimum

f′(x)=0f'(x) = 0 is the condition every extremum satisfies, and it is easy to read it the other way round.

  1. f(x)=x4−4x3f(x) = x^4 - 4x^3, f′(x)=4x2(x−3)f'(x) = 4x^2(x - 3), critical points 00 and 33Right so far: Problem 2, step 2.
  2. “f′(0)=0f'(0) = 0, so x=0x = 0 is an extremum.”The habit that causes the mistake: a zero derivative taken as enough.
  3. x=0x = 0 is a local maximum, with value f(0)=0f(0) = 0ff is decreasing on both sides of 00: f(−1)=5f(-1) = 5 and f(1)=−3f(1) = -3, and f′f' is negative at −1-1 and at 11. The tangent is flat at 00 but the graph does not turn, like x3x^3 at 00. A critical point is a candidate; the first-derivative test decides.

3. Reading an inconclusive test as “no extremum”

The second-derivative test usually gives an answer, so a zero feels like one.

  1. f(x)=x4−4x3+6x2−4xf(x) = x^4 - 4x^3 + 6x^2 - 4x, f′(x)=4(x−1)3f'(x) = 4(x - 1)^3, critical point x=1x = 1Right so far: Problem 3, step 2.
  2. “f′′(1)=0f''(1) = 0, so x=1x = 1 is not a maximum or a minimum.”The habit that causes the mistake: f′′(c)=0f''(c) = 0 treated as a third verdict, "neither".
  3. ff has no minimumf′′(1)=0f''(1) = 0 says nothing either way. The first-derivative test does: f′(0.9)=−0.004f'(0.9) = -0.004 and f′(1.1)=0.004f'(1.1) = 0.004, so f′f' changes from −- to ++ and x=1x = 1 is a minimum, with f(1)=−1f(1) = -1. The same happens for x4x^4 at 00.

4. Missing a critical point where f′ is undefined

Critical points are usually found by solving f′(x)=0f'(x) = 0, and a point where f′f' blows up is not a solution of anything.

  1. f(x)=x2/3(5−x)f(x) = x^{2/3}(5 - x) on [−1,4][-1, 4], f′(x)=5(2−x)3x1/3f'(x) = \dfrac{5(2 - x)}{3x^{1/3}}Right so far: Problem 5, step 2.
  2. “f′(x)=0f'(x) = 0 only at x=2x = 2, so the candidates are −1-1, 22 and 44.”The habit that causes the mistake: only the zeros of the numerator are listed.
  3. The minimum is f(4)=42/3≈2.520f(4) = 4^{2/3} \approx 2.520f′(0)f'(0) is undefined, so x=0x = 0 is a critical point too, and f(0)=0f(0) = 0 is smaller. The graph has a cusp there: it falls into 00 from the left and rises out of it to the right. List the points where f′f' does not exist along with those where it is 00.

5. Answering with the location instead of the value

The derivative is solved for xx, and the xx that comes out feels like the answer.

  1. f(x)=xe−xf(x) = xe^{-x}, f′(x)=(1−x)e−xf'(x) = (1 - x)e^{-x}, maximum at x=1x = 1Right so far: Problem 6, step 3.
  2. “The question asks for the maximum, and x=1x = 1 is where it is.”The habit that causes the mistake: stopping once the critical point is found.
  3. The maximum value is 1111 is the maximizer, where the maximum happens. The maximum value is f(1)=1e≈0.368f(1) = \tfrac1e \approx 0.368; ff never reaches 11, since xe−x<1xe^{-x} < 1 for every xx. Read the question again before writing the final line: Problem 7 asks for both, Problem 10 for both, this one for the value.

Print this set: maxima-and-minima.pdf (problems, answers, and worked solutions on separate pages).

Read the guide: Maxima and minima: critical points, endpoints, and the second-derivative test