Curve sketching: extrema
The extrema of a function are the points where the function takes its greatest or least values.
Extrema of a function
We distinguish two basic types of extremum – the minimum and the maximum. We also distinguish the global maximum or minimum from the local maximum or minimum. The global maximum is the point where the function has the greatest value of all the points in the domain. If this value is attained at only one point, we say that it is a strict maximum. A function can have its highest value at several points, just as, for example, two different employees can both earn the highest salary of £15,000 a month. The definitions of minimum and maximum are given in the article on functions.
A local minimum is defined only on part of the domain of the function, typically on some interval. The definitions of a local maximum and minimum:
- A function f has a local maximum at a point M in its domain if there is some neighbourhood U = (M − ϵ, M + ϵ), where ϵ > 0, such that f(x) ≤ f(M) for all x ∈ U that lie in the domain of f.
- A function f has a local minimum at a point m in its domain if there is some neighbourhood U = (m − ϵ, m + ϵ), where ϵ > 0, such that f(x) ≥ f(m) for all x ∈ U that lie in the domain of f.
An example of a function that has infinitely many extrema is the function f(x) = x · sin x:
And why does the definition say “for all x ∈ U that lie in the domain of f”, that is, why is the domain involved? For example, because the function given by this graph…
…has a minimum at the point m = 1, but the function is not defined anywhere in any left-hand neighbourhood of m = 1, so it would not be true in that left-hand neighbourhood that f(x) ≥ f(m). If we also restrict to the domain, we get only the right-hand neighbourhood.
The basic principle of finding extrema
Now let’s go back to the graph of the function f(x) = x2 + 1 together with three tangents:
We focus mainly on the tangent c. We can see that the tangent touches the graph at the minimum of the function x2 + 1 and is horizontal, that is, parallel to the x-axis. It “makes” an angle of 0 degrees with the positive x-axis. What would happen if we turned the function upside down, so that instead of a minimum it had a maximum? The graph of the function −x2 + 1:
Notice that the tangent c, which passes through the maximum of the function −x2 + 1, is again parallel to the x-axis. This gives us a rule: if we are looking for a minimum or maximum of a function, we look for a tangent that is parallel to the x-axis, that is, one for which the tangent of the angle it makes with the x-axis equals zero. From the previous picture we can see that tan(0°) = 0. In terms of derivatives, we are looking for a point where the derivative is equal to zero: f′(x) = 0.
Let’s work out the extremum of our favourite function f(x) = x2 + 1 using derivatives. The derivative of f is f′(x) = 2x. Next we look for where the first derivative is equal to zero, that is, we solve the equation f′(x) = 0; substituting gives 2x = 0. This is trivially true for x = 0. We can see that this agrees with the fact that the function f(x) = x2 + 1 has a global minimum at x = 0.
Exceptions to the “rule”
It would be tempting to say that a function has an extremum at x exactly when the derivative at that point is equal to zero. Unfortunately that is not true; it is not that simple. Let’s look at the following examples:
-
Let’s try to find the extrema of the function f(x) = x3. The first derivative of this function is f′(x) = 3x2. We solve the equation f′(x) = 0, that is, 3x2 = 0. This is clearly true for x = 0. But does the function x3 have an extremum at x = 0? Let’s look at the graph:
We can see that there is no extremum at x = 0. Neither global nor local. So why is the derivative zero at this point? Simply because at this point the tangent t is parallel to the x-axis, see the following picture:
-
What about the friendly function f(x) = |x|, that is, the absolute value of x? From the graph we can see that it has a global minimum at x = 0:
But this function has no derivative at x = 0! At x = 0 the function has no tangent, because it is hard to say what such a tangent could look like.
So we have:
-
If a function f has an extremum at a point x, that is, a minimum or maximum, and if the derivative exists at that point (!), then this derivative is zero. It can happen that a function has an extremum at a point x and at the same time has no derivative at that point.
-
If a function f has a zero derivative at a point x, there may be an extremum at that point, but there may not.
How to find the extrema of a function
We will assume that the input is a function f that is differentiable on its whole domain. In the first step we differentiate f to get the function f′. Then we set the first derivative equal to zero, that is, we solve the equation f′(x) = 0. The solutions of this equation are the “candidate” points for extrema, called stationary points.
Next we have to decide which of these stationary points are extrema. We can find this out, for example, from the second derivative of f. If s is a stationary point, that is, if f′(s) = 0, then if f′′(s) > 0, there is a minimum at the point s, whereas if f′′(s) < 0, there is a maximum at the point s.
If the second derivative at this point is zero as well, we have to keep differentiating; more on that later. Now an example. Take the function f(x) = 3x2 + 6x. Find its extrema.
We work out the first derivative: f′(x) = 6x + 6. We set the first derivative equal to zero:
So there is a stationary point at x = −1, a possible extremum. We work out the second derivative. It is the function f′′(x) = 0x + 6. Substituting the point x = −1 we get f′′(−1) = 6. The result is positive, so the function has a minimum at that point. The graph:
What if the second derivative is zero as well?
Let’s try to find the extremum of the function f(x) = x4, graph:
The first derivative of this function is f′(x) = 4x3. The solution of the equation f′(x) = 0 is, of course, the single stationary point s = 0. We work out the second derivative, which is f′′(x) = 12x2. We substitute the stationary point s into this second derivative, so we get
We got zero, and from what we have said so far we cannot tell whether there is an extremum at the point or not. But we can see that there is an extremum at the point. If this situation occurs, we keep differentiating. We find the third derivative and substitute the stationary point s. If we get a non-zero number, then s is a so-called point of inflection (more on that later). If we get zero, we keep differentiating. For the fourth derivative we decide in the same way as for the second – we substitute the stationary point, and a positive value means a minimum, a negative value means a maximum.
The third derivative is f′′′(x) = 24x, and after substituting we have f′′′(0) = 0, so we keep differentiating. The fourth derivative is f′′′′(x) = 24. We can see that the fourth derivative is always positive, from which we can conclude – just as for the second derivative – that the function has a minimum at s = 0. And indeed it does.
Summary of how to find the extrema of a function
-
We are given a function f that is differentiable.
-
We differentiate f.
-
We solve the equation f′(x) = 0. All the s that solve the equation we call stationary points, that is, possible extrema.
-
We work out the second derivative.
-
We work out the value of the second derivative at all the stationary points s. If f′′(s) > 0, the function has a minimum at s; if f′′(s) < 0, there is a maximum at s. If f′′(s) = 0, we keep differentiating.
Tip: if you do not want to remember whether the second derivative has to be positive or negative for a maximum or minimum, just work it out from, say, the function x2. You should know the graph of this function, and the first and second derivatives are simple: f′(x) = 2x and f′′(x) = 2. The second derivative is therefore always positive and the function x2 has a minimum at x = 0.
-
We work out the third derivative. If f′′′(s) ≠ 0, then there is a point of inflection at s; otherwise we keep differentiating.
-
We work out the fourth derivative. If f′′′′(s) ≠ 0, there is an extremum at the point. Otherwise we keep differentiating.
-
And so on and so on. If the first non-zero derivative is an odd-order derivative, it is a point of inflection. If the first non-zero derivative is an even-order one, it is an extremum.
Chapters: Curve sketching, Curve sketching: extrema, Curve sketching: increasing and decreasing functions, Curve sketching: convexity and concavity