Hi, welcome to our lesson on finding and classifying maxes and mins, local maxes and mins extrema of multivariable functions. So we've seen in the single variable case how to find local max and local mins. Just a friendly reminder with the process, you take a function, you find its derivative, you set it equal to zero. Those are the critical points, those are the candidates for maxes and mins. And remember just because you have critical points, that doesn't mean that those points are actually maxes and mins. You have to classify them and there's a couple ways to do that with a sine graph, or perhaps the second derivative test. We're going to mimic that procedure for multivariable functions. Now, just to give you an idea of what we're looking for when we have multivariable functions as sort of put a picture to it first and then will describe it. So for example, what's a function that has a nice min? So we've seen this one before. If I have a function f(x,y), let's take x squared plus y squared. So this is the function that if I take any two numbers and square them, I start to get only, first of all, non-negative numbers. I have the origin and if I take level sets, if I take slices, I get circles and this is the bowl with nice parabolic sides, it's a 3D object. Again, these are circles if you look straight down and it has a bowl. So what kind of points are we looking for? Well, we're looking for, like at the origin here, this function has a minimum at zero. Of course, I could turn the bowl upside down. I'll do a quick sketch if I turn the ball upside down, I would get a nice maximum, but again, you have to imagine this is all in 3D. And maybe there's some landscape that has hills and valleys, so there are many, many multiple mins and maxes, and you have to find them all. Okay, our goal is to find them all. This is what we're looking for, when we say, let's find and classify extrema of multivariable functions. Like in a single variable case, remember, not every critical point is a min or a max. The classic example to that of course was x cubed. So in the single variable case, we had y equals x cubed and this function, remember, had an inflection point at the origin. So we found derivative to be zero. You look at this thing you say, wait a minute, it's neither max nor a min. Well, that's fine. That happens also in the multivariable case. There a little harder for me to draw, but they happen as well. Let me do my best over here to draw this thing. You can imagine some landscape that kind of goes up in one direction and then down in another direction. So in the back and it will go down. You've seen this before in real life, I would imagine. These are called saddle points and the idea is that a saddle sort of has this property to it. So I want you to imagine a landscape that looks like a saddle and you're sitting right where sort of your butt goes right in the middle. The point in the middle, this is the three dimensional analogue of the inflection point. It is neither a max nor min. It's not a max, because if you look at one direction, there are points that are higher than it, points that greater than z values. And if you look in the other direction, if you look sort of where your legs over the side, well then there are points that are lower than it as well. So, this is the 3D version, this is called a saddle point. We'd like to classify these as well, and this is the idea of these are neither max nor mins, okay? So to find critical points, we have to follow sort of the same steps as we do in the single variable case. And step one is to find critical point. Now, you remember how to do that in single variable case? You set the derivative equal to zero. Well, in multivariable functions, there's no such thing as the derivative. So the equivalent thing to do is you solve the system of equations, you solve where the partial derivatives are equal to zero. And you do these for all the variables that you have, we'll just do it for two variables x and y. But you want to solve the system and find where is the partial derivative of f with respect to x equal to zero, and the same thing partial derivative of y, where is that equal to zero. And these points are called critical points and they, the thing to remember the same in single variable case, their candidates. Their candidates for max and mins. They do not have to be, so this sort of a setting, the derivative is equal to zero. This just get to the candidates and then how do you classify, so step two would be to classify. This will not tell you, is it a max or is it a min. This is a little more involved, and perhaps not surprisingly so, the functions are a little more complicated than the single variable case. So step one, I want you to find D. Now D is a function, d(x,y), and is defined to be the following. We take the partial derivative of x by the mix, the second partial derivative f of X times the partial derivative mix partial, second partial of y, minus, this is the mix partial that makes partial [fxy] squared. This is some function, you define secondary derivative, lots of derivatives, lots of partial derivatives you're taking. There's a bunch of going on here, and then I want you to plug in so you find this thing, and then you plug in, and you can do this for each critical point. So you plug in your critical point, and you get some number who knows. And then here's how you classify this thing, so if this value D, we're going to call this thing D. So if D of your value when you plug in is positive, you have to check something. You have to then look at the partial derivative, second partial with respect to x. If fxx plugged into your point, so again all this is plugged in at the point you're looking at, if this is greater than 0, then the point P, is a local min, is a local min. It's counter intuitive, just like the second derivative test is also counterintuitive for single variables, remember if you're concave up, if the graph holds water, then you have a minimum, so same thing over here. If you're concave up-ish, if you want to think that way, then you have a local min and exactly the true is for the other way of the inequality. If your second derivative this is again all x, is negative, then P is a local max, okay? So that's if D is positive you have to do some other checks. If D is negative, so you plug in, and D is negative, then right away you know that you have a saddle point, so this is a little faster if this happens. If its saddle point, and here's the kicker so if it's positive I gotta do some checks to get a min or max. If it's negative, I get a saddle point and if D is = 0, then the test fails, you gotta try something else, you gotta look at something else, okay? This D by the way this D, sometimes this is called the Hessian, sometimes this is called the Hessian. So you'll you hear me call it that way as well. All right so these are the steps, write this down, we're going to follow this recipe, there's a lot of derivatives going on here, there's a lot of work, so we're going to work neatly. These will take a good chunk of a page to do. So let's do a couple here, ready? All right so as an example, let's start off with a nice polynomial, sort of simple. I have a function f(x, y), and it's equal to x squared + y squared + xy, okay? And the directions here say, find the critical points and classify them, okay? So want to tell me where the local max is, where the local min is. Here we go, follow directions step one, find a partial derivative with respect to x, so the first one is 2x. Remember y is a constant, so the y squared is 0 and then xy, that's just + y, and then find a partial with respect to y, all the same reasoning gives 2y + x. And then you set these things equal to 0, so a friendly reminder colon equals if you forgot what that meant or haven't seen that before that setting it equal to 0 and now we want to solve. And this is good old solve a system of equations, there's lots of ways to do this, you can back solve, you can substitute, you could do a whole bunch of things. Which we can do with this one and say okay y =- 2x, and we can substitute that into the second equation. So we have 2 times y or 2(- 2x) + x = 0, put it together, you get minus 4 + 1 is- 3x = 0, so I have that x = 0, then I go back and plug in, and you get the y = 0 as well. So we're finding the only critical point to be the origin, to be the origin, so we can label that. Sometimes the directions will say, just find the critical point, so just hand that back, but often they want to find it and then classify. So now we classify okay so now we kind of switch gears a little bit, and we start doing our second derivative test we're going to find the Hessian. To do the Hessian, we have to take partial derivatives. So we need fxx the second partial. So look at our derivative, we take it with respect to x again, we have a 2, we want to find fyy, the second partial with respect to y, look at our derivative with respect to y, take a derivative there, you get 2 again. We also want the mix partial so you might as well grab that now. When I take the mix partial so this is remember I can take either one, they're equal, and if you notice you can practice. This is a good check to make sure that you took the correct partial derivative. If I look at the partial instructed to x and take it's derivative with respect to y, you get 1, the same thing for f of y, you get 1 if you take it with respect to x. So we find the Hessian here. Now this is all nice because it's constant, so I don't have to actually plug anything in, so, reminder, I'll write the formula down again. It's fxx fyy- [fxy] squared, using brackets for no good reasons you could use parentheses there as well. Plug this in, and normally I plug in 0, 0, but these are all constants it's a nice easy example to start off with. So what do we get? We have (2) (2)- 1 squared. Of course that's 4- 1 better known as 3. I don't care that the number is 3, I just care that it's positive. Just care that is positive. When it's positive, I then have to look at fxx and I look at this number, this is just 2. I say okay, well, that's positive as well, and therefore the origin by the classification, by second derivative test is a local min. And we have found the critical points and we have classified it. This graph if you want and then I encourage you to do this, go over to your favorite graphing software and this looks like sort of like a bigger bowl. Little wider bowl centered right at the origin, and so it is in fact a local min. Now let's do another example. So the multi variable function that we want to study have f(x, y) = X cubed- Y squared- Y squared- 12X + 6y + 5. Same thing, find all relative maximins, final local maximims and classify them using the second derivative test. Let's go through the process we get 3X squared, Y squared is a constant -12, 6Y, and 5 all constants, we'll go a little faster here. fy we have -2Y + 6. We set these equal to 0. And I want to solve for one. Now this is interesting because the first equation only is in terms of X. So I can go ahead and solve for this. This gives you that 3X squared is 12. Divide both sides by 3. Gives you that X squared = 4. Be very, very careful here. You're about to take a square root. Very common mistake in algebra, a lot of people would make this, they say X = 2. That's not correct. When you take a square root, you gotta put the plus or minus. So X is plus or minus 2, right? If you take -2 squared to get 4. So I have two X values an if I go and look at Y? Well, very simple algebra says that -2Y = -6. So of course Y is equal to 3. So I have actually two critical points. I have (2, 3) and (-2, 3). So these are my X values this is my Y value put together you get 2 critical points. Be careful with the plus, minus often very easy to kind of forget that and miss that. Now we classify, okay? So now we classify and we need second partials here. So let's do fxx so we take f and do it one more time. Here we go. We get 6X- 12, is constants, we get 0. We need fyy this becomes- 2 and we need the mix partial. Doesn't matter which one you do, they should be the same if you're doing this correctly. So if we take fx and look at it with respect to Y, we get 0, look at fy, there's no X 's, so we get 0 here as well, it's kind of nice. So we can compute this D, we can compute the hessian. So this is fxx fyy- [fxy]squared. Now the mix partial is 0 and that gives me if I put these two together you just get -12X. So notice I get the function that I promised here. Normally you have X's in Y's, but again this example is simple enough so I don't need it and so I plug in. We look at each point. So let's test. We'll look at the first critical point. And again, you just do this for every single point. Let's do (2, 3) and see what's going on there. So I plug in D, I get -12 and then times the X value, which is just 2 to get -24. Negative D means that this point is a saddle point. You don't need to do any follow up with that. So I have a saddle point, so neither max nor min. If I test the other point, (-2, 3), I plug in D. I get -12 (- 2), which is positive 24. Positive 24 and this is a positive thing, so I don't actually know what it is just yet. I have to look at the partial fxx and that's 6X. So when I take again, I'm looking at the point -2, so I plug in -2 here, you get 6(-2), which is of course -12. The number is not important, just the sign, so it's negative and so therefore I have a local max. So just like functions' going to have max's, min's and neither's, so can multi variable Functions as well. Let's do another one, let's do a function of three variables. So, let's look at f (x,y,z), and this is going to be 2x squared + 3y squared + z squared- 2x- y- z. Now all I want here for you to do is find the critical points, find the critical points. Classifying the critical points in more than two variables, it's possible but honestly it gets so tedious and it's a little bit beyond what we want to do here, but I just want you to get practice solving for the critical points. If you could do it in three variables, the ideas you can do in two. Sometimes people get caught up in the derivatives of the algebra and they just get the wrong critical points and then it doesn't matter how good the other stuff is. Once there's one mistake in this thing, then you plug in all the wrong numbers and not getting the right results. So, let's just practice in the case of three variables. So, same idea, let's take partials. When we do that, we get 4x there's 3y squared is a constant, z squared is a constant, again, x is our variable, -2x. So, that derivative is -2, -y -z is also a constant. Partial derivative with respect to y, that gets us 6y, 2x squared is a constant, z squared is a constant, -2x is a constant, -1. And then fz, so, what's that? That's 2z, and then there's a -1. So, three equations, we gotta solve, no problem. Do each one here, set it equal to 0. When I do this, of course you get for 4x = 2, so that x equals two-fourths or one half. Yes, any numbers are fine, fractions, integers, positives, negatives, it doesn't matter. 6y = 1, and that of course gives us that y is one sixth. And 2z = 1, gives that z is one half, so we found one critical point. Now remember here these three variables, so your points can have an x y and z component. That's one half, one sixth, and one half again. That's our critical point. I don't want you to classify it in this case, but you can just settle for the critical point. Let's find and classify another graph that we've seen before, so this will be the cone. And I have x squared + y squared, all under the square root. So, this is 1, if you recognize this is the cone. You can kind of expect what's going to happen here. So, we have a nice cone, centered right at the origin, so I'm expecting to find a local min, but let's just go through and see what happens here, this one is kind of special. Square roots also make things a little harder. As always, whenever you see a square root, immediately convert that to one half and let's find some critical points. That's step one. So, I take a partial with respect to x, I get one half x squared + y squared, to the negative one half. So, it's like general power rule, bring the exponent down, keep the inside the same and then times the partial derivative of the inside. So, now there's a times 2x over here, times 2x. The 2s will cancel, 2 and one half cancel and I get x over, I'm going to put the negative one half on the denominator. So, I get x squared + y squared to the one half, over the squareroot of x squared + y squared. Partial derivative of y turns out to be almost identical. You get one half x squared + y squared to the negative one half times, and now it's just 2y. The 2 and the one half they cancel again. And you get y over x squared + y squared to the one half in the denominator. Set it all equal to 0, set it all equal to 0. Now you have a fraction, friendly reminder, a fraction is equal to 0 when its numerator is equal to 0. So, you can ignore the big scary x squared + y squared in the denominator, and when you set the is equal to 0 and put the numerator equal to 0, you get a nice critical point, again not surprisingly, right at (0,0), so there's our critical point. So, now let's go ahead and classify this and I just want to kind of show you what happens. So, let's classify, switch gears up. All right, so we need some mixed partials. So, let's take fxx, second to partial with respect to x. Unfortunately, here I have a nice quotient rule, so I just gotta be careful. So, I have x squared + y squared. So, I have bottom times the derivative of the top, that's just one, so times one, I'm not going to write it minus the top times the derivative of the bottom. Now this is kind of nice 'because I already took the derivative of the bottom over the original function, it's exactly the same. So, I'll just borrow the partial derivative once again and that's x over X squared + y squared, to the one-half, all over, the bottom function squared, so that's x squared + y squared, the one-half goes away. And the partial derivative here of yy, is found very similar, found very similarly and when I do that is good practice I guess for quotient rule, so you have the bottom function. So x squared + y squared is one-half times are at the top, which is this 1,- the top function, times the derivative the bottom, so you get y over x squared + y squared to the one-half. And then all over the bottom square, so it's getting a little nasty, but it's okay. And I'm going to need the mix partial, which is another quotient rule here. I'm going to need the mix partial, but I want to show you I guess I can even stop here just to show you what's going to happen. So I leave it as an exercise to find this mix partial. Here's where this is going, just to show you we already know it's going to be a minimum, but just to show it happens. If you go and compute D, and our point to plug in is (0, 0). The recipe for D says cook up, plug in, plug into your partials (0, 0) times another partial for (0, 0), and then- the partial plugged into (0, 0) squared. And I just want you to like stare at this partial derivative for a second fxx, plug in 0 for a minute, what do you get? You plug in 0, look at the nominator more importantly, you get 0 downstairs, you get a 0 in the nominator, it's a problem. You can't do it, you can't it. So this test this is undefined is the key thing, so it's undefined, so the test fails, so this test fails, okay? And the reason why it fails is because you have the sort of vertex down here for the cone. Again, like if you didn't know this was the cone, you might not recognize the vertex, but the idea is the test fails. So when you have 0 downstairs you gotta try to look at something else, and just kind of like you some intuition or use a graphing software and do this. But the test is going to fail because you can't plug in the critical point, and this is the challenge with this one. So we do in fact have, we have a local min, we also have an absolute min as well. That exists, but the mistake to say is, well the test fails and so like I can't classify this thing, it's not knowable. If you look at this function and kind of like step back for a minute, you don't really need a lot of calculus if you look at this, and realize that the origin is going to be the smallest output this function is ever going to have. If you plug in two numbers and square them, they get larger, you never going to get a negative and under the square root again x squared + y squared is always positive and if you take a square root it only gets larger. And that's coming hopefully from your intuition of how the single variable functions behave. So the smallest the square root can ever get a 0, you can attain 0 at the origin, so you're going to have an order at local min, local lax. You're running into the problem of differentiability at that vertex, because of the behavior that's happening in this exact same thing that happens with the absolute value graph. So you're running into problems with this, but I don't want you to say, well, calculus is failed me, I can never know this. No, you can know this, study the function, as this test fails it will be rare when this happens, but hey who knows? And then again of course you could always go grab this thing and try to use graphs to help you figure out if it is a max or min, if the point is kind of obvious, okay? So I just wanted to see that one where things can go wrong, but for the most part they usually going to go right, just be very careful taking derivatives, solving system, and then classifying your points. All right great job, see you next time.