Extrema, Concavity, and Optimization

Published on 2026-11-04·v1.0

Learning Objectives

  • Define absolute and local extrema, state the Extreme Value Theorem with its hypotheses, and give examples where dropping a hypothesis destroys the conclusion.
  • Find critical points and explain why a critical point is a candidate, not a verdict.
  • Locate the absolute extrema of a continuous function on a closed interval, including the endpoints.
  • Classify critical points with the first and second derivative tests, and recognize the case where the second derivative test says nothing.
  • Read concavity and inflection points from the sign of f′′f'', and set up and solve an optimization word problem with the correct domain.

Context & Motivation

Training a model, tuning a cache size, choosing a block length for a data structure, and sizing a container are all the same question: which input makes some quantity as small or as large as possible? Single-variable calculus gives a complete method. Differentiate, find where the slope vanishes or fails to exist, and compare. The same pattern generalizes: gradients-extending-derivatives-to-several-variables sets the gradient to zero in many variables, and critical-points-and-the-second-derivative-test handles the classification step with a matrix of second derivatives.

This lesson builds on the-mean-value-theorem-and-monotonicity: the first derivative test is that lesson's sign-of-the-derivative result applied on both sides of a point, and the second derivative test is the same result applied to f′f'. The care this subject demands lies in the details: which points must be examined, which tests apply, and which domain the problem actually lives on.

Core Theory

Extrema and the Extreme Value Theorem

A value f(c)f(c) is an absolute maximum on a set DD if f(c)≥f(x)f(c) \ge f(x) for every x∈Dx \in D, and a local maximum if that inequality holds for all xx in some open interval around cc. Minima are defined with the inequality reversed.

Extreme Value Theorem. If ff is continuous on a closed, bounded interval [a,b][a, b], then ff attains an absolute maximum and an absolute minimum on [a,b][a, b].

Both hypotheses are needed. The function f(x)=xf(x) = x on the open interval (0,1)(0, 1) is continuous but has neither a maximum nor a minimum, since values get arbitrarily close to 11 and 00 without reaching them. On the closed interval [0,1][0, 1] define f(x)=xf(x) = x for x<1x < 1 and f(1)=0f(1) = 0. It is not continuous at 11, the values approach 11 but never reach it, and there is no maximum. The theorem guarantees existence; it does not say where the extremum is.

Critical points

By Fermat's observation from the previous lesson, if ff has a local extremum at an interior point cc and f′(c)f'(c) exists, then f′(c)=0f'(c) = 0. A critical point is an interior point cc of the domain where f′(c)=0f'(c) = 0 or f′(c)f'(c) does not exist. Every interior local extremum is at a critical point. The converse is false: f(x)=x3f(x) = x^3 has f′(0)=0f'(0) = 0 but no extremum.

The closed interval method

For ff continuous on [a,b][a, b]:

  1. Find all critical points in (a,b)(a, b).
  2. Evaluate ff at each critical point and at aa and bb.
  3. The largest value is the absolute maximum and the smallest is the absolute minimum.

The Extreme Value Theorem guarantees the extrema exist, and Fermat guarantees that any not at an endpoint is at a critical point. This is why the endpoints are on the list: an extremum can sit where the derivative is nowhere near zero.

First and second derivative tests

First derivative test. Let cc be a critical point and ff continuous at cc, and suppose f′f' has a constant sign on each side of cc. If f′f' changes from negative to positive at cc, f(c)f(c) is a local minimum. If it changes from positive to negative, a local maximum. If f′f' keeps the same sign on both sides, there is no extremum. This follows from the monotonicity results of the previous lesson on each side of cc, and it works even when f′(c)f'(c) does not exist. If f′f' changes sign infinitely often near cc, the test does not apply (Example 2).

Second derivative test. Suppose f′(c)=0f'(c) = 0 and f′′f'' exists near cc and is continuous at cc. If f′′(c)>0f''(c) > 0, ff has a local minimum at cc; if f′′(c)<0f''(c) < 0, a local maximum. If f′′(c)=0f''(c) = 0, the test is inconclusive: any of the three outcomes can occur, as Example 2 shows. The test also requires f′(c)f'(c) to exist and equal zero, so it cannot classify a corner or a cusp.

Concavity and inflection points

If f′′>0f'' > 0 on an interval, then f′f' is increasing there (previous lesson, applied to f′f'), so the slopes grow from left to right and the graph bends upward: ff is concave up. If f′′<0f'' < 0, ff is concave down. An inflection point is a point where ff is continuous and the concavity changes. At such a point either f′′(c)=0f''(c) = 0 or f′′(c)f''(c) does not exist, but neither condition is sufficient by itself. The sign of f′′f'' must actually change.

