# 5.1: Maxima and Minima

A **local maximum point** on a function is a point \((x,y)\) on the graph of the function whose \(y\) coordinate is larger than all other \(y\) coordinates on the graph at points "close to'' \((x,y)\). More precisely, \((x,f(x))\) is a local maximum if there is an interval \((a,b)\) with \(a < x < b\) and \(f(x)\ge f(z)\) for every \(z\) in \((a,b)\). Similarly, \((x,y)\) is a **local minimum point** if it has locally the smallest \(y\) coordinate. Again being more precise: \((x,f(x))\) is a local minimum if there is an interval \((a,b)\) with \(a < x < b\) and \(f(x)\le f(z)\) for every \(z\) in \((a,b)\). A **local extremum** is either a local minimum or a local maximum.

Local maximum and minimum points are quite distinctive on the graph of a function, and are therefore useful in understanding the shape of the graph. In many applied problems we want to find the largest or smallest value that a function achieves (for example, we might want to find the minimum cost at which some task can be performed) and so identifying maximum and minimum points will be useful for applied problems as well. Some examples of local maximum and minimum points are shown in figure __5.1.1__.

If \((x,f(x))\) is a point where \(f(x)\) reaches a local maximum or minimum, and if the derivative of \(f\) exists at \(x\), then the graph has a tangent line and the tangent line must be horizontal. This is important enough to state as a theorem, though we will not prove it.

Theorem 5.1.1: Fermat's Theorem

If \(f(x)\) has a local extremum at \(x=a\) and \(f\) is differentiable at \(a\), then \(f'(a)=0\).

Thus, the only points at which a function can have a local maximum or minimum are points at which the derivative is zero, as in the left hand graph in figure __5.1.1__, or the derivative is undefined, as in the right hand graph. Any value of \(x\) for which \(f'(x)\) is zero or undefined is called a** critical value** for \(f\). When looking for local maximum and minimum points, you are likely to make two sorts of mistakes: You may forget that a maximum or minimum can occur where the derivative does not exist, and so forget to check whether the derivative exists everywhere. You might also assume that any place that the derivative is zero is a local maximum or minimum point, but this is not true. A portion of the graph of \( f(x)=x^3\) is shown in figure __5.1.2__. The derivative of \(f\) is \(f'(x)=3x^2\), and \(f'(0)=0\), but there is neither a maximum nor minimum at \((0,0)\).

Since the derivative is zero or undefined at both local maximum and local minimum points, we need a way to determine which, if either, actually occurs. The most elementary approach, but one that is often tedious or difficult, is to test directly whether the \(y\) coordinates "near'' the potential maximum or minimum are above or below the \(y\) coordinate at the point of interest. Of course, there are too many points "near'' the point to test, but a little thought shows we need only test two provided we know that \(f\) is continuous (recall that this means that the graph of \(f\) has no jumps or gaps).

Suppose, for example, that we have identified three points at which \(f'\) is zero or nonexistent: \( (x_1,y_1)\), \( (x_2,y_2)\), \( (x_3,y_3)\), and \( x_1 < x_2 < x_3\) (see figure __5.1.3__). Suppose that we compute the value of \(f(a)\) for \( x_1 < a < x_2\), and that \( f(a) < f(x_2)\). What can we say about the graph between \(a\) and \( x_2\); Could there be a point \( (b,f(b))\), \( a < b < x_2\) with \( f(b)>f(x_2)\); No: if there were, the graph would go up from \((a,f(a))\) to \((b,f(b))\) then down to \( (x_2,f(x_2))\) and somewhere in between would have a local maximum point. (This is not obvious; it is a result of the Extreme Value Theorem, theorem __6.1.2__.) But at that local maximum point the derivative of \(f\) would be zero or nonexistent, yet we already know that the derivative is zero or nonexistent only at \( x_1\), \( x_2\), and \( x_3\).

The upshot is that one computation tells us that \( (x_2,f(x_2))\) has the largest \(y\) coordinate of any point on the graph near \( x_2\) and to the left of \( x_2\). We can perform the same test on the right. If we find that on both sides of \( x_2\) the values are smaller, then there must be a local maximum at \( (x_2,f(x_2))\); if we find that on both sides of \( x_2\) the values are larger, then there must be a local minimum at \( (x_2,f(x_2))\); if we find one of each, then there is neither a local maximum or minimum at \( x_2\).

It is not always easy to compute the value of a function at a particular point. The task is made easier by the availability of calculators and computers, but they have their own drawbacks---they do not always allow us to distinguish between values that are very close together. Nevertheless, because this method is conceptually simple and sometimes easy to perform, you should always consider it.

Example 5.1.2

Find all local maximum and minimum points for the function \( f(x)=x^3-x\).

**Solution**

The derivative is \( f'(x)=3x^2-1\). This is defined everywhere and is zero at \( x=\pm \sqrt{3}/3\). Looking first at \( x=\sqrt{3}/3\), we see that \( f(\sqrt{3}/3)=-2\sqrt{3}/9\). Now we test two points on either side of \( x=\sqrt{3}/3\), making sure that neither is farther away than the nearest critical value; since \( \sqrt{3} < 3\), \( \sqrt{3}/3 < 1\) and we can use \(x=0\) and \(x=1\). Since \( f(0)=0>-2\sqrt{3}/9\) and \( f(1)=0>-2\sqrt{3}/9\), there must be a local minimum at \( x=\sqrt{3}/3\). For \( x=-\sqrt{3}/3\), we see that \( f(-\sqrt{3}/3)=2\sqrt{3}/9\). This time we can use \(x=0\) and \(x=-1\), and we find that \( f(-1)=f(0)=0 < 2\sqrt{3}/9\), so there must be a local maximum at \( x=-\sqrt{3}/3\).

Of course this example is made very simple by our choice of points to test, namely \(x=-1\), \(0\), \(1\). We could have used other values, say \(-5/4\), \(1/3\), and \(3/4\), but this would have made the calculations considerably more tedious.

Example 5.1.3

Find all local maximum and minimum points for \(f(x)=\sin x+\cos x\).

**Solution**

The derivative is \(f'(x)=\cos x-\sin x\). This is always defined and is zero whenever \(\cos x=\sin x\). Recalling that the \(\cos x\) and \(\sin x\) are the \(x\) and \(y\) coordinates of points on a unit circle, we see that \(\cos x=\sin x\) when \(x\) is \(\pi/4\), \(\pi/4\pm\pi\), \(\pi/4\pm2\pi\), \(\pi/4\pm3\pi\), etc. Since both sine and cosine have a period of \(2\pi\), we need only determine the status of \(x=\pi/4\) and \(x=5\pi/4\). We can use \(0\) and \(\pi/2\) to test the critical value \(x= \pi/4\). We find that \( f(\pi/4)=\sqrt{2}\), \( f(0)=1 < \sqrt{2}\) and \( f(\pi/2)=1\), so there is a local maximum when \(x=\pi/4\) and also when \(x=\pi/4\pm2\pi\), \(\pi/4\pm4\pi\), etc. We can summarize this more neatly by saying that there are local maxima at \(\pi/4\pm 2k\pi\) for every integer \(k\).

We use \(\pi\) and \(2\pi\) to test the critical value \(x=5\pi/4\). The relevant values are \( f(5\pi/4)=-\sqrt2\), \( f(\pi)=-1>-\sqrt2\), \( f(2\pi)=1>-\sqrt2\), so there is a local minimum at \(x=5\pi/4\), \(5\pi/4\pm2\pi\), \(5\pi/4\pm4\pi\), etc. More succinctly, there are local minima at \(5\pi/4\pm 2k\pi\) for every integer \(k\).