  ## The First Derivative Test (for Local Extrema)

When the graph of a function rises from left to right, we say the function increases. Similarly, when the graph falls from left to right, we say the function decreases. The following definitions make these terms more precise:

Suppose a function $f$ is defined on some interval $I$. Then,

• $f$ is increasing on $I$ if for every pair of values $x_1 \lt x_2$ in $I$, $f(x_1) \lt f(x_2)$.

• $f$ is decreasing on $I$ if for every pair of values $x_1 \lt x_2$ in $I$, $f(x_1) \gt f(x_2)$.

• $f$ is monotonic on $I$ if $f$ is either increasing on $I$ or decreasing on $I$.

Now suppose our function is continuous on $[a,b]$ and differentiable on $(a,b)$. Further, let both $x_1$ and $x_2$ be any two $x$-values in $[a,b]$ with $x_1 \lt x_2$. Note the conditions of the mean value theorem relative to the interval $[x_1,x_2]$ are satisfied, so the mean value theorem applies and concludes there exists some $c$ in $(x_1,x_2)$ where

$$f'(c) = \frac{f(x_2)-f(x_1)}{x_2-x_1}$$

But then, $f'(c)(x_2-x_1) = f(x_2)-f(x_1)$, and upon solving for $f(x_2)$ we have

$$f(x_2) = f(x_1) + f'(c)(x_2-x_1)$$

Of course, as $x_1 \lt x_2$, it must be the case that $(x_2-x_1)$ is positive.

So if $f'(c) \gt 0$, we know $f(x_1) \lt f(x_2)$, whereas if $f'(c) \lt 0$, it must instead be the case that $f(x_1) \gt f(x_2)$.

Applying the definitions of increasing and decreasing above, we can then establish the following important result:

If $f$ is continuous on $[a,b]$ and differentiable on $(a,b)$, then:

• If $f'(x) \gt 0$ for all $x$ in $(a,b)$, then $f$ is increasing on $[a,b]$;
• If $f'(x) \lt 0$ for all $x$ in $(a,b)$, then $f$ is decreasing on $[a,b]$;

An immediate application of the above helps us prove the following important test for finding certain local minimums and maximums of a function:

The First-Derivative Test

Suppose $f$ is a function continuous on $(a,b)$, where $c$ is some point in this interval. Further presume that $f$ is differentiable at all points of $(a,b)$, except possibly at $c$. Then,

1. If $f'(x)$ is positive for all values $x$ in $(a,c)$ and negative for all values $x$ in $(c,b)$,
then $f$ has a local maximum at $c$.

2. If $f'(x)$ is negative for all values $x$ in $(a,c)$ and positive for all values $x$ in $(c,b)$,
then $f$ has a local minimum at $c$.

To see this, consider the following argument to establish part (i):

Let $a_0$ be the midpoint between $a$ and $c$. Then $f$ is continuous on $[a_0,c]$ and differentiable on $(a_0,c)$. If $f'(x)$ is positive for all $x$ in $(a,b)$, then $f'(x) \gt 0$ for all $x$ in $(a_0,c)$. Thus, by the aforementioned result, $f$ is increasing on $[a_0,c]$. So for any $x$ in $(a_0,c)$, we have $f(x) \lt f(c)$.

Similarly, let $b_0$ be the midpoint between $c$ and $b$. Then $f$ is continuous on $[c,b_0]$ and differentiable on $(c,b_0)$. If $f'(x)$ is negative for all $x$ in $(a,b)$, then $f'(x) \lt 0$ for all $x$ in $(c,b_0)$. Thus, by the aforementioned result, $f$ is decreasing on $[c,b_0]$. So for any $x$ in $(c,b_0)$, we have $f(x) \lt f(c)$.

Putting these two conclusions together tells us that for any $x$ in the open interval $(a_0,b_0)$, we have $f(x) \le f(c)$. Thus, $f$ has a local maximum at $c$.

Part (ii) of the First Derivative Test is established in a similar fashion.