Worked Examples

Example 1: absolute extrema on a closed interval

Find the absolute extrema of f(x)=x3−3xf(x) = x^3 - 3x on [−2,3][-2, 3]. The function is a polynomial, so it is continuous and the method applies. Since f′(x)=3x2−3=3(x−1)(x+1)f'(x) = 3x^2 - 3 = 3(x - 1)(x + 1), the critical points are x=±1x = \pm 1, both inside the interval. Evaluating:

text
x = -2 -1 1 3 f(x) = -2 2 -2 18

The absolute maximum is 1818 at the endpoint x=3x = 3, where f′(3)=24≠0f'(3) = 24 \ne 0. The absolute minimum is −2-2, attained at two different points, x=−2x = -2 and x=1x = 1. The value f(−1)=2f(-1) = 2 is a local maximum only. The second derivative f′′(x)=6xf''(x) = 6x confirms it: f′′(−1)=−6<0f''(-1) = -6 < 0 (local maximum) and f′′(1)=6>0f''(1) = 6 > 0 (local minimum). Since f′′f'' changes sign at x=0x = 0, there is an inflection point at (0,0)(0, 0), with ff concave down to its left and concave up to its right.

Example 2: when the tests go silent

Five functions, all with a critical point at x=0x = 0.

  • x4x^4: f′(0)=0f'(0) = 0 and f′′(0)=0f''(0) = 0. Local and absolute minimum.
  • −x4-x^4: f′(0)=0f'(0) = 0 and f′′(0)=0f''(0) = 0. Local and absolute maximum.
  • x3x^3: f′(0)=0f'(0) = 0 and f′′(0)=0f''(0) = 0. No extremum.
  • x2/3x^{2/3}: neither f′(0)f'(0) nor f′′(0)f''(0) exists. Absolute minimum.
  • x2(2+sin⁡1x)x^2\left(2 + \sin\frac1x\right) with f(0)=0f(0) = 0: f′(0)=0f'(0) = 0, and f′′(0)f''(0) does not exist. Strict absolute minimum.

Here x2/3x^{2/3} means (x3)2(\sqrt[3]{x})^2, and x−1/3x^{-1/3} and x−5/3x^{-5/3} below mean 1/x31/\sqrt[3]{x} and 1/(x3)51/(\sqrt[3]{x})^5: the real-root reading, defined for negative xx. In code use numpy.cbrt, since numpy.power(-1.0, 2/3) is nan.

The second derivative test is silent on the first three functions, since f′′(0)=0f''(0) = 0 each time. The first derivative test settles them: for x4x^4, f′=4x3f' = 4x^3 is negative then positive; for −x4-x^4 the reverse; for x3x^3, f′=3x2f' = 3x^2 is positive on both sides. For x2/3x^{2/3}, f′(x)=23x−1/3f'(x) = \frac23 x^{-1/3} is negative for x<0x < 0 and positive for x>0x > 0, so the first derivative test finds a minimum at a cusp, where the second derivative test cannot even be stated.

The fifth function defeats both tests. Since f(x)≥x2>0=f(0)f(x) \ge x^2 > 0 = f(0) for x≠0x \ne 0, the minimum is clear. But f′(0)=lim⁡h→0h(2+sin⁡1h)=0f'(0) = \lim_{h \to 0} h\left(2 + \sin\frac1h\right) = 0, while for x≠0x \ne 0, f′(x)=2x(2+sin⁡1x)−cos⁡1xf'(x) = 2x\left(2 + \sin\frac1x\right) - \cos\frac1x, which equals 4x−1<04x - 1 < 0 at x=12πkx = \frac{1}{2\pi k} and 4x+1>04x + 1 > 0 at x=1(2k+1)πx = \frac{1}{(2k+1)\pi} for every large integer kk. So f′f' changes sign infinitely often near 00 (no sign pattern for the first derivative test), and f′(h)/hf'(h)/h has no limit, so f′′(0)f''(0) does not exist. Only a direct comparison of values settles it.

Concavity has matching traps. For x4x^4, f′′(0)=0f''(0) = 0 but f′′=12x2≥0f'' = 12x^2 \ge 0 on both sides, so there is no inflection point at 00. For f(x)=x3f(x) = \sqrt[3]{x}, f′′(x)=−29x−5/3f''(x) = -\frac29 x^{-5/3} does not exist at 00, and it is positive for x<0x < 0 and negative for x>0x > 0, so there is an inflection point exactly where f′′f'' is undefined.

Example 3: an optimization problem on an open domain

