0:00

Welcome to calculus. I'm Professor Griest, and we're about to

Â begin lecture 14 on optimization. One of the best applications of

Â derivatives is to a class of problems you may have called max min.

Â The modern terminology is optimization. In this lesson we'll use derivatives to

Â compute maxima and minima for optimization problems, solving some that

Â are simple, and some not so simple. Optimization theory is a wonderful class

Â of problems to which calculus applies. In optimization you ask, what is the

Â best? How do you maximize profit?

Â How do you minimize drag on an airplane wing?

Â How do you find the best route through a complex network?" These are all aspects

Â of optimization. A simple question to which calculus can

Â be applied is, given a function, what is its maximum, or minimum value?

Â Well, I'm sure you've seen something along these lines before, but let's step

Â back and think for a moment. If we have a function and we take a close

Â look at its graph, then one of the things we can observe is that if we are at a

Â place where the derivative is non-zero, then we are certainly not at a maximum or

Â a minimum, because if we zoom in and look at the local behavior at a point where

Â the derivative is not zero. Then, because, derivatives can note rates

Â of change. Then, if the derivative is negative, that

Â means the function is, decreasing, locally.

Â On the other hand, if the derivative is a positive value, then the function is

Â increasing, locally, as we increase. The input.

Â Now of course we can run that observation in reverse if we do have a maximum or a

Â minimum and the derivative exists there. Then it must be equal to 0.

Â This motivates the following definition. A critical point of a function f is an

Â input a at which the derivative vanishes. So for example if we look at a location

Â where there is a minimum that's a critical point, if we look at a location

Â where there is a maximum that too. Is a critical point.

Â However, there are critical points that are neither maxima nor minima, such as an

Â inflection point. And, in general, the collection of

Â critical points for a function is strictly larger than the collection of

Â extrema. Places where you have a max or a min.

Â Now, things are a bit more complex than this, really.

Â What happens if we have a function that is discontinuous, or not differentiable

Â at a point, or not defined at a certain input?

Â Well, a lot of different things can happen: maxima, minima, neither.

Â We want to expand our definition of a critical point to include, as well, those

Â locations at which things go bad, such as where the derivative is undefined.

Â The classification of critical points into maxima, minima, or neither, is

Â subtle. You may recall the wonderful second

Â derivative test that is so helpful. Recall that at a critical point, x equals

Â a, you have a minimum if the second derivative at a is bigger than zero.

Â You have a maximum if that second derivative at A is less than 0.

Â If your second derivative is 0, or is undefined, then you have a fail.

Â The test does not tell you whether it's a minimum or a maximum or neither.

Â 4:24

Now these are only local minima or maxima since we're just using derivative

Â information. And some students get things mixed up.

Â What do you do? Is it positive for a minimum or positive

Â for a maximum? Negative?

Â Which is it? I'll leave it to you to come up with a

Â way to remember how this goes. Now, why is it that the second derivative

Â test works? Well, as with the case of L'Hopital's

Â rule, there's a good reason. And Taylor series allow us to see that

Â reason transparently. Consider what happens at a critical

Â point, x equals a. If we Taylor expand f about that point.

Â Then what can we say? Well, because we have a critical point.

Â The first derivative vanishes. Then with that gone away and ignoring all

Â of the higher order terms that is terms of degree 3 and greater what do we see f

Â looks like quadratic, you have a constant term and them the leading term after that

Â is quadratic. In x minus a.

Â That means, ignoring the higher order terms, that the graph looks locally like

Â a parabola. The parabola would open up if the

Â coefficient in front of the second degree term, is positive.

Â That would open down, if the coefficient is negative.

Â Therefore we see that the sign of that second derivative at A, tells us whether

Â we have a local maximum or a local minimum.

Â Let's consider the simple example, sine squared to x times log of cosine of x.

Â This has a critical point at x equals zero.

Â What happens when we Taylor expand? Sine of x becomes x plus big O of x

Â cubed. We square that, and then multiply it by

Â the log of what? Well 1 minus x squared over 2 plus big O

Â of x to the 4th. We have a little bit more expansion to

Â do. Taking the sign squared term, and

Â expanding that out. And then, expanding log of 1 plus

Â something into, in this case. Negative x squared over two plus big 0 of

Â x to the fourth. Now when we multiply these three

Â expansions out, the leading order term is given by the product of x, x, and

Â negative x squared over 2. That is, we get a negative one-half x to

Â the 4th plus big O x to the 6th. And we can see why we didn't use the

Â second derivative test here, because it would've given us a 0, a fail.

Â However, we can conclude that this really is a local maximum at 0.

Â Because of this coefficient, negative one half in front of x to the 4th.

Â So what does that mean? Have we, have we just invented the fourth

Â derivative test? No, nothing that exciting.

Â We've just done Taylor Expansion. Instead of relying on specialized tasks,

Â rely on the principles. In this case, taylor expand to see what's

Â happening. Let's do a simple example.

Â Consider a square of side length l out of which cut the four corners we remove four

Â square of equal size and then fold at the internal edges to get an open topped box.

Â I want you to maximize the volume of that box with respect to what we remove.

Â If we remove larger squares we might get a smaller volume box.

Â If we remove smaller squares, then we might get a smaller volume Box.

Â What is the maximal volume? Well in this case, we better set x to be

Â a variable; in this case, the side length of the corners that we remove.

Â Then in this case, the volume is what? Well when we fold it up, the height of

Â the box is x. And the length of the base is quantity L

Â minus 2 X. So the volume is X times L minus 2 X

Â quantity squared. Multiplying that out gives 4 X cubed

Â minus 4 L X squared, plus L squared times X.

Â Now remember, x is the variable and l is a constant.

Â So that when we differentiate with respect to x, we get 12 x squared minus 8

Â l x plus l squared. This factors nicely as 6 x minus l times

Â 2 x minus l. And we wanta factor that because we're

Â going to compute the critical points. Setting that directive equal to zero

Â solving get us two critical points. One that x equals L over 2 and the other

Â that x equals L over 6. We must classify these as maxima or

Â minima, or neither. At best we can, so we'll take the second

Â derivative, which we can compute to be 24x minus 8l.

Â Evaluating that second erivative at the ritical points gives us what...

Â At L over 2, it gives us 4 L. That's a positive number and that means

Â that we have a minimum or a local minimum at that point at x equals l over 6.

Â The second derivative is negative 4 L. That gives us local maximum.

Â Of course this fits with your intuition if X is equal to L over 2.

Â Then what is happening when you fold up that box?

Â Oh well you're getting something with volume 0.

Â That's clearly a minimum. We therefore conclude that the volume is

Â maximized. At x equals l over six but notice the

Â problem is asking us for the maximum volume not the value of x at which the

Â volume is maximized. So we need to substitute back in x equals

Â l over six into v. To get 2l over 3, that's l minus 2x,

Â squared, times x, or l over 6. Simplifying that gives us 2l cubed over

Â 27. That is the maximum volume.

Â 11:56

Let's look at another example. In this case, extremize the function f of

Â x equals x cubed over 3, minus 3 x squared, plus 8 x minus 2.

Â And here the extremization is with some constraint, mainly we want x to be bigger

Â than or equal to 0. So no negative values.

Â Let's proceed the same way that we compute the derivative of f then we get x

Â squared minus 6 x plus 8 to compute the critical points we're going to want to

Â factor this as x minus 2 times x minus 4. And so, setting that equal to 0 gives us

Â a pair of critical points, x equals 2 and x equals 4.

Â To classify them, let's compute the second derivative of f.

Â That is simply 2x minus 6. And so we see that at x equals 2, we have

Â a maximum with a value of 14 thirds. At x equals 4, the second derivative, is

Â positive. So we have a minimum, a minimum at a

Â value of 10 3rds. However, that is not the end.

Â These are local extrema. The problem is to find the global maximum

Â and minimum. When you're asked to find a global max or

Â min. You must check the endpoints of your

Â domain. These endpoints are critical points since

Â the function and/or its derivative may not exist there.

Â Let us therefore check the endpoints of our domain.

Â Remember our constraint is that x must be bigger than or equal to zero.

Â Therefore the left hand end point is at x equals zero.

Â What do we see there? Well, the value that the function takes

Â on is negative 2. This is a minimum, since it is less than

Â the other critical values that we have computed.

Â In fact, this is the global minimum for the function.

Â Are there any other critical points that we have to look at?

Â Well there's not really a right hand end point to the domain, since it is

Â unbounded. But if we tweak the language a little

Â bit, we can say that infinity is a critical point.

Â What is the function doing at infinity or more properly, as x goes to infinity?

Â Well, you can see that because the leading order term is x cubed over 3, the

Â function tends to infinity. And therefore, we have a maximum, a

Â global maximum. Taking on the value of infinity at this

Â right hand endpoint. Now of course, all of this would be

Â fairly obvious if you drew the graph of the function.

Â You would see the difference between the local max and the local min that we have

Â computed. And the global minimum and maximum at the

Â left and right hand endpoints respectively.

Â Always check your endpoints. This lecture was the best, or maybe it

Â was the worst. You're going to have to compute a few

Â derivatives to find out for sure. In our next lesson, we're going to turn

Â from the concrete notion of a dirivative to the suttly different idea of a

Â differencial.

Â