WEBVTT mathematics/multivariable-calculus/hovasapian
00:00:00.000 --> 00:00:04.000
Hello and welcome back to educator.com and multi-variable calculus.
00:00:04.000 --> 00:00:08.000
In today's lesson we are going to continue our discussion of Lagrange multipliers.
00:00:08.000 --> 00:00:13.000
I am going to start by revisiting a previous example and describing the geometry of the solution.
00:00:13.000 --> 00:00:25.000
The reason that I want to do that is so that you can see why it is that this criterion of gradient f equals some λ × the gradient of g, why it actually makes sense.
00:00:25.000 --> 00:00:31.000
I just wanted you to see what the geometry actually looks like, so it does not look like it just fell out of the sky.
00:00:31.000 --> 00:00:44.000
I encourage you to look at the proofs, or some of the explanations in your textbooks if you want something a little bit more rigorous and a little bit more accurate, but I do want it to make sense geometrically what it is that is happening.
00:00:44.000 --> 00:01:20.000
So, let us go ahead and get started. Let us see, in the first example of the last lesson, we found... so let me just write all of this out... in the first example of lesson 20, we found the max and the min... you know what, let me not call them max and min, let me call them extrema.
00:01:20.000 --> 00:02:01.000
We found the extrema values of f(x,y), and if you recall that function was equal to x × y subject to the constraint that the point (x,y) must also satisfy.
00:02:01.000 --> 00:02:24.000
This function g(x,y), which was x²/8 + y²/2 = 1. We were maximizing or minimizing this function subject to the constraint that the x's and y's that actually go into this that maximize it and minimize it also happen to lie on this ellipse. That is what we were doing... equals 1.
00:02:24.000 --> 00:02:50.000
Okay. We found four points that satisfied... okay, we had the point (2,1), (2,-1), (-2,1), and (-2,-1).
00:02:50.000 --> 00:03:05.000
The respective f values, in other words when we put these points into x, y, the respective f values, I am just going to write them underneath... we had 2, -2, -2, and 2.
00:03:05.000 --> 00:03:13.000
These two were the points where the function achieved a maximum, and these two were the points where it achieved a minimum.
00:03:13.000 --> 00:03:29.000
Let us take a look at what this looks like geometrically. So, let us look at this geometrically.
00:03:29.000 --> 00:03:42.000
What you have -- I am just going to draw a little x, y plane here -- and again we are looking for points (x,y) in the x, y, plane that actually maximize this function x, y but also happen to lie on the ellipse.
00:03:42.000 --> 00:03:58.000
Well, x, y, if you do the level curves of x, y... in other words x, y, equals some constant, x,y = 3, x, y = 2, x, y = 5/2, whatever. You are going to get a series of hyperbolas. That is what you are going to end up getting.
00:03:58.000 --> 00:04:09.000
I am going to go ahead and draw a few. First we want to make sure that x and y actually satisfy this equation. In other words, that they lie on this ellipse.
00:04:09.000 --> 00:04:18.000
Let me just go ahead and draw an ellipse here... I am not very good at drawing at ellipses, but again, the drawing itself is not that important.
00:04:18.000 --> 00:04:31.000
So, this is x² + y² = 2. Where you have this right here is the distance from the center to this vertex is going to be sqrt(8), and this one is going to be sqrt(2).
00:04:31.000 --> 00:04:37.000
The points x,y, that lie on here, which ones are the ones that actually maximize? Well, we found these points right here.
00:04:37.000 --> 00:05:00.000
(2,1), there was one, (-2,1), (-2,-1), and (2,-1), so here is actually what it looks like geometrically... oops, not very good, let us make it a little bit better than that... here is that... here is another point.
00:05:00.000 --> 00:05:23.000
So, in other words, if you were to look at this at the point (2,1), (-2,1), (-2,-1), and (2,-1), these are the points that maximize the function. These are also the points that happen to lie on this ellipse, so the constraint is satisfied. Those are the points that we found.
00:05:23.000 --> 00:05:38.000
Well, geometrically, what it is, take a look at this as it turns out at this point if I were to actually take the tangent line to both curves as it turns out, they correspond.
00:05:38.000 --> 00:05:51.000
In other words, if I were to take this tangent line at this point happens to be the same for this curve, g, and for this curve, f.
00:05:51.000 --> 00:06:00.000
What ends up happening is the following: the gradient, at those points, looks like this. The gradient of f will be this way, the gradient of g will be this way.
00:06:00.000 --> 00:06:09.000
Because the tangent lines correspond, the gradient vector is perpendicular to the tangent line, so as it turns out they're moving in the same direction.
00:06:09.000 --> 00:06:20.000
Well, one is going to be either the same length or it is going to be longer than the other. That is what the Lagrange multiplier is. It is just a scalar multiple of the gradient vector.
00:06:20.000 --> 00:06:34.000
When we say that the gradient of f equals some multiplier λ × the gradient g, what we are saying is they are either moving in the same direction or the opposite direction depending on whether λ is positive or negative.
00:06:34.000 --> 00:06:42.000
In other words the gradient vector g or the gradient vector of f is a scalar multiple of the gradient vector g.
00:06:42.000 --> 00:06:53.000
The gradient vector g right here looks something like this. Here, so this was the max and this was a max. Notice the gradient vectors are in the same direction.
00:06:53.000 --> 00:07:01.000
In the case of the mins, the gradient vectors are actually pointing in opposite directions, but it is still just a scalar multiple of the other.
00:07:01.000 --> 00:07:23.000
In other words, they have the same direction either this way or this way, but they are part of the same line and they are on the same line because the tangent plane, or the tangent line itself to the curves at that point that satisfies the max and min, they are the same for both curves.
00:07:23.000 --> 00:07:32.000
So, the gradient are multiples of each other. The gradient vectors are multiples of each other, and that is what is happening. That is what this actually says.
00:07:32.000 --> 00:07:36.000
I just wanted to demonstrate geometrically what it is that is going on.
00:07:36.000 --> 00:07:50.000
Again, it is a good idea to see that to get an idea of where it comes from, but again, it is the algebra that matters, because when you move on to higher dimensions, you are not going to quite have the geometric intuition that you can get.
00:07:50.000 --> 00:08:00.000
For example, this works in 2 dimensions. If we were working with a 3-dimensional example, a function of 3 variables, we would have x, y, and z, and then we would be talking about surfaces.
00:08:00.000 --> 00:08:11.000
Where you have one surface and then another surface, the point p that happens to be an extremum is going to be the point where those 2 surfaces actually touching, and the tangent plane to those surfaces is going to be the same.
00:08:11.000 --> 00:08:22.000
So the gradient vector is going to be perpendicular to that tangent plane and the gradient vector, they're either going to be in the same direction, or they are going to be in opposite directions, but they are going to lie along the same line.
00:08:22.000 --> 00:08:32.000
That is it, that is all that I wanted to demonstrate. We are going to do one last example for Lagrange multipliers, except this time what we are going to do is we are going to have 2 constraints instead of 1.
00:08:32.000 --> 00:08:53.000
So, we are going to try to maximize or minimize a function subject not just to 1 constraint, but another. Let us go ahead and do that example. Okay. Example 1.
00:08:53.000 --> 00:09:21.000
So, let us see. A Lagrange multiplier problem with 2 constraints, so I am just going to describe how it is that we actually deal with it before we start the example.
00:09:21.000 --> 00:09:34.000
A Lagrange multiplier problem with 2 constraints, we introduce 2 multipliers, that is it. The number of constraints, you just introduce another multiplier and the equation actually ends up being the same, but just with another multiplier.
00:09:34.000 --> 00:10:03.000
You end up having just another equation to solve. So, introduce 2 multipliers, we will call them λ1 and λ2, so, we must solve the following system.
00:10:03.000 --> 00:10:16.000
Our problem comes down to solving the gradient of f at... let me actually write it all out here, a little further to the left so that I do not have to squeeze anything in.
00:10:16.000 --> 00:10:35.000
The gradient of f at the extrema = λ × the gradient of g1 at p, so now we have 2 constraints, g1 and g2 + λ2 × gradient of g2 at p. That is it.
00:10:35.000 --> 00:10:47.000
We basically just add one more thing. This is the normal one, gradient f = λ × gradient g, but now since we have 2 constraints, g1 and g2, we just add one more term.
00:10:47.000 --> 00:11:10.000
We also solve g1 of x, y, z. I am just going to call it point g1 of x, y, z, and again I am just using a 3-dimensional example = 0, and g2 of x, y, z = 0.
00:11:10.000 --> 00:11:20.000
This system right here is the system we end up having to solve. That is it, just one more equation, and this is our one more equation and this is our one extra term.
00:11:20.000 --> 00:11:24.000
So, now we will go ahead and start the problem.
00:11:24.000 --> 00:11:49.000
The cone z² = x² + y² is cut by the plane z = 1 + x + y in a conic section.
00:11:49.000 --> 00:12:05.000
Hopefully you remember from your algebra and pre-calculus days, and perhaps even in single-variable calculus, when you have a cone in 3-space and you slice through that cone, you are going to end up getting the conic section graphs.
00:12:05.000 --> 00:12:12.000
You are either going to get a circle, you are going to get an ellipse, or you are going to get a hyperbola.
00:12:12.000 --> 00:12:19.000
Or, in certain, special cases, depending you are going to get a straight line. Okay... conic section, alright.
00:12:19.000 --> 00:12:34.000
So, we want to find the points on this conic section, and notice we have not said anything about what this conic section is. We just know that it is a conic section.
00:12:34.000 --> 00:12:38.000
We do not know whether it is a conic section, ellipse, or hyperbola.
00:12:38.000 --> 00:12:56.000
So, conic section that are nearest and farthest from the origin.
00:12:56.000 --> 00:13:11.000
We have this cone in space, we slice it with a plane, and there are going to be points that are on this conic section that are going to satisfy both the equation for the cone and the equation for the plane.
00:13:11.000 --> 00:13:19.000
A couple of those points, or one of those points, however many, some are going to be furthest from the origin, some are going to be closest to the origin, so, that is what we are doing.
00:13:19.000 --> 00:13:28.000
Now, we need to find the function that we are going to maximize in this particular case notice this actually ends up saying nothing about.. it set it in a different form.
00:13:28.000 --> 00:13:35.000
It did not give us the function that we are trying to maximize or minimize explicitly, we have to be able to extract it from the problem itself.
00:13:35.000 --> 00:13:47.000
Well, since we are finding the nearest and furthest point from the origin, we are going to look to the distance function, but we are not going to deal with the distance function as it is with the radical sign.
00:13:47.000 --> 00:13:59.000
We are just going to square that distance function because if you minimize the distance, you are also minimizing the square of that distance, because again, we do not want to deal with radical signs, we want to make the math as tractable as possible.
00:13:59.000 --> 00:14:13.000
Okay. SO the function that we are going to be dealing with, f itself, is going to be a function of 3 variables, and it is going to be the distance function, so x² + y² + z²,
00:14:13.000 --> 00:14:23.000
But again, we do not want to deal with the radical, so minimizing or maximizing this is the same as minimizing or maximizing this, just the square of it. x² + y² + z², so that is our f.
00:14:23.000 --> 00:14:44.000
Now our g1 of x, y, z, that is going to be x² + y² - z²... basically what we do is we take this equation and we move everything over to one side and set it equal to 0... - z² = 0. That is the other equation that we have to satisfy.
00:14:44.000 --> 00:15:05.000
Then of course we have a second constraint, so we also have to satisfy this equation. g(x,y,z) = 1 + x + y -z = 0. That is of course, this equation, again, with everything moved over to 1 side, set equal to 0.
00:15:05.000 --> 00:15:16.000
It always a good idea to write the equation that you are actually dealing with. The f and the particular g's, in this case we have 2 g's that we also need to satisfy.
00:15:16.000 --> 00:15:40.000
Now, we have to solve the gradient of f = λ1 × the gradient of g1 + λ2 × gradient of g2... and I apologize if I kind of keep writing things over and over again.
00:15:40.000 --> 00:15:48.000
I think that it is important to do that because often time in mathematics there is so much going on, we try to take shortcuts by not writing everything down and that is a bad idea.
00:15:48.000 --> 00:16:05.000
Take the couple of extra seconds. If you have to rewrite an equation 2 or 3 times, that is not a problem. It is a good way to solidify it in your mind, to get a good grasp on it. You need to get in the habit of writing things out. The more shortcuts you take, the more chance that you are going to make a mistake.
00:16:05.000 --> 00:16:15.000
Again, as you have already noticed with the last two lessons, these Lagrange multiplier problems, they are not difficult, there is just a lot going on, on the page, so you want to keep track of everything.
00:16:15.000 --> 00:16:26.000
Okay. So, we have to solve this, that is the one equation, so we have to solve g1 = 0, and g2 = 0, so let us go ahead and come up with this one here.
00:16:26.000 --> 00:16:58.000
When we take the gradient of f, we are going to get 2x, 2y, 2z, and again, just a personal taste for me, I tend to write them in terms of column vectors instead of row vectors -- your choice, whatever works best for you -- equals λ1 × the gradient of g1, which is 2x, 2y, and -2z + λ2 × 1, 1, and -1.
00:16:58.000 --> 00:17:02.000
These are the 5 equations that we are going to have to solve simultaneously.
00:17:02.000 --> 00:17:16.000
The first equation, let me do this in blue. We have this equation from the first row, from the second row, and from the third row... so we have... and I am actually going to number these, I am going to refer to them as numbers instead of continuously writing them down.
00:17:16.000 --> 00:17:26.000
So, equation 1, we have 2x = 2λ1x + λ2.
00:17:26.000 --> 00:17:36.000
Equation 2 we have 2y = 2λ1y + λ2.
00:17:36.000 --> 00:17:44.000
Then we have the third equation which is 2z = -2 × λ1z - λ2.
00:17:44.000 --> 00:18:06.000
Then, of course, we have the g1 and g2, so we have x² + y² - z² = 0, and we have 1 + x + y -z = 0.
00:18:06.000 --> 00:18:17.000
These are the... this is the system that we have to solve simultaneously, solve simultaneously
00:18:17.000 --> 00:18:26.000
So, let us just get started. Again, when you are dealing with this many simultaneous equations, there really is no algorithmic approach to this.
00:18:26.000 --> 00:18:38.000
You just have to sort of use all of the resources that you have at your disposal, try a bunch of different things... we do not want to give you the impression that just by looking at this I automatically know what to do.
00:18:38.000 --> 00:18:48.000
I mean, I have already worked this out. When I look at this on a page, I just automatically know do this, do this, do this, do this... it is not like that. We do not want to give you that impression.
00:18:48.000 --> 00:19:04.000
It takes time. It takes some time, it takes some experience. I still struggle with these myself, because, again, you have got 5 equations to solve. You have different cases to consider, different things to look at... so by all means do not worry about the time that it takes and do not worry that it is difficult.
00:19:04.000 --> 00:19:15.000
On an exam of course, it is not going to be something like this. You are going to have something a little bit simpler to work with. These are just bigger problems so that you have a bigger sense of what is going on and more deep practice.
00:19:15.000 --> 00:19:29.000
So, let us see. In this particular case, I am going to go ahead and put equation 1 and equation 2 together, so I am going to take equation 1.
00:19:29.000 --> 00:19:43.000
When I take number 1 - number 2, I get the following... I get x - y = λ1 × x - y, okay?
00:19:43.000 --> 00:20:01.000
When I take equation 2 and I add it to equation number 3, I end up with y + z = λ1 × y - z.
00:20:01.000 --> 00:20:09.000
In this case what I have done is I have essentially reduced this so that now all I have is λ1 and I do not have to worry about λ2.
00:20:09.000 --> 00:20:23.000
Okay. So let us take a look at the first one. So, x - y = λ1 × x - y is satisfied in 2 cases. Excuse me.
00:20:23.000 --> 00:20:49.000
It is satisfied in 2 cases. The 2 cases are when x does not equal y, λ1 = 1, and the other case is when x = y, and λ1 does not equal 1. Let us take these cases individually and see what we can do.
00:20:49.000 --> 00:20:57.000
Okay. So, let us do case 1 first when x is not equal to y. So, case 1.
00:20:57.000 --> 00:21:14.000
So, x does not equal y. When x does not equal y, then this implies that λ = 1, right? You are just taking x - y/x - y, you are getting λ1 = 1.
00:21:14.000 --> 00:21:43.000
Okay. If we put this in for one... okay, now let us take the second equation. So, put this into y + z = λ1 × y - z.
00:21:43.000 --> 00:22:02.000
We get y + z equals y - z, which implies that 2z = 0, which implies that z = 0. Now, since z = 0, let us go ahead and use equation number 4.
00:22:02.000 --> 00:22:18.000
That gives x² + y² = 0, which implies that x = 0 and that y = 0.
00:22:18.000 --> 00:22:35.000
Okay. So, now we have 0, 0, 0. We found a certain point. However, the point (0,0,0) does not satisfy equation number 5.
00:22:35.000 --> 00:22:47.000
Again, all of the equations have to be satisfied, so, we have taken these three equations, we have taken 1, 2, 3, & 4, we have managed to satisfy 1, 2, 3, & 4, but it does not satisfy equation 5.
00:22:47.000 --> 00:23:02.000
So, (0,0,0) is not a viable point here. So, (0,0,0) is not a viable point to consider, so we have taken care of that case. Now, let us go ahead and deal with case 2.
00:23:02.000 --> 00:23:13.000
In case 2, we said that x actually equals y, and that λ1 does not equal 1.
00:23:13.000 --> 00:23:28.000
If we put equations 4 and 5 together, let me see here, so if x = y what we end up with is the following.
00:23:28.000 --> 00:23:47.000
We get z² = x² + y², that is the equation 4, and z is equal to 1 + 2x, because it is 1 + x + y, y = x, therefore it is 1 + 2x.
00:23:47.000 --> 00:24:20.000
Now, let me go ahead and square this, so when I square this and put this into here, I end up with 1 + 2x² = x² + y², but x = y, so it equals x² + x², so I am going to get 1 + 4x + 4x² = 2x².
00:24:20.000 --> 00:24:35.000
Then, I am going to move everything over and basically end up with a quadratic here, so I am going to end up with 2x² + 4x + 1 = 0.
00:24:35.000 --> 00:24:46.000
Notice, in this case I have used both equation 4 and equation 5 so that is satisfied, and this case of x = y, λ1 not equal to 1, that comes from the other equations so all of the other equations are satisfied here.
00:24:46.000 --> 00:25:10.000
When I solve this, I cannot factor it so I have to use the quadratic equation. I am going to end up with x = -4 + or - sqrt(8)/4, which equals -1 + or - sqrt(2)/2. That equals x.
00:25:10.000 --> 00:25:19.000
Well, it also equals y, so, y = the same thing because x = y. Alright.
00:25:19.000 --> 00:25:32.000
Then, when we go ahead and we put in for z, when we put this, this x value up into this equation to solve for z, we are going to end up with the following z value.
00:25:32.000 --> 00:25:43.000
You are going to get z = -1 + or - sqrt(2). I will not go ahead and do that arithmetic, but that is how I go ahead and get it.
00:25:43.000 --> 00:25:52.000
So, I have x, I have y, and we have z. Now let us go ahead and finish this up, so let us see here.
00:25:52.000 --> 00:26:09.000
Let us write it this way. x = -1 + sqrt(2)/2, and it also equals -1 - sqrt(2)/2.
00:26:09.000 --> 00:26:18.000
y is equal to the same thing. -1 + sqrt(2)/2, and -1 - sqrt(2)/2.
00:26:18.000 --> 00:26:42.000
Our z value is equal to -1 + sqrt(2) - 1 - sqrt(2), so these are our 2 points that we found, okay? These are our 2 points. Let us call this one p1, and p2, these (x,y,z), these (x,y,z), these 2 points satisfy all of the conditions.
00:26:42.000 --> 00:27:07.000
Now, okay. Now let us go ahead and write out the conclusions for this. Now, we are looking at either an ellipse or a hyperbola.
00:27:07.000 --> 00:27:22.000
Statistically, when you do this you are going to get an ellipse or a hyperbola. The chances of getting a circle are kind of... you know... that would just mean a plane that is straight across like that, you have a cone and it just cuts across and cuts it in a circle.
00:27:22.000 --> 00:27:28.000
That is not what is happening here so you are definitely looking at either an ellipse or a hyperbola, okay?
00:27:28.000 --> 00:27:57.000
Now, if it is an ellipse, if we have an ellipse, then, p1 is the nearest point -- in other words, it is the minimum of the function f -- is the nearest point, and p2 is the farthest point.
00:27:57.000 --> 00:28:05.000
The way you get that -- again, once you get your points, you put these points back into x. Well, our function x, our function I am sorry was x² + y² + z².
00:28:05.000 --> 00:28:16.000
You put in this squared + this squared + this squared, and then you get a certain value for f at this point, then you put in this squared + this squared + this squared.
00:28:16.000 --> 00:28:29.000
When you do that you will find out that this number is less than this number. That is how we do it... is farthest because f(p1) is less than f(p2).
00:28:29.000 --> 00:28:36.000
So, if this is an ellipse, this is the farthest point, this is the nearest point. Okay.
00:28:36.000 --> 00:28:48.000
If a hyperbola -- there is a lot to consider here, it is kind of interesting, it would be nice if we could just plug our numbers in and get a number and be done, but we have to actually consider what is happening.
00:28:48.000 --> 00:29:16.000
If a hyperbola, then there is no furthest point, then there is no farthest point, because a hyperbola is asymptotic.
00:29:16.000 --> 00:29:27.000
In other words, it goes on into -- you know -- a particular direction infinitely asymptotic.
00:29:27.000 --> 00:29:44.000
So, p1 and p2 are the two nearest points. This is why earlier on I decided to use the word extrema instead of max/min because you never know what situation you are dealing with.
00:29:44.000 --> 00:29:52.000
It is not that you are maximizing or minimizing a function, yes, within a given situation you might be maximizing or minimizing, but in this case we do not know whether we are dealing with an ellipse or a hyperbola.
00:29:52.000 --> 00:30:00.000
If it is an ellipse, then yes, we have a max value and a min value, in other words a farthest point and a nearest point.
00:30:00.000 --> 00:30:09.000
If it is a hyperbola, we do not have a maximum value. What we have is 2 points that satisfy all of the conditions, but they happen to be the two points that are nearest to the origin.
00:30:09.000 --> 00:30:20.000
There are physical things to consider, there are other things to consider than just max/min, it is not just max/min -- the two nearest points. Okay.
00:30:20.000 --> 00:30:30.000
Now, so, that is it. This was just an example of a Lagrange multiplier example using 2 constraints, using 2 particular functions that had to be satisfied.
00:30:30.000 --> 00:30:39.000
In this case our function that had to be satisfied was our distance function, and it had to satisfy the equation of a cone, and it had to satisfy the equation of the plane. That is it.
00:30:39.000 --> 00:30:51.000
Everything else was exactly the same. You are solving the series of simultaneous equations. Once you actually get to a point where you get your points, you have to stop and actually think about what it is that is actually going on.
00:30:51.000 --> 00:31:02.000
This is why we did this final analysis. We have the possibility of an ellipse, we have the possibility of a hyperbola, I am actually going to leave it to you to actually think about which one it actually is.
00:31:02.000 --> 00:31:12.000
To see if you can actually use the equations that are given, the g1, the g2, and the f to figure out are you getting an ellipse, or are you getting a hyperbola.
00:31:12.000 --> 00:31:32.000
So, I will leave it with this: see if you can figure out which -- and I will give you a hint, try converting the functions into cylindrical coordinates, if you happen to be familiar with cylindrical coordinates.
00:31:32.000 --> 00:31:43.000
If not, do not worry about it. It is not a big deal. We do not actually have to figure out, all we wanted to do was find out which was furthest, which was closest, we found our two points, the actual problem itself is satisfied.
00:31:43.000 --> 00:31:47.000
Okay. Thank you very much for joining us here at educator.com. We will see you next time. Bye-bye.