A cylindrical can must hold 1000 cm31000\ \text{cm}^3. What radius minimizes the surface area? With radius rr and height hh, volume gives h=1000πr2h = \frac{1000}{\pi r^2}, and the area of the two ends plus the side is

S(r)=2πr2+2πrh=2πr2+2000r,r>0.S(r) = 2\pi r^2 + 2\pi r h = 2\pi r^2 + \frac{2000}{r}, \qquad r > 0.

Then S′(r)=4πr−2000r2=0S'(r) = 4\pi r - \frac{2000}{r^2} = 0 gives r3=500πr^3 = \frac{500}{\pi}, so r=(500π)1/3≈5.419r = \left(\frac{500}{\pi}\right)^{1/3} \approx 5.419 cm. The domain (0,∞)(0, \infty) has no endpoints to compare, so we need an argument that this critical point is the minimum. Here S′′(r)=4π+4000r3>0S''(r) = 4\pi + \frac{4000}{r^3} > 0 for every r>0r > 0, so S′S' is increasing. With S′(r∗)=0S'(r^*) = 0 at r∗≈5.419r^* \approx 5.419, this means S′<0S' < 0 on all of (0,r∗)(0, r^*) and S′>0S' > 0 on all of (r∗,∞)(r^*, \infty). By the monotonicity results of the previous lesson, SS is decreasing up to r∗r^* and increasing after it, so S(r∗)S(r^*) is the absolute minimum. A numerical check agrees:

text
r = 4.0 S = 600.53 r = 5.0 S = 557.08 r = 5.419 S = 553.58 (minimum) r = 6.0 S = 559.53 r = 7.0 S = 593.59

At the optimum h=1000πr2≈10.839=2rh = \frac{1000}{\pi r^2} \approx 10.839 = 2r: the best can is as tall as it is wide.

Example 4: choosing a block size

Jump search over nn sorted items skips ahead in blocks of bb and then scans inside one block. A simple cost model counts about nb\frac nb jumps plus up to bb steps inside a block: C(b)=nb+bC(b) = \frac nb + b. This is a model of the operation count, not an exact comparison count. Take n=10 000n = 10\,000 and the closed interval 1≤b≤n1 \le b \le n, so the closed interval method applies. C′(b)=−nb2+1=0C'(b) = -\frac{n}{b^2} + 1 = 0 gives b=n=100b = \sqrt n = 100, with C(100)=200C(100) = 200. The endpoints give C(1)=C(10 000)=10 001C(1) = C(10\,000) = 10\,001. The minimum 2n2\sqrt n is why this strategy is O(n)O(\sqrt n). In practice bb must be an integer, so for non-square nn you compare the two integers beside n\sqrt n.

Common Misconceptions & Pitfalls

  • "Critical point means extremum." It means candidate. x3x^3 at 00 is a critical point with no extremum.
  • "f′′(c)=0f''(c) = 0 means an inflection point." x4x^4 refutes it. An inflection point requires f′′f'' to change sign.
  • "The second derivative test always decides." When f′′(c)=0f''(c) = 0 it is silent, and it cannot be applied where f′(c)f'(c) does not exist. Fall back on the first derivative test, and if f′f' has no sign pattern near cc, compare values directly (Example 2).
  • Forgetting the endpoints. In Example 1 the maximum is at x=3x = 3, where the derivative is 2424.
  • Confusing local with absolute. In Example 1, f(−1)=2f(-1) = 2 is a local maximum but far from the largest value.
  • Skipping the domain. A formula for S(r)S(r) is meaningless for r≤0r \le 0, and an optimization on an open or unbounded domain needs an argument, such as the sign of S′S' or the behavior as r→0+r \to 0^+ and r→∞r \to \infty, because the Extreme Value Theorem does not apply.

Summary

An absolute extremum of a continuous function on a closed bounded interval always exists. It occurs at an endpoint or at an interior critical point, where f′=0f' = 0 or f′f' does not exist. A critical point is only a candidate: x3x^3 has one and no extremum. The first derivative test classifies it by the sign change of f′f' and works even at a cusp, as long as f′f' has a constant sign on each side. The second derivative test is quicker when f′′(c)≠0f''(c) \ne 0 and silent when f′′(c)=0f''(c) = 0, as with x4x^4, −x4-x^4, and x3x^3. Concavity follows the sign of f′′f'', and an inflection point needs a sign change, not just f′′=0f'' = 0. Optimization is modeling plus this method: write one variable's formula, fix the domain, find the candidates, compare them, and justify the winner. The next lesson, lhopitals-rule, uses derivatives for a different job, resolving limits that the limit laws cannot.

Documentation Links