Optimization Problems Part 2

In my last lesson, I introduced optimization problems and I discussed local extrema. You should check that out if you haven’t already. The next thing that I would like to discuss now is finding global maximums and minimums. The first step in finding a global maximum or minimum of a function is actually very similar to finding the local max and min values.

But once you know about the local maximums and minimums, how do you find the global extrema?

Finding the global extrema from the local extrema is really quite simple. And there really is only one way to find the global maximum and minimum values of a function. You just need to find a list of all possible x values where the global max or global min may occur. Then once you have created a list of all possibilities, you just plug them all into the original function.

Not the function’s derivative or the function’s second derivative. But the original function.

You will test for global extrema of f(x) using f(x), not f'(x) or f”(x). This is after you have your list of all possible locations where the global extrema could occur (which will require the use of f'(x)). But my point is that there wouldn’t be a first derivative test or a second derivative test with the global extrema like there was with finding local extrema.

So what does this look like in practice?

Let’s use an example. For example, let’s say that we are asked to find the global maximum and the global minimum of f(x)=2x^3-\frac{5}{2}x^2+x-1 on the domain -4 \leq x \leq 5.

Notice we are being asked to find the global extrema on a specific domain. This is important because a lot of functions either go to infinity or to negative infinity as x either gets infinitely large, infinitely small, or approaches some specific value. So if we were asked to find the global maximum of a function that goes to infinity as x goes to infinity, we wouldn’t be able to do this. There would be no maximum since the function only continues to grow.

So we know we will be limited to a specific domain.

As I said before, finding global extrema starts out exactly like finding local extrema. The first thing we need to do is find the critical values of our function. To do this, we just need to find its derivative and set f'(x)=0 and solve for x.

$$f(x)=2x^3-\frac{5}{2}x^2+x-1$$ $$f'(x)=6x^2-5x+1$$ Then set $$6x^2-5x+1=0$$ and solve for x to find the critical values. To do this, we can factor the left side of the equation. $$(3x-1)(2x-1)=0$$ To solve this we can set each factor equal to zero individually. $$3x-1=0 \ \ \ \ and \ \ \ \ 2x-1=0$$ $$3x=1 \ \ \ \ and \ \ \ \ 2x=1$$ $$x=\frac{1}{3}, \ \frac{1}{2}$$

So now we know that this function has two critical values, x= \frac{1}{3} and x=\frac{1}{2}. Now this is where things get different with a global max/min problem versus finding the local max/min. We also need to consider the endpoints of our given domain as critical values!

This will always be the case when we are looking for a global maximum or minimum. The problem asked us to find the global extrema on the domain -4 \leq x \leq 5. Therefore, we will also say that x=-4 and x=5 will be treated as critical values that we need to test.

So how to we test our critical values?

The first thing that I would like to do is list out all of the x values we will be testing in one place. Remember, the list of values we need to test came from two places:

  1. Setting f'(x)=0 and solving for x.
  2. Each of the endpoints of the domain on which we need to find the global maximums and minimums.

So in this case we’ll have four total x values that we need to test: $$x=-4, \ \frac{1}{3}, \ \frac{1}{2}, \ and \ 5$$ To test these points, all we need to do is plug each of the four points into f(x). Whichever on outputs the largest number will tell us the global maximum. Whichever outputs the smallest number will tell us the global minimum.

$$f(-4)= \ 2(-4)^3-\frac{5}{2}(-4)^2+(-4)-1 \ = -173$$ $$f \bigg( \frac{1}{3} \bigg) = \ 2 \bigg( \frac{1}{3} \bigg) ^3-\frac{5}{2} \bigg( \frac{1}{3} \bigg) ^2+ \bigg( \frac{1}{3} \bigg) -1 \ = -\frac{47}{54}$$ $$f \bigg( \frac{1}{2} \bigg) = \ 2 \bigg( \frac{1}{2} \bigg) ^3-\frac{5}{2} \bigg( \frac{1}{2} \bigg) ^2+ \bigg( \frac{1}{2} \bigg) -1 \ = -\frac{7}{8}$$ $$f(5)= \ 2(5)^3-\frac{5}{2}(5)^2+(5)-1 \ = \frac{383}{2}$$

So we can see that the smallest of these four numbers is -173 and the largest of them is \frac{383}{2}. Therefore, the global maximum of f(x) on -4 \leq x \leq 5 is \frac{383}{2} which occurs when x=5. And the global minimum of f(x) on -4 \leq x \leq 5 is -173 which occurs when x=-4.

We can even graph our function using Desmos along with the critical points to make sure our answer makes sense. You can click on the link in the last sentence to see a larger version of the graph.

global extrema maximum minimum
f(x)=2x^3-\frac{5}{2}x^2+x-1 on the domain -4 \leq x \leq 5

Extra practice

If you’d like some extra practice finding global maximums and minimums, here are a few examples you can work through on your own. A couple of these examples will require the use of the product rule and quotient rule.

For each of the following, find the global maximum and minimum of the given function on the given domain or explain why one doesn’t exist.

$$f(x)= 2x^4 + 5x^2 – 12x \ \ \textrm{on the domain} -1 \leq x \leq 2$$ $$g(x)= xe^x +6x^3-12 \ \ \textrm{on the domain} -3 \leq x \leq 0$$ $$h(x)= \frac{x^4-3x^2+1}{x+1} \ \ \textrm{on the domain} -2 \leq x \leq \frac{3}{2} $$ $$j(x)= \frac{x^4-3x^2+1}{x+1} \ \ \textrm{on the domain} -\frac{9}{10} \leq x \leq \frac{3}{2}$$

Hopefully all of this helps with global maximums and minimums, but as always I’d love to hear your questions if you have any. If you find that you get stuck as you’re working through some of these extra practice problems just let me know. Just email me at jakesmathlessons@gmail.com and I’ll see if I can help provide a bit more clarification. You can also use the form below to subscribe to my email list and I will send you my bonus FREE calculus 1 study guide to help you survive calculus! Just put in your name and email address and I’ll be sure to let you know when I post new content! Feel free to go check out my other lessons and solutions about derivatives as well.

Optimization Problems

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.

critical values number line

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:

critical values number line labeled with slope

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.

critical values number line labeled with slope

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

critical values number line labeled with slope

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.

  1. 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.
  2. 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.
  3. 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.

critical values number line

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.

critical values number line labeled with concavity

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.

critical values number line labeled with concavity

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.

critical values number line labeled with concavity

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.

  1. If f(x) is concave up, or f”(x) is positive, for some critical value x, then this critical value represents a local minimum.
  2. If f(x) is concave down, or f”(x) is negative, for some critical value x, then this critical value represents a local maximum.
  3. 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.

Solution – Find two numbers whose sum is 23 and whose product is a maximum

Find two numbers whose sum is 23 and whose product is a maximum.

When you see a problem like this, it’s obvious our goal is to maximize some function.  The more challenging part is figuring out what the function would be that we want to maximize.  When we look at this problem however, we can actually break it down into two different facts we know about these two numbers, which we will call a and b.

  • The two numbers add up to 23.
  • We need to maximize their product.

Each of these two bullet points can actually be represented mathematically and they can be used together.

Fact #1

First of all, we know that these two numbers add up to 23.  Or in other words,

$$a+b=23.$$

Fact #2

Also, we need to maximize the product of these numbers.  Another way to put this is that we want to maximize the function f, which represents the product of a and b.  So we need to maximize

$$f(a, \ b)=ab.$$

Putting the two facts together

The problem with this, is that it is difficult to maximize multivariable functions, and in fact, this function wouldn’t have a maximum unless we go back to our other equation.  Since we know a+b=23, we can actually use this to rewrite the function we need to maximize in terms of only one variable.

$$a+b=23$$

$$a=23-b$$

Now since we know a=23-b, we can go to our function of a and b and replace each a with (23-b).  Doing this will give us a new function with only b‘s in it, which we can then maximize.

$$f(a, \ b)=ab$$

Replacing a with (23-b) gives us a new function which we’ll call g.

$$g(b)=(23-b)b$$

Maximizing the function to find a and b

Now we just need to find the value of b that maximizes g.  To do this, we just need to take its derivative with respect to b, set it equal to 0, and solve for bThis will always be the general process when you need to maximize or minimize a function.  But first I will expand the function so it’s easier to take its derivative.

$$g(b)=23b-b^2$$

$$g'(b)=23-2b$$

Now set this equal to 0 and solve for b.

$$0=23-2b$$

$$2b=23$$

$$b=\frac{23}{2}$$

We can even check this using Wolfram Alpha.  Below you can see a graph of y=g(b) showing the maximum value at b=\frac{23}{2}.

Find two numbers whose sum is 23 and whose product is a maximum

Now remember, we needed to find the value of a and b that would maximize their product.  So we need to use b=\frac{23}{2} to find a.  To do this, we can just use the relationship we found earlier:

$$a=23-b$$

$$a=23-\bigg(\frac{23}{2}\bigg)$$

$$a=\frac{46}{2}-\frac{23}{2}$$

$$a=\frac{23}{2}$$

So now we know that a=\frac{23}{2} and b=\frac{23}{2} are the two numbers whose sum is 23 and whose product is as large as possible.

There are plenty of other lessons and solutions to help you make sense of derivatives on my derivatives page.  Go check them out and as always, I’d love to here your questions!  Leave a comment below or email me at jakesmathlessons@gmail.com with any questions or suggestions you may have.  Every email and comment helps me gear this site toward what you want to see, so please don’t hesitate to reach out.

You can also enter your name and email below and I’ll send you my calcu 1 study guide full of useful tips and tricks to help you boost your test scores!