Optimization problems are another common application of the derivative. Usually in these problems you are given some function or described some situation and are then asked to find different maximums and minimums. There are a few different things that are commonly asked that you optimize, so I’d like to go over the different categories with you.

## Local maximums and minimums

The most common thing that comes up in optimization problems is finding the local maximums and minimums. The best way to do this is using the derivative of the function you are trying to optimize. Taking the function’s derivative will tell you everything you need to know.

In order to find the list of all *x *values where the local extrema may occur, you just need to **take the function’s derivative, set it equal to zero, and solve for x.** In other words, you can find the

*x*values that will give you local max and min values by setting up the equation $$f'(x)=0$$ and solving it for

*x*. Keep in mind, this equation often has multiple solutions, so make sure you include all possible solutions.

Doing this will give you a list of *x *values where all possible local maximums and minimums occur. These are called **critical numbers.**

Once you have your list of critical points, you will often need to figure out which ones are maximums and minimums. There are two tests you can conduct to figure which one they are.

### First derivative test

This is usually the method I like to use. As you might guess, the first derivative test only requires the use of the first derivative. I usually use this test because we already had to find the first derivative to get our list of critical values.

The first thing I would suggest doing before beginning your test is drawing out a number line and putting your critical values on it. Let’s just say for example that we had some function *f(x)*, took its derivative, and found that the critical values are \(x=-1, \ 2, \ 6\). Our number line might look something like this.

That’s all you need on your number line at this point. **Don’t label any extra ****x**** values besides your critical values.** It will only make things more confusing later.

Now all we need to do is plug *x* values into *f’* that are around these critical values to figure out where f is increasing and decreasing. So we will need to plug in some number that is in each of the following 4 intervals. $$x<-1,$$ $$-1 < x < 2,$$ $$2 < x < 6,$$ $$x>6.$$ So all we need to do is just plug in some number in each segment of our labeled number line.

It doesn’t matter which number you plug in from each of those intervals, so you can pick whichever numbers seem easiest to plug into *f’*. Let’s say we will plug \(x=-2, \ 0, \ 4, \ 7\) into *f’*. We want to plug them into *f’* because we are trying to figure out information about the **slope of ****f****.** This will tell us where it’s increasing and decreasing. Let’s imagine we plug these four *x* values into *f’* and find that $$f'(-2)=-4, \ \ \ f'(0)=6, \ \ \ f'(4)=2, \ \ \ f'(7)=-7.$$

We only really care if these values are positive or negative. **If ****f’**** is positive at a certain ****x**** value, we know ****f**** must have a positive slope. And if ****f’**** is negative at a certain ****x**** value, we know ****f**** must have a negative slope.**

Since *f'(-2)* is negative, *f *must have a negative slope at \(x=-2\). And *f* must also have a negative slope for all \(x<-1\) since that is the interval from our number line that \(x=-2\) falls within. So we should label this interval with a negative slope, like this:

Then we want to do the same thing for the interval of \(-1 \leq x \leq 2\). We found out that \(f'(0)=6\), which is a positive number. Therefore, *f* must have a positive slope for all \(-1 \leq x \leq 2\). So we can label our number line accordingly.

Then we want to do the same thing with the other two intervals. This would give us something like this for our number line:

Now we just need to use this number line to determine which critical values are maximums and which are minimums. There are really only 3 main cases you need to think about for each critical value.

- If
*f*is**increasing to the left**and**decreasing to the right**, that critical point will be a**local maximum**. This will cause this little section of the graph to look like a frowny face. Therefore, the critical point will higher than the graph right around it. - If
*f*is**decreasing to the left**and**increasing to the right**, that critical point will be a**local minimum**. This will cause this little section of the graph to look like a smiley face. Therefore, the critical point will lower than the graph right around it. - If
*f*is**decreasing to the left and the right***or*if it’s**increasing to the left and the right**, that critical point will*NOT*be a local maximum or a local minimum.

So let’s look at each of our three critical values on the number line above and see which category they all fall into.

- For \(x=-1\), you can see that
*f*is decreasing on the left side and increasing on the right side. Therefore, the section of the*f(x)*right around \(x=-1\) looks like a smiley face and would be a**local minimum**. - For \(x=2\), you can see that
*f*is increasing on the left side and increasing on the right side. Therefore, the critical value \(x=2\) would**not be a local maximum or a local minimum**. We would need*f(x)*to change direction at \(x=2\) for it to be a maximum or minimum, but that doesn’t happen here. - For \(x=6\), you can see that
*f*is increasing on the left side and decreasing on the right side. Therefore, the section of the*f(x)*right around \(x=6\) looks like a frowny face and would be a**local maximum**.

### Second derivative test

The other way you can test to see if each critical value is a local maximum or a local minimum is with the second derivative test. You do not need to use both methods if you are only trying to find local extrema because they will give you the same conclusions. Just pick which test you like more. This method will require us to find the second derivative of our function, or *f”(x)*. We can find this simply by finding the derivative of *f'(x)*, which we already found.

Just like with the first derivative test, it helps to draw everything out on a number line. Start with just drawing a number line that only contains the critical values which we found a while ago.

Now we need to plug each of our critical values into our second derivative, or *f”(x)*. One important difference is that we had to plug numbers **around our critical values with the first derivative test**. But **with the second derivative test, we will actually plug in the critical values instead of numbers around them.**

Since we need to plug each critical value into our second derivative, this means we will plug \(x=-1, \ \ 2, \ \ 6\) into *f”(x)*. When we do that, let’s imagine we find that $$f”(-1) = 2, \ \ f”(2) = 0, \ \ f”(6) = -9.$$

Just like before, it doesn’t really matter what the exact values are that we just found. All that matters is whether they are positive, negative, or zero. If **f”**** is positive** at a certain point, then **f**** would be concave up** at that point. And if **f”**** is negative** at a point, then **f ****is concave down** at that point. If **f”**** is zero**, then **f**** isn’t concave up or concave down** at that point.

Since *f”(-1)* is positive (we just found that it’s *2*), we know that *f* is concave up when \(x=-1\). That just means that it’s curved upward, like a smiley face. So we can indicate this on our number line to keep track of what we have so far.

Since *f”(2)* is zero, we know that *f* is not concave up or down when \(x=2\). This tells us that \(x=2\) is the point where *f* switches from being concave up to concave down, or vise versa. Since *f* doesn’t have concavity (curvature) here, we will show this as a flat line on our number line.

And lastly, since *f”(6)* is negative (we just found that it’s *-9*), we know that *f* is concave down when \(x=6\). That just means that it’s curved downward, like a frowny face. Therefore, we might get something like this.

So now we just need to figure out what all this means when it comes to the second derivative test. Again, there are three cases we want to look for.

- If
*f(x)*is concave up, or**f”(x)****is positive**, for some critical value*x*, then this critical value represents a**local minimum.** - If
*f(x)*is concave down, or**f”(x)****is negative**, for some critical value*x*, then this critical value represents a**local maximum.** - If
*f(x)*isn’t concave up or down, or**f”(x)****is zero**, for some critical value*x*, then this critical value could be a**local minimum or local maximum or neither.**

So let’s compare these to our critical values to see if they are each local maximums or minimums.

- For \(x=-1\), you can see that
*f*is concave up. Therefore, the section of the*f(x)*right around \(x=-1\) looks like a smiley face and would be a**local minimum**. - For \(x=2\), you can see that
*f*is not concave up or concave down. In this case**we don’t know from the second derivative test if this critical value would****be a local maximum or a local minimum**. - For \(x=6\), you can see that
*f*is concave down. Therefore, the section of the*f(x)*right around \(x=6\) looks like a frowny face and would be a**local maximum**.

**Notice that these are the exact same results we found from the first derivative test, aside from the undetermined critical value.** I know we didn’t actually have a function for *f(x)* to work through, but you would find the same thing if you did actually go through these processes with some function. To find which critical values are local maximums, local minimums, or neither, you only need to do one of these two tests.

### Extra practice

Find the critical values for the following functions and determine whether each one is a local minimum, local maximum, or neither. A couple of these examples will require the use of the product rule and the quotient rule, so check those out if you need a refresher.

$$f(x)= 2x^4 + 5x^2 – 12x$$ $$g(x)= xe^x +6x^3-12$$ $$h(x)= \frac{x^4-3x^2+1}{x+1}$$

Hopefully all of this helps you gain a bit of a better understanding of local extrema, but as always I’d love to hear your questions if you have any. Go **check out part 2 of my coverage on optimization problems** where I go over global maximums and minimums.