# Procedure for finding local and endpoint extrema using the first derivative test

This article describes the procedure for finding local and endpoint extreme values for a function using the first derivative test. We make the following assumptions:

• The domain of the function is a union of finitely many intervals each of which may be open, closed, or half-open half-closed.
• The set of critical points for the function is discrete, i.e., every critical point is an isolated critical point. In other words, given any critical point, there is an open interval containing it that has no other critical point. In particular, this also tells us that the function is differentiable everywhere except at isolated points. Note that it will also follow from this that one-sided limits at all points are either finite or infinite, and it's not possible to have oscillatory one-sided limits for the function.

The first part discusses in detail the case of a continuous function on a single interval. The second part discusses how the idea can be generalized to functions that are discontinuous at isolated points, or whose domain of definition involves multiple endpoints.

## Procedure for continuous function on an interval

Suppose $f$ is a continuous function on an interval (may be open, closed, half-closed, or infinite in one or both directions). Then the procedure is as follows:

1. Compute the formal expression for the derivative $f'$ using the rules for differentiation. In case of piecewise definition by interval, use the differentiation rule for piecewise definition by interval.
2. Based on the above, determine the points where $f'$ is not defined. For piecewise definitions, this may include transition points between pieces. Also, it may include points where the denominator of $f'$ becomes zero. Note that we are specifically concerned about points where $f'$ is not defined but $f$ is.
3. Also, compute the points where $f'$ takes the value zero.
4. Combining (2) and (3) gives all the critical points for $f$.
5. The critical points subdivide the original interval of definition of $f$ into sub-intervals. On each sub-interval, $f'$ must be either positive throughout or negative throughout. Determine the sign of $f'$ on each interval.
6. Now, at each critical point, use the first derivative test to determine whether we have a point of local maximum, point of local minimum, or neither.
7. If the domain of $f$ has a finite left endpoint, right endpoint, or both, use the one-sided version of the first derivative test to determine, for each endpoint, whether it is a one-sided local maximum, one-sided local minimum, or neither.

The last two steps give a list of points of local maximum, points of local minimum, points of endpoint maximum, and points of endpoint minimum. To determine the values, simply evaluate the original function $f$ at each point.

### Determination of sign of derivative on intervals between critical points

The hardest step is usually the determination of the sign of the derivative. Here are some ways:

• If the derivative can be evaluated easily at any point, we can just pick a point in the interval and evaluate the sign of the derivative there.
• If the derivative can be factored with the zeros of the factors corresponding to the critical points, we can perform sign analysis on each of the factors and combine. This is most useful for algebraic functions, particularly polynomials and rational functions.

### Case of functions with periodic derivative and infinitely many critical points

If $\! f'$ is a periodic function, say with period $h$, then its set of critical points is invariant under translation by $h$. This means that if $c$ is a critical point, so is $c + nh$ for any $n \in \mathbb{Z}$.

In this case, it is obviously not feasible to do a sign analysis of $f'$ separately for any pair of adjacent critical points. However, the good news is that we do not need to. It suffices to do the sign analysis of $f'$ over a single period and then extrapolate to the entire domain. This is because the sign of $f'(x)$ is the same as the sign of $f'(x + nh)$ for any $n \in \mathbb{Z}$.

Note that this remark applies even if $f$ itself is not a periodic function. For instance, it applies to the study of functions of the form (linear) + (trigonometric), such as $x \mapsto x - 2 \sin x$.

### Example of a polynomial function

Consider the function:

$f(x) := 3x^5 - 5x^3 + 7, x \in [-2,3]$

1. Formal computation of derivative: The derivative function is $f'(x) = 15x^4 - 15x^2$.
2. Points where $f'$ is not defined: There are no such points, because $f'$ is a polynomial function and is defined everywhere.
3. Points where $f'$ takes the value zero: Factoring, we get $f'(x) = 15x^2(x - 1)(x + 1)$, so its roots are 0,1,-1. All of these are in the interval $[-2,3]$.
4. All the critical points for $f$: Combining the previous two steps, we get that the critical points for $f$ are -1,0,1.
5. We are interested in the sign of $f'$ on the intervals $(-2,-1),(-1,0),(0,1),(1,3)$. To determine these signs, we examine the expression $f'(x) = 15x^2(x - 1)(x + 1)$.
• For $x \in (-2,-1)$, all the factors $x,x-1,x+1$ are negative, so the product is positive ($x$ being multiplied twice). Thus, $f'(x) > 0$ for all $x$ in this interval.
• For $x \in (-1,0)$, the factors $x,x-1$ are negative but the factor $x + 1$ is positive. So, the product is negative. Thus, $f'(x) < 0$ for all $x$ in this interval. Note that there is a sign change here compared to the preceding interval because the sign of $x+1$ got switched but none of the other signs got switched.
• For $x \in (0,1)$, the factors $x,x+1$ are positive whereas the factor $x - 1$ is negative. So, the product is negative. Thus, $f'(x) < 0$ for all $x$ in this interval. Note that there is no sign change here compared to the preceding interval -- although the sign of $x$ does change, it is squared, hence the change does not affect the sign of the overall derivative.
• For $x \in (1,3)$, all the factors $x,x+1,x-1$ are positive. So, the product is positive. Thus, $f'(x) > 0$ for all $x$ in this interval. Note that there is a sign change here compared to the preceding interval because of a change in the sign of $x - 1$.
6. Finally, we can determine the nature of local extreme values:
• The point $x = -1$ is a point of local maximum because $f'(x) > 0$ on its immediate left and $f'(x) < 0$ on its immediate right.
• The point $x = 0$ is neither a point of local minimum nor a point of local maximum. This is because $f'(x) < 0$ both on its immediate left and on its immediate right.
• The point $x = 1$ is a point of local minimum because $f'(x) < 0$ on its immediate left and $f'(x) > 0$ on its immediate right.
7. We can also compute the nature of endpoint extreme values:
• The left endpoint $x = -2$ is a point of endpoint minimum because $f'(x) > 0$ on its immediate right.
• The point $x = 3$ is a point of endpoint maximum because $f'(x) > 0$ on its immediate left.

If we wish, we can also compute the actual function values at the local and endpoint extrema:

• The value at $x = -2$ (endpoint minimum) is $3(-2)^5 - 5(-2)^3 + 7 = -49$.
• The value at $x = -1$ (local maximum) is $3(-1)^5 - 5(-1)^3 + 7 = 9$.
• The value at $x = 1$ (local minimum) is $3(1)^5 - 5(1)^3 + 7 = 5$.
• The value at $x = 3$ (endpoint maximum) is $3(3)^5 - 5(3)^3 + 7 = 601$.

### Example of a function with periodic derivative

Consider the function:

$f(x) := x - 2 \sin x, \qquad x \in [0,6\pi]$

1. Computation of derivative: We have $f'(x) = 1 - 2\cos x$. This is periodic with period $2\pi$. Thus, the pattern of points of local extrema and intervals of increase/decrease repeats after every interval of length $2\pi$.
2. Points where $f'$ is not defined: This problem doesn't arise because $f'$ is defined everywhere in the interior of the domain.
3. Points where $f'$ takes the value zero: We need to solve $2\cos x = 1$. The only solution in $[0,\pi]$ is $\arccos (1/2) = \pi/3$, hence the only solutions in $[0,2\pi]$ are $\pi/3$ and $2\pi - \pi/3$. Translating these by $2\pi$, we see that there are six points in the interval $[0,6\pi]$ where $f'$ is zero: $\pi/3, 2\pi - \pi/3, 2\pi + \pi/3, 4\pi - \pi/3, 4\pi + \pi/3, 6\pi - \pi/3$.
4. Critical points for $f$: Combining (2) and (3), the list is $\pi/3, 2\pi - \pi/3, 2\pi + \pi/3, 4\pi - \pi/3, 4\pi + \pi/3, 6\pi - \pi/3$.
5. We are interested in the sign of $f'$ on two types of intervals: intervals that are $2\pi$-translates of $(\pi/3,2\pi - \pi/3)$ and intervals that are $2\pi$-translates of $(-\pi/3,\pi/3)$ (Note that although $-\pi/3$ is not in the domain of the original function, we can extend the function to it using the same definition to make our sign analysis smoother).
• On intervals that are $2\pi$-translates of $(\pi/3,2\pi - \pi/3)$, we have $2 \cos x < 1$, so $f'(x) > 0$.
• On intervals that are $2\pi$-translates of $(- \pi/3, \pi/3)$, we have $2 \cos x > 1$, so $f'(x) < 0$.
6. Nature of local extreme values:
• The points $\pi/3, 2\pi + \pi/3, 4\pi + \pi/3$ all have $f'(x) < 0$ on the immediate left and $f'(x) > 0$ on the immediate right, so each of these is a point of local minimum for the function $f$.
• The points $2\pi - \pi/3, 4\pi - \pi/3, 6\pi - \pi/3$ all have $f'(x) > 0$ on the immediate left and $f'(x) < 0$ on the immediate right, so each of these is a point of local maximum for the function $f$.
7. Nature of endpoint extreme values:
• The endpoint 0 is a point of endpoint maximum because $f'(x) < 0$ on its immediate right. This is because 0 is in the interval $(-\pi/3,\pi/3)$, which, as noted above, is an interval where the derivative expression is negative.
• The endpoint $6\pi$ is a point of endpoint minimum because $f'(x) < 0$ on its immediate left. This is because $6\pi$ is in the interval $(6\pi - \pi/3,6\pi + \pi/3)$, which, as noted above, is an interval where the derivative expression is negative.

Here are the local and endpoint extreme values:

• Endpoint $x = 0$ (endpoint maximum): $f(0) = 0 - 2\sin 0 = 0$
• Point $x = \pi/3$ (local minimum): $f(\pi/3) = \pi/3 - 2\sin(\pi/3) = \pi/3 - \sqrt{3} \approx -0.68$
• Point $x = 2\pi - \pi/3$ (local maximum): $f(2\pi - \pi/3) = 2\pi - \pi/3 - 2 \sin(2\pi - \pi/3) = 5\pi/3 + \sqrt{3}$
• Point $x = 2\pi + \pi/3$ (local minimum): $f(2\pi + \pi/3) = 7\pi/3 - \sqrt{3}$
• Point $x = 4\pi - \pi/3$ (local maximum): $f(4\pi - \pi/3) = 11\pi/3 + \sqrt{3}$
• Point $x = 4\pi + \pi/3$ (local minimum): $f (4\pi + \pi/3) = 13\pi/3 - \sqrt{3}$
• Point $x = 6\pi - \pi/3$ (local maximum): $f(6\pi - \pi/3) = 17\pi/3 + \sqrt{3}$
• Endpoint $x = 6\pi$ (endpoint minimum): $f(6\pi) = 6\pi$