The first and second derivative tests
The critical points of a function are the only places a peak or a valley can sit, but not every critical point is one. How can we tell, without plotting, whether a critical point is a local maximum, a local minimum or neither?
Where you are 4 in Maxima, minima and critical points
Why this exists
Critical points and local versus absolute extrema proved that a local maximum or minimum can only sit at a critical point, but x^3 has a critical point at 0 and no extremum there. Increasing and decreasing from the derivative found where a function rises and falls. Joining the two gives the first derivative test: a function that rises up to c and falls after it has a peak at c. The second derivative test reaches the same verdict at a level tangent from one number, the sign of f''(c), using Concavity and inflection points. Either test, at the only critical point of an interval, can give the largest or smallest value on the whole interval.
Definition
Day 1: a change of sign
As in Critical points and local versus absolute extrema, a local maximum of f at c requires c to be an interior point of the domain and f(c) \ge f(x) for every x in some open interval containing c; a local minimum reverses the inequality. An endpoint is never a local extremum, though it can be an absolute one.
We say f' changes from positive to negative at c if there is a \delta > 0 with
Nothing is asked of f'(c): it may be 0 or may not exist. “Negative to positive” is defined the same way, and f' does not change sign at c if it is positive on both sides, or negative on both sides.
Day 2: a level tangent
The second derivative test applies to a critical point c with f'(c) = 0 (a stationary point, where the tangent is horizontal) at which f''(c) exists. Recall from Second and higher derivatives that
Intuition
Walk along a graph from left to right. If the path climbs up to c and descends after it, c is higher than everything nearby, whether the top is rounded or sharp (Figure 1). If it descends and then climbs, c is a valley. If it climbs on both sides, c is only a pause.
The second test reads the same story off the bend. At a level tangent, a graph that is concave down curls below the tangent on both sides, so it sits under its flat top. A graph that is concave up sits above its flat bottom.
Results
Day 1: the first derivative test
The first derivative test. Let c be a critical point of f, let f be continuous at c, and let f be differentiable on an open interval around c, except possibly at c.
- If f' changes from positive to negative at c, then f has a local maximum at c.
- If f' changes from negative to positive at c, then f has a local minimum at c.
- If f' does not change sign at c, then f has no local extremum at c.
In each of the first two cases the extremum is strict: f(c) > f(x) (or <) for every x \ne c near c. The sign of f' on each side is read from a sign chart, as in Increasing and decreasing from the derivative.
The only critical point. Let f be continuous on an interval I (open, closed, half-open or unbounded) and differentiable at every interior point of I except possibly c, and let c be the only critical point of f inside I. If f has a local maximum at c, then f(c) is the absolute maximum of f on I. If f has a local minimum at c, then f(c) is the absolute minimum on I.
Day 2: the second derivative test
The second derivative test. Suppose f'(c) = 0 and f''(c) exists.
- If f''(c) < 0, then f has a local maximum at c.
- If f''(c) > 0, then f has a local minimum at c.
- If f''(c) = 0, the test gives no conclusion.
The third case is not a weakness of the proof. Figure 2 shows x^3, x^4 and -x^4, which all have f'(0) = 0 and f''(0) = 0: one has no extremum, one a minimum and one a maximum. When f''(c) = 0, go back to the first derivative test.
Choosing a test. The second test needs one number, f''(c), and suits a function whose second derivative is quick to compute. The first test needs a sign on each side but asks less: it works where f'(c) does not exist, where f''(c) = 0, and where f'' is messy, and the same sign chart also gives the intervals of increase and decrease.
Why it is true
The first derivative test. Suppose f' > 0 on (c - \delta, c) and f' < 0 on (c, c + \delta). Take x in (c - \delta, c). On [x, c], f is continuous (differentiable inside, continuous at c by hypothesis) and differentiable on (x, c), so the mean value theorem (The mean value theorem) gives a t with x < t < c and
since f'(t) > 0 and c - x > 0. So f(x) < f(c). For x in (c, c + \delta) the theorem on [c, x] gives f(x) - f(c) = f'(t)(x - c) < 0, so again f(x) < f(c). Thus f(c) > f(x) for every x \ne c in (c - \delta, c + \delta): a strict local maximum. The minimum case reverses every sign. If f' > 0 on both sides, the same two computations give f(x) < f(c) for x < c and f(x) > f(c) for x > c, so every interval around c holds values above and below f(c), and c is neither; f' < 0 on both sides is the same with the inequalities reversed.
The only critical point. Say f has a local maximum at c. Left of c, the part of I holds no critical point, no point where f' fails to exist, and no domain gap, so f' keeps one sign there, as in Increasing and decreasing from the derivative (by the intermediate value theorem when f' is continuous, and by Darboux’s theorem, stated without proof, in general). If that sign were negative, f would be decreasing on the part of I up to c, so f(x) > f(c) for every x < c in I, which is impossible next to a local maximum. So f' > 0 there and f is increasing up to c: f(x) < f(c) for every x < c in I. In the same way f is decreasing from c onward, and f(x) < f(c) for every x > c in I. The minimum case is the same with signs reversed.
The second derivative test. Since f'(c) = 0,
Suppose f''(c) < 0. A limit that is negative forces the quantity to be negative near c (the fact about limits proved in Critical points and local versus absolute extrema), so there is a \delta > 0 with \dfrac{f'(x)}{x - c} < 0 whenever 0 < \lvert x - c \rvert < \delta. For x in (c - \delta, c) the denominator is negative, so f'(x) > 0; for x in (c, c + \delta) it is positive, so f'(x) < 0. Since f''(c) exists, f' exists near c, so f is differentiable, hence continuous, there. The first derivative test now gives a local maximum. If f''(c) > 0, the signs flip and give a local minimum. If f''(c) = 0, the limit says nothing about the sign of f'(x) near c, and Figure 2 shows that every outcome occurs.
Worked examples
Day 1: Bota’s quintic
Bota wants to classify every critical point of f(x) = x^5 - 5x^4 + 5x^3.
SolutionA polynomial is differentiable everywhere, so the critical points are the zeros of
namely 0, 1 and 3. They split the line into four pieces, and one test value fixes the sign of f' on each:
| Piece | Test | f' | Sign |
|---|---|---|---|
| (-\infty, 0) | -1 | 40 | + |
| (0, 1) | \displaystyle \frac{1}{2} | \displaystyle \frac{25}{16} | + |
| (1, 3) | 2 | -20 | - |
| (3, \infty) | 4 | 240 | + |
At 0 the sign stays + (the square x^2 does not change sign), so f(0) = 0 is not an extremum. At 1 it changes from + to -: a local maximum, f(1) = 1 - 5 + 5 = 1. At 3 it changes from - to +: a local minimum, f(3) = 243 - 405 + 135 = -27.
Day 1: Zhanar’s cusp
Zhanar studies g(x) = x - 3x^{2/3}. Find and classify its critical points.
Solutiong is continuous for every real x. For x \ne 0,
At 0 the derivative does not exist (as x \to 0^-, g'(x) \to \infty, and as x \to 0^+, g'(x) \to -\infty), and 0 is in the domain, so 0 is a critical point. g'(x) = 0 when x^{1/3} = 2, that is, x = 8. Test values: \displaystyle g'(-1) = \frac{-3}{-1} = 3 > 0, g'(1) = -1 < 0 and \displaystyle g'(27) = \frac{1}{3} > 0.
At 0, g' changes from + to - and g is continuous, so g(0) = 0 is a local maximum, at a cusp. At 8 it changes from - to +, so g(8) = 8 - 3 \cdot 4 = -4 is a local minimum (Figure 1). Neither is absolute: g(x) \to -\infty as x \to -\infty and g(x) \to \infty as x \to \infty.
Day 1: Abylai’s jump
Abylai defines
Show that 0 is a critical point at which h' changes from positive to negative, and decide whether h(0) is a local maximum.
Solutionh'(x) = 1 for x < 0 and h'(x) = -1 for x > 0. At 0, \lim_{x \to 0^-} h(x) = 2 but h(0) = 1, so h is not continuous at 0 and h'(0) does not exist. Since 0 is an interior point of the domain, it is a critical point, and h' changes from + to - there.
But h(0) is not a local maximum: for -1 < x < 0, h(x) = x + 2 > 1 = h(0), so every interval around 0 holds larger values. Nor is it a local minimum, since h(x) = 1 - x < 1 for x > 0 (Figure 3).
The first derivative test does not apply, because its hypothesis that h is continuous at 0 fails. With x + 1 on the left instead, h is continuous at 0 and the test does give a local maximum, h(0) = 1.
Day 1: Zhanar’s one critical point
Show that f(x) = \dfrac{\ln x}{x^2} has an absolute maximum on (0, \infty), and find it. Does it have an absolute minimum?
SolutionThe interval is open, so Extrema on a closed interval does not apply. By the quotient rule,
f' exists on all of (0, \infty), and it is 0 only when \displaystyle \ln x = \frac{1}{2}, that is, \displaystyle x = e^{1/2} = \sqrt{e}. Since x^3 > 0, f' has the sign of 1 - 2\ln x: positive for \displaystyle x < \sqrt{e} and negative for \displaystyle x > \sqrt{e}. So f has a local maximum at \displaystyle \sqrt{e}, and since \displaystyle \sqrt{e} is the only critical point in (0, \infty), it is the absolute maximum on that interval:
There is no absolute minimum: as x \to 0^+, \ln x \to -\infty while \dfrac{1}{x^2} \to \infty, so f(x) \to -\infty.
Day 2: Abylai tests two functions
Use the second derivative test to classify the critical points of (a) f(x) = x^3 \ln x on (0, \infty) and (b) k(x) = \dfrac{x}{2} + \sin x on (0, 2\pi).
Solution(a) \displaystyle f'(x) = 3x^2 \ln x + x^3 \cdot \frac{1}{x} = x^2(3\ln x + 1), which is 0 on (0, \infty) only at \displaystyle \ln x = -\frac{1}{3}, so x = e^{-1/3}. Differentiating again, f''(x) = 6x\ln x + 3x + 2x = x(6\ln x + 5), and
so f has a local minimum there, \displaystyle f\big(e^{-1/3}\big) = e^{-1}\left(-\frac{1}{3}\right), which is \displaystyle -\frac{1}{3e}. It is the only critical point on (0, \infty), so this is also the absolute minimum there.
(b) \displaystyle k'(x) = \frac{1}{2} + \cos x = 0 when \displaystyle \cos x = -\frac{1}{2}, at \displaystyle x = \frac{2\pi}{3} and \displaystyle x = \frac{4\pi}{3}. Then k''(x) = -\sin x, so \displaystyle k''\left(\frac{2\pi}{3}\right) = -\frac{\sqrt{3}}{2} < 0 gives a local maximum, \displaystyle k\left(\frac{2\pi}{3}\right) = \frac{\pi}{3} + \frac{\sqrt{3}}{2}, about 1.913; and \displaystyle k''\left(\frac{4\pi}{3}\right) = \frac{\sqrt{3}}{2} > 0 gives a local minimum, \displaystyle k\left(\frac{4\pi}{3}\right) = \frac{2\pi}{3} - \frac{\sqrt{3}}{2}, about 1.228. With two critical points, neither value is absolute: k(x) \to \pi as x \to 2\pi^- and k(x) \to 0 as x \to 0^+.
Day 2: both tests on Bota’s and Zhanar’s functions
Apply the second derivative test to the critical points of Example 1 and Example 2, and compare with the first derivative test.
SolutionExample 1. f'(x) = 5x^4 - 20x^3 + 15x^2, so f''(x) = 20x^3 - 60x^2 + 30x = 10x(2x^2 - 6x + 3).
- f''(1) = 10(2 - 6 + 3) = -10 < 0: local maximum, as before.
- f''(3) = 30(18 - 18 + 3) = 90 > 0: local minimum, as before.
- f''(0) = 0: no conclusion. The first derivative test settled it: f' is positive on both sides, so neither.
Example 2. At 0, g'(0) does not exist, so the second test does not apply at all; only the first test sees the cusp. At 8, g'(8) = 0 and \displaystyle g''(x) = \frac{2}{3}x^{-4/3} gives \displaystyle g''(8) = \frac{2}{3} \cdot \frac{1}{16} = \frac{1}{24} > 0: a local minimum, agreeing with Example 2.
Day 2: an inequality from one critical point
Show that f(x) = \dfrac{1}{x} + \ln x has absolute minimum value 1 on (0, \infty), and deduce that \ln x \ge 1 - \dfrac{1}{x} for every x > 0, with equality only at x = 1.
Solutionf'(x) = -\dfrac{1}{x^2} + \dfrac{1}{x} = \dfrac{x - 1}{x^2}, defined on all of (0, \infty) and 0 only at x = 1. Then
and f''(1) = 1 > 0, so f has a local minimum at 1 by the second derivative test. Since 1 is the only critical point in (0, \infty), f(1) = 1 + 0 = 1 is the absolute minimum there, and the first derivative test shows it is strict: f(x) > 1 for x \ne 1. So \dfrac{1}{x} + \ln x \ge 1, which rearranges to \ln x \ge 1 - \dfrac{1}{x}, with equality only at x = 1.
Boundaries
- The first test needs continuity at c. Example 3 has h' changing from + to - and no extremum. Exercise 7 has no sign change and an extremum.
- It needs f' to keep one sign on each side near c. For \displaystyle f(x) = x^2 \sin\frac{1}{x} with f(0) = 0, f'(0) = 0 but \displaystyle f'(x) = 2x\sin\frac{1}{x} - \cos\frac{1}{x} changes sign infinitely often near 0, and neither test applies (f''(0) does not exist). In fact f takes both signs near 0, so 0 is not an extremum.
- The second test needs f'(c) = 0, not just a critical point. f''(c) > 0 with f'(c) \ne 0 says only that the graph bends up at a point where it is still rising or falling.
- It needs f''(c) to exist, and it is silent when f''(c) = 0 (Figure 2).
- Both tests are local. A local maximum need not be the largest value: x^3 - 3x has a local maximum 2 at -1 and is larger than 2 for every x > 2.
- The only-critical-point argument needs an interval and exactly one critical point in it (it fails for x^3 - 3x, Exercise 11).
- Endpoints are never local extrema under the definition used here, so neither test is applied at an end of the domain; compare values there as in Extrema on a closed interval.
Where this goes next
The signs of f' and f'' together, with the extrema these tests find, assemble the whole graph in Curve sketching and connecting f, f' and f''. The only-critical-point argument is the main tool of Optimization, where the sensible domain is often open and endpoints cannot be compared. An amount built up from a rate peaks where the rate changes from positive to negative, which is the first derivative test again in Graphing an accumulation function.
Exercises
Day 1: the first derivative test
For Exercises 1 to 6, find every critical point and classify each as a local maximum, a local minimum or neither, giving the local extreme values.
- f(x) = 2x^3 - 9x^2 + 12x
- f(x) = 3x^4 - 6x^2 + 1
- f(x) = (x - 1)^3(x + 3)
- f(x) = x^{2/3}(x^2 - 4)
- f(x) = x^2 - 4\lvert x \rvert
- f(x) = \dfrac{x^2 + 5}{x - 2}
- Let p(x) = x^2 + 1 for x < 0 and p(x) = 3 - x for x \ge 0. Show that p' is negative on both sides of 0. Does p have a local extremum at 0? Why does this not contradict the first derivative test?
- Show that f(x) = x - 2\ln x has an absolute minimum on (0, \infty) and find it. Does it have an absolute maximum?
- Find the absolute maximum of \displaystyle f(x) = \sqrt{x}\,e^{-x} on [0, \infty), and its absolute minimum. Is the minimum a local minimum?
Day 1: reasoning
- Suppose f is continuous at c and f'(x) < 0 for every x \ne c in (c - \delta, c + \delta). Prove that f has no local extremum at c.
- Bota says: “f(x) = x^3 - 3x has a local maximum at -1, so f(-1) = 2 is the largest value of f on [-2, 3].” Is she right? Which hypothesis of the only-critical-point result is missing?
- Give a function f that is continuous at 0, has f'(0) not existing, and has no local extremum at 0. Justify with a sign of f'.
Day 2: the second derivative test
For Exercises 13 to 16, use the second derivative test to classify each critical point, giving the local extreme values.
- f(x) = 2x^3 - 3x^2 - 12x + 4
- f(x) = x^4 - 4x^3 - 8x^2
- f(x) = \dfrac{x - 1}{x^2}
- f(x) = e^x(x^2 - 2x - 2)
- For f(x) = 3x^5 - 5x^3, classify every critical point. Where the second derivative test gives no conclusion, use the first.
Day 2: choosing a test, and graphs
- Figure 4 is the graph of f' on [-2.5, 3.5]. (a) At which x does f have a local maximum, a local minimum, or neither? (b) What is the sign of f''(3), read from the figure, and does it agree with (a)? What can the second derivative test say at 0?
- Classify the critical points of f(x) = 2\sin x + \sin 2x on (0, 2\pi), giving the local extreme values.
- Find a and b so that f(x) = ax^3 + bx^2 has a local maximum at the point (2, 8), and confirm the maximum with the second derivative test.
Day 2: reasoning
- Let n \ge 2 be an integer and f(x) = x^n. Show that f'(0) = 0, that f''(0) = 0 when n \ge 3, and that f has a local minimum at 0 when n is even and no extremum when n is odd.
- Zhanar notes that f(x) = x^2 + 4x has f''(1) = 2 > 0 and concludes that f has a local minimum at 1. What is wrong?
- Suppose f''(x) > 0 for every x in an open interval I, and f'(c) = 0 for some c in I. Prove that f(c) is the absolute minimum of f on I.
- Abylai claims that at every local maximum of a twice differentiable function, f''(c) < 0. Give a counterexample. Then prove that f''(c) \le 0 must hold.
Answers
- f'(x) = 6(x - 1)(x - 2), signs +, -, +. Local maximum f(1) = 5, local minimum f(2) = 4.
- f'(x) = 12x(x - 1)(x + 1), signs -, +, -, +. Local minima f(-1) = f(1) = -2, local maximum f(0) = 1.
- f'(x) = 3(x - 1)^2(x + 3) + (x - 1)^3, which factors as 4(x - 1)^2(x + 2). Signs -, +, +: local minimum f(-2) = -27; neither at 1.
- f(x) = x^{8/3} - 4x^{2/3}, so for x \ne 0, f'(x) = \dfrac{8(x^2 - 1)}{3x^{1/3}}; f'(0) does not exist and f is continuous at 0. Signs -, +, -, + split at -1, 0, 1. Local minima f(\pm 1) = -3, local maximum f(0) = 0 at a cusp.
- f'(x) = 2x + 4 for x < 0 and 2x - 4 for x > 0; f'(0) does not exist (one-sided slopes 4 and -4). Critical points -2, 0, 2, signs -, +, -, +. Local minima f(\pm 2) = -4, local maximum f(0) = 0 at a corner.
- f'(x) = \dfrac{(x + 1)(x - 5)}{(x - 2)^2}; 2 is not in the domain. Signs +, -, -, + on (-\infty, -1), (-1, 2), (2, 5), (5, \infty). Local maximum f(-1) = -2, local minimum f(5) = 10: the local maximum is smaller than the local minimum, which the asymptote at 2 allows.
- p'(x) = 2x < 0 for x < 0 and p'(x) = -1 for x > 0. Yes, a local maximum: p(0) = 3, while p(x) < 2 for -1 < x < 0 and p(x) = 3 - x < 3 for x > 0. The test assumes p is continuous at 0, and \lim_{x \to 0^-} p(x) = 1 \ne 3.
- f'(x) = 1 - \dfrac{2}{x} = \dfrac{x - 2}{x}, the only critical point is 2, signs -, +. Absolute minimum f(2) = 2 - 2\ln 2 \approx 0.6137. No absolute maximum: f(x) \to \infty as x \to 0^+.
- For x > 0, \displaystyle f'(x) = e^{-x}\left(\dfrac{1}{2\sqrt{x}} - \sqrt{x}\right), which is \displaystyle \dfrac{e^{-x}(1 - 2x)}{2\sqrt{x}}. The only critical point is \displaystyle \frac{1}{2}, signs +, -, so the absolute maximum on [0, \infty) is \displaystyle f\left(\frac{1}{2}\right) = \dfrac{1}{\sqrt{2e}} \approx 0.4289. Since f(x) \ge 0 and f(0) = 0, the absolute minimum is 0 at x = 0; it is an endpoint, so it is not a local minimum.
- For x in (c - \delta, c), the mean value theorem on [x, c] gives f(c) - f(x) = f'(t)(c - x) < 0, so f(x) > f(c). For x in (c, c + \delta), f(x) - f(c) = f'(t)(x - c) < 0, so f(x) < f(c). Every interval around c holds values above and below f(c).
- No: f(3) = 18 > 2. f'(x) = 3(x - 1)(x + 1) has two critical points, -1 and 1, in [-2, 3], and the result needs exactly one.
- f(x) = x^{1/3}: continuous, \displaystyle f'(x) = \frac{1}{3}x^{-2/3} > 0 for x \ne 0, and f'(0) does not exist (vertical tangent). f' is positive on both sides, so no extremum.
- f'(x) = 6(x - 2)(x + 1), f''(x) = 12x - 6. f''(-1) = -18: local maximum f(-1) = 11. f''(2) = 18: local minimum f(2) = -16.
- f'(x) = 4x(x - 4)(x + 1), f''(x) = 12x^2 - 24x - 16. f''(-1) = 20: local minimum f(-1) = -3. f''(0) = -16: local maximum f(0) = 0. f''(4) = 80: local minimum f(4) = -128.
- f'(x) = \dfrac{2 - x}{x^3}, so the only critical point is 2 (0 is not in the domain). f''(x) = \dfrac{2x - 6}{x^4}, \displaystyle f''(2) = -\frac{1}{8} < 0: local maximum \displaystyle f(2) = \frac{1}{4}.
- f'(x) = e^x(x^2 - 4) and f''(x) = e^x(x^2 + 2x - 4). f''(2) = 4e^2 > 0: local minimum f(2) = -2e^2. f''(-2) = -4e^{-2} < 0: local maximum f(-2) = 6e^{-2}.
- f'(x) = 15x^2(x - 1)(x + 1) and f''(x) = 60x^3 - 30x. f''(1) = 30: local minimum f(1) = -2. f''(-1) = -30: local maximum f(-1) = 2. f''(0) = 0, no conclusion; f' < 0 on both sides of 0 (on (-1, 0) and (0, 1)), so neither.
- (a) Local minimum at -2 (f' from - to +), local maximum at 3 (+ to -), neither at 0 (f' \ge 0 on both sides; the graph only touches the axis). (b) The graph of f' falls through 3, so f''(3) < 0, which agrees with a maximum. At 0 the graph of f' has a level tangent, so f''(0) = 0 and the test gives no conclusion.
- f'(x) = 2\cos x + 2\cos 2x, which factors as 2(2\cos x - 1)(\cos x + 1), zero at \displaystyle \frac{\pi}{3}, \pi, \displaystyle \frac{5\pi}{3}. f''(x) = -2\sin x - 4\sin 2x. \displaystyle f''\left(\frac{\pi}{3}\right) = -3\sqrt{3}: local maximum \displaystyle \frac{3\sqrt{3}}{2}. \displaystyle f''\left(\frac{5\pi}{3}\right) = 3\sqrt{3}: local minimum \displaystyle -\frac{3\sqrt{3}}{2}. f''(\pi) = 0; near \pi, 2\cos x - 1 < 0 and \cos x + 1 > 0, so f' < 0 on both sides: neither.
- a = -2, b = 6. f'(2) = 12a + 4b = 0 and f(2) = 8a + 4b = 8. Then f''(x) = -12x + 12 and f''(2) = -12 < 0.
- f'(x) = nx^{n - 1} and f''(x) = n(n - 1)x^{n - 2}, both 0 at 0 when n \ge 3 (for n = 2, f''(0) = 2 > 0). For n even, n - 1 is odd, so f' goes from - to +: local minimum. For n odd, n - 1 is even, so f' > 0 on both sides: neither.
- The test needs f'(c) = 0, but f'(1) = 6. The only critical point is -2, where f''(-2) = 2 > 0 gives the minimum.
- f''> 0 on I makes f' increasing on I, so f'(x) < f'(c) = 0 for x < c and f'(x) > 0 for x > c in I. So f is decreasing up to c and increasing from c, and f(x) > f(c) for every other x in I.
- f(x) = -x^4 has a local maximum at 0 with f''(0) = 0. Proof: f'(c) = 0 by Fermat’s theorem; if f''(c) > 0, the second derivative test gives a strict local minimum, f(x) > f(c) near c, which contradicts f(c) \ge f(x) near c. So f''(c) \le 0.