WEBVTT mathematics/multivariable-calculus/hovasapian
00:00:00.000 --> 00:00:04.000
Hello and welcome back to educator.com and Multivariable Calculus.
00:00:04.000 --> 00:00:09.000
Today's topic is going to be Lagrange multipliers. This is a very, very important topic.
00:00:09.000 --> 00:00:19.000
Because it is very important, we are actually going to be spending several lessons on it. In this particular lesson, what I am going to do is write out the theorem and the method.
00:00:19.000 --> 00:00:33.000
Then we will start with a couple of basic examples, just to get the underlying technique under our belts. Then the following lesson, I am actually going to be spending some time on just more examples, slightly more complicated, a little bit more involved.
00:00:33.000 --> 00:00:44.000
Again, this a very powerful technique for finding maxima, minima, on a restrained... the maximum and minimum of a function constrained in some sort of way.
00:00:44.000 --> 00:00:55.000
So, In and of itself, it is not that difficult because, really all you are doing is you are solving a bunch of simultaneous equations. Whether it be 2 equations, 3, 4, or 5 depending on how many variables you are working with.
00:00:55.000 --> 00:01:14.000
The problem with this is there just tends to be a lot of things on the page, so there is a lot to keep track of, so again, just go slowly, make sure everything is written out, do not take any short cuts, aside from that let us just jump right on in and get a sense of what is going on.
00:01:14.000 --> 00:01:25.000
I am just going to start out by writing the theorem and then from the theorem I am going to use that just to write out the quick method, then we will go ahead and start the examples.
00:01:25.000 --> 00:02:11.000
The theorem is going to be a bit on the long side, but it is important, so let g be a continuously differentiable function -- all that means is when you differentiate it, you get a continuous function -- continuously differentiable function, on an open set u.
00:02:11.000 --> 00:02:43.000
Now, let a be the set of points in u. Let me actually give the points a name, the set if points x in u, so we are talking about a vector, a point in n space, such that g of x equals 0.
00:02:43.000 --> 00:03:05.000
This is a very, very important hypothesis, but the gradient of g at x does not equal 0. So it is just really, really important that on this particular set of points that we are dealing with that this gradient of this function g not be 0.
00:03:05.000 --> 00:04:05.000
Essentially we are just saying that it is smooth. That is all. Now, let f be a continuously differentiable function on u, and let p be a point in a, such that p is an extremum, in other words it is a maximum or minimum, an extremum for f.
00:04:05.000 --> 00:04:47.000
That is, let p... let us write it this way... p is an extremum for f subject to -- let us not use the word subject, let us use the word constrained, because that is exactly what we are doing for f -- constrained by g.
00:04:47.000 --> 00:04:57.000
Then... and again do not worry about this, this is just a formality to write it, it is just something that we might occasionally refer to, it is the method that is important, but I want you to see the formality.
00:04:57.000 --> 00:05:26.000
Then, there exists a number -- traditionally we use the Greek letter λ for that -- such that... here is the important part... the gradient of f evaluated at p = λ × the gradient of g evaluated at p.
00:05:26.000 --> 00:05:32.000
So, as far as what this means geometrically, I will be talking about that a little bit later in subsequent lessons.
00:05:32.000 --> 00:05:43.000
Probably not the next lesson, but the one after when we do... after we have done all of our examples, we are actually going to go back and think about them geometrically and I am going to talk about what this really means.
00:05:43.000 --> 00:05:58.000
But again, right now I just want to get the technique under our belts. Just getting used to how we use Lagrange multipliers to find the maxima and minima on functions constrained by a certain other function, g.
00:05:58.000 --> 00:06:13.000
Now, since this is the formal theorem, so these are the important parts right here, the gradient -- and again we are only concerning ourselves with situations where the gradient g at a given x is not equal to 0 -- again, smooth g.
00:06:13.000 --> 00:06:21.000
Later on, if you go on into higher mathematics, you will talk about cases where this is not the case, but for right now we want to keep it nice and straight forward.
00:06:21.000 --> 00:06:35.000
So this is really the important thing right here. Gradient of f evaluated at p = λ × gradient of g evaluated at p where p happens to be the max or min for the function f.
00:06:35.000 --> 00:06:43.000
Now, let us describe the actual method and let us do some examples.
00:06:43.000 --> 00:07:18.000
Let, and again, we are mostly going to be working in 2 and 3 variables just to keep things normal for us, so, let f(x,y,z) and g(x,y,z) be defined and continuously differentiable.
00:07:18.000 --> 00:08:17.000
To find the max and min -- or min -- values of f subject to the constraint g, find the values of x, y, z, and λ that simultaneously satisfy the equation, this thing right here.
00:08:17.000 --> 00:08:35.000
Gradient of f = λ × the gradient of g, and g(x,y,z).
00:08:35.000 --> 00:08:45.000
So in other words, what we are going to do is we are going to actually take... we are going to form this equation and we are going to get a series of equations from there and then we are also going to deal with the equation g(x,y,z) or g = 0.
00:08:45.000 --> 00:08:52.000
When we solve those simultaneous equations, we are going to get values for x, y, z, and λ, where the x, y, z, those are the choices that allow for the x, y, z.
00:08:52.000 --> 00:09:00.000
Those are the choices that allow for max and mins. We evaluate that function at the x, y, z, to see which number is highest, which number is lowest. That is all that is going on here.
00:09:00.000 --> 00:09:09.000
So let us just go ahead and jump into some examples and I think it will start to make sense, as well, when we look at examples.
00:09:09.000 --> 00:09:20.000
Again, we are going to do a large number of these examples. This is very, very important. Example 1.
00:09:20.000 --> 00:09:32.000
There tends to be a lot going on with Lagrange multipliers. Lots of symbols on the page and sometimes it is not very easy to keep track of, nothing difficult, just a lot to keep track of.
00:09:32.000 --> 00:10:00.000
Okay. Find the largest and smallest values that f achieves subject to g.
00:10:00.000 --> 00:10:18.000
Well, f(x,y) = the function xy, and g(x,y) = x²/8 + y²/2 = 1.
00:10:18.000 --> 00:10:26.000
Let us just stop and think about what this means when we say find the largest and smallest values that f achieves subject to g.
00:10:26.000 --> 00:10:39.000
In the previous lessons when we talked about max, min. We either talked about a closed domain, or we talked about an open set. Maybe all of -- you know -- our particular space that we were dealing with.
00:10:39.000 --> 00:10:49.000
Here what we are doing is we are saying find the maximum and minimum value of the function, but we are going to put a constraint on that. We want the values of x and y to satisfy this equation also.
00:10:49.000 --> 00:10:53.000
That is what we mean by a function f constrained by g.
00:10:53.000 --> 00:11:11.000
In other words, this function, you know the function x, y is perfectly defined on here except... well actually no, this is defined everywhere... but here what they are saying is this is an equation of an ellipse.
00:11:11.000 --> 00:11:28.000
They want us to find the values of x and y. So x and y have to be on this ellipse and then of all the points x and y on this ellipse, which ones maximize the function, which ones minimize the function. That is what we are talking about.
00:11:28.000 --> 00:11:39.000
We are constraining the x and y values. We are saying that is not just any x or any y. I am going to put a constraint on the x and y. They also have to satisfy this equation, that is all that is going on.
00:11:39.000 --> 00:11:45.000
In this case it is just one constraint, you can have two, three, four constraints, as many as you need depending on the problem.
00:11:45.000 --> 00:11:53.000
Okay. So find the largest and smallest values of f(g) subject to g. That is our f, that is our g, well, let us just go ahead and do it.
00:11:53.000 --> 00:12:12.000
What we are going to do... we are going to find the gradient of f, and then we are going to set it equal to λ × the gradient of g, and then we are going to solve a series of equations along with this equation equal to 0.
00:12:12.000 --> 00:12:30.000
Alright. So let us do the gradient of f. Let us just do this systematically. Let us see, so df/dx is equal to y, and df/dy is equal to x.
00:12:30.000 --> 00:12:40.000
I am going to write this as a column vector. Again, the gradient is a vector, so instead of writing it horizontally, I am going to write it vertically. You will see why in a minute... y, x.
00:12:40.000 --> 00:12:49.000
I mean it is a personal choice for me simply because I like the way it looks on a page. You can arrange it in whatever way looks good to you and what is comfortable.
00:12:49.000 --> 00:13:11.000
So, y, x. So now let us do dg/dx, so let us find the gradient, alright? The partial derivative with respect to x is going to be 2x/8, which is x/4.
00:13:11.000 --> 00:13:14.000
dg/dy is going to equal to 2y/2, that is equal to y.
00:13:14.000 --> 00:13:48.000
This one is x/4 and y. I will write that as a column vector, so now we are going to form the gradient of f equals λ × gradient of g. So we write y, x, equals λ × well x/4y, which equals... we multiply the λ across both.
00:13:48.000 --> 00:13:58.000
So we get λ × x over 4, and we get λ y. Here we go. Now we have our 2 equations.
00:13:58.000 --> 00:14:15.000
Our 2 equations are... let me do this in red... this thing equal to that thing, so we have y is equal to λ × x over 4, and we have this thing equal to this thing.
00:14:15.000 --> 00:14:24.000
That is why I arranged it in a column, it is just a little bit easier for me to the correspondence. The first entry - first entry, second entry - second entry.
00:14:24.000 --> 00:14:53.000
I also have x = λ × y, and of course my third equation which is... remember we said the third equation in this series of equations is this, this, the gradient of f = λ × gradient of g, and of course we have the have x²/8 + y²/2 - 1 = 0.
00:14:53.000 --> 00:14:59.000
We want g to equal 0, so that is why I brought the 1 over onto this side. That is all I am doing.
00:14:59.000 --> 00:15:16.000
Okay. So now, let us go ahead and well, let us see what we can do. Let us solve. This is the system that we have to solve, so we need to find λ and we need to find x and we need to find y.
00:15:16.000 --> 00:15:48.000
So, let us see what we have got. Let me rewrite these... y = λx/4, and I have got x = λy and I have x²/8 + y²/2 equals -1 = 0.
00:15:48.000 --> 00:15:52.000
So, the x, the y and the λ they have to satisfy all three of these equations.
00:15:52.000 --> 00:16:05.000
Let me go ahead and take care of this one, so let me see. 1 - λx... y, I am going to move this over... so, y - λx/4 = 0.
00:16:05.000 --> 00:16:24.000
Well here, x = λ y, so I am going to go ahead and put this x into here. That gives me y - λ × λy/4 = 0.
00:16:24.000 --> 00:16:34.000
I get y - λ²y/4 = 0. Let me come over here so that I can use more of the page. Let me go ahead and factor out a y.
00:16:34.000 --> 00:16:44.000
I get y × 1 - λ²/4 = 0, so I have two solutions for y.
00:16:44.000 --> 00:17:09.000
I have y = 0 -- excuse me... let me see here -- and 1 - λ²/4 = 0, so I get 1 = λ²/4 = 0. That means that λ + or - 2.
00:17:09.000 --> 00:17:21.000
Now. I have two possibilities. I have y = 0, λ = + or - 2. Let us just deal with one case at a time. That is what you are going to be doing with these Lagrange multiplier problems.
00:17:21.000 --> 00:17:27.000
You are just going to be dealing with one case at a time. This is where it starts to get a little interesting. You have to be very careful to choose your cases properly.
00:17:27.000 --> 00:17:52.000
So, case 1... we have y = 0. Well, if y = 0 this implies that x = λ × y, x = λ × 0. That means that x = 0.
00:17:52.000 --> 00:17:59.000
Okay. That is one possibility. Now we have the point (0,0), but now the problem is we also have to satisfy this third equation.
00:17:59.000 --> 00:18:17.000
If I put this equation x, 0, y, 0 into this third equation, x²/8 + y²/2, 0 and 0. What I end up with is... well, the thing is this point (0,0), is not on this ellipse. That is a problem.
00:18:17.000 --> 00:18:29.000
Even though we ended up with this possibility, because it is actually not on this ellipse, it is not part of the... we cannot use this point, we cannot test this point, so this one is out. We do not have to deal with that.
00:18:29.000 --> 00:18:36.000
Now we will deal with the other case. The other case where λ = + or - 2.
00:18:36.000 --> 00:19:00.000
So, case 2. λ = + or - 2. Now, let us see... from the equation... from this equation right here, x = λ × y.
00:19:00.000 --> 00:19:20.000
We get x = + or - 2 × y. Okay, so now, I am going to go ahead and take this and the value of y and I am going to use this equation.
00:19:20.000 --> 00:19:39.000
I am going to form, so it is going to be + or - 2y, I am basically going to put this value of x into x² into here... squared over 8 _ y²/2 - 1 = 0.
00:19:39.000 --> 00:20:17.000
Here I am going to get 4y²/8 + y²/2 - 1 = 0, and I am going to get... I am going to just multiply everything by 8 here, so I am going to end up with 4... let me do it over here... going to end up with 4y² + 4y² - 8 = 0.
00:20:17.000 --> 00:20:33.000
So, I am going to get 8Y² - 8 = 0, I am going to get y² = 1, which implies that y = + or - 1.
00:20:33.000 --> 00:20:54.000
Now, if y = + or - 1, and I go back to one of my original equations, that implies that x is equal to + or - 2. There we go. I have found x's and y's that actually satisfy this third equation, so these values work.
00:20:54.000 --> 00:21:17.000
Now I have 4 possibilities. My first point is (+2,+1). My second point is (-2,+1). My third possibility is (+2,-1), and my fourth point is (-2,-1).
00:21:17.000 --> 00:21:23.000
Now what I am going to do is I am going to evaluate the function at those points. So that is what I am doing.
00:21:23.000 --> 00:21:43.000
So, f(p1) is going to equal, 2 × 1 is 2, f(p2) is going to equal -2, f(p3) is going to be -2, and f(p4) is going to equal 2.
00:21:43.000 --> 00:21:59.000
That is it. Our max's are achieve there. Our mins are achieved here. A maximum at (2,1) and (-2,-1), and the minimum of that and that. That is the method of Lagrange multipliers.
00:21:59.000 --> 00:22:23.000
Let us do another example. Okay. So, let us see here. Example 2... oops, let me go back to black ink, actually... well, actually, you know what? Let us do this one in blue. How is that? Okay. Example 2.
00:22:23.000 --> 00:23:03.000
Find the max and min values of f, let me do it over here, f(x,y) = 3x + 4y on the circle x² + y² = 1.
00:23:03.000 --> 00:23:11.000
okay, so one thing you should know about these max, min problems... and we will get more of a taste for this when we do some more examples in the next lesson... the problems are not written out the same way.
00:23:11.000 --> 00:23:30.000
Oftentimes you are given information that looks like a Lagrange multiplier problem, but you have to extract information. In other words you have to extract what f is, extract what g is. It is not always going to say find the maximum and minimum values of f subject to g.
00:23:30.000 --> 00:23:35.000
It is not going to be as explicit like this, but again we will see more examples like that.
00:23:35.000 --> 00:23:50.000
okay, so find the max and min values of this function on the circle x² + y². So all this means is that this function, 3x + 4y is defined for the entire plane, but we want to constrain it.
00:23:50.000 --> 00:24:01.000
We want to find the max and min values on the circle. So, somewhere, some point on this circle is going to maximize this function and some point on this circle is going to minimize this function.
00:24:01.000 --> 00:24:20.000
So f subject to the constraint g. Okay, let us see here. What shall we do first? Well, okay. We are going to do what we always do.
00:24:20.000 --> 00:24:27.000
We are going to take the gradient of f, and we are going to set it equal to λ × the gradient of g, okay?
00:24:27.000 --> 00:24:43.000
We are also going to have this set of equations, and we are also going ot have g, in this case x, y = 0. That is our last equation. We have to satisfy these two equations... or this set of equations.
00:24:43.000 --> 00:25:00.000
So, the gradient of f, this one is going to be... so the partial derivative with respect to x is going to be 3, the partial derivative with respect to y is 4, so we have 3, 4 = λ × gradient of g.
00:25:00.000 --> 00:25:19.000
That is going to be 2x -- let me make this a little bit better -- Is going to be 2x... and this is going to be 2y, so we have λ... or I will write 2λx and 2λy. So there you go.
00:25:19.000 --> 00:25:36.000
This corresponds to that, this corresponds to that, so we have the equation 3 = 2 × λx, and we have 4 = 2 × λy.
00:25:36.000 --> 00:25:48.000
Yes, that is exactly right... and of course we have the g(x,y) = 0, so we are going to get x² + y² - 1 = 0.
00:25:48.000 --> 00:25:53.000
This is our set of three equations and three unknowns, x, y, and λ.
00:25:53.000 --> 00:26:03.000
We have three equations and three unknowns, theoretically this is solvable. Now we just have to find x, y, and λ... ultimately x and y, but we have to find λ along the way.
00:26:03.000 --> 00:26:21.000
So let us see what we have got here. I think the best way to approach this is since we have this equation, and we have this, I am just going to go ahead and solve each of these equations, 1 for x and 1 for y.
00:26:21.000 --> 00:26:40.000
So in this particular case, x is going to equal... well I am going to divide by 2λ, so it is going to be 3/2λ, and y, when I divide by 2λ, it is going to be 4/2λ, which is equal to 2/λ.
00:26:40.000 --> 00:26:59.000
So now I have x... oops, these crazy lines showing up all over again, alright... λ, this is 4... so I have x and I have y, and now I am going to take these values of x and y, and I am actually going to put them into this equation to see what I get for λ.
00:26:59.000 --> 00:27:14.000
So let us go ahead and do that. Let us do that on the next page. So, I have the function x² + y² + 1 = 0, and we said that x = 3/2λ.
00:27:14.000 --> 00:27:38.000
This is going to be 3/2λ² - 1 = 0. So let us go ahead and work all of this out. 9/4λ² + 4/λ² -1 = 0. We are not going to leave anything out here.
00:27:38.000 --> 00:27:52.000
I am going to go ahead and multiply through by 4λ², I think... no, just 4... yea, 4λ².
00:27:52.000 --> 00:28:07.000
So, when I multiply by 4λ², I am going to get 9 over here, I am going to get 16 over here, -4λ² = 0, just to get rid of the denominator, that is all I did.
00:28:07.000 --> 00:28:27.000
9 + 16 is 25... that equals 4λ², so λ² = 25/4, therefore λ = + or - 5/2. Okay, so we found λ, now it should be not a problem.
00:28:27.000 --> 00:28:53.000
Now that we have found λ, well, x = 3/2λ, so when I put that in there, that is going to end up equaling... well, let us do it all, let us not miss anything here... 3/2 × + or - 5/2. It is going to end up equaling + or - 3/5.
00:28:53.000 --> 00:29:10.000
Now, y = 2/λ, which is equal to 2/ + or - 5/2, which equals -4/5, and I hope I have done my arithmetic correctly.
00:29:10.000 --> 00:29:16.000
Now, let us stop and think about this. We have + and - 3/5 for x, and we have + or - 4/5 for y.
00:29:16.000 --> 00:29:30.000
You are probably thinking to yourself, just like the previous problem, that we have 4 points: (3/5,3/5), (3/5,-4/5), (-3/5,4/5), (-3/5,4/5).
00:29:30.000 --> 00:29:39.000
That is actually not the case. This is where you have to sort of look at other things. There is other analyses going on here.
00:29:39.000 --> 00:29:53.000
x = 3/2λ, y = 2/λ. x and y have the same sign, so they are either both positive, or both negative. So, we do not have 4 points to pick, we only have 2 points to pick, 1 in the first quadrant, 1 in the third quadrant.
00:29:53.000 --> 00:30:02.000
That is what is going on here. You can go ahead and use the others, it is not a problem, you will go ahead and get the answer... but you know, just something to be aware of.
00:30:02.000 --> 00:30:31.000
So, that is it. Basically our points that we are going to pick are... let us see... (3/5,4/5), that is one possibility... and (-3/5,-4/5), that is the other possibility.
00:30:31.000 --> 00:30:58.000
Okay. When I take... let us just call this P1, and let us call this P2... so when I take f(p1), in other words I put it back into the function 3 × 3x + 4y, 3 × 3/5... well you know what, let me work it all out. It is probably a good idea if I work it all out.
00:30:58.000 --> 00:31:39.000
I will do it on the next page, so we will do f(3/5,4/5), that is going to equal 3 × 3/5 + 4 × 4/5 = 25/5... that is going to equal 5... and f(-3/5,-4/5) = 3 × -3/5 + 4 × -4/5 = -25/5 = -5.
00:31:39.000 --> 00:31:52.000
So, here, at the point (3/5,4/5), it achieves a maximum -- the maximum value is 5 -- and (-3/5,-4/5), the function f achieves a minimum of -5.
00:31:52.000 --> 00:32:06.000
We have found the maximum and minimum values of 3x + 4y, subject to the constraint that x and y lie on the unit circle. x² + y² = 1, that is what is going on.
00:32:06.000 --> 00:32:14.000
So, again, in the next lesson we are going to continue on with more examples of Lagrange multipliers because we want to be very, very, very familiar with this.
00:32:14.000 --> 00:32:18.000
Then, after that, we will pull back a little bit and take a look at exactly what is going on.
00:32:18.000 --> 00:32:23.000
We want to make sure that you actually understand why this is the case, and why this works.
00:32:23.000 --> 00:32:29.000
Again, nothing theoretical, we just want to make it plausible for you, that this is not some technique that just drops out of the sky.
00:32:29.000 --> 00:32:32.000
Thank you for joining us here at educator.com, we will see you next time. Bye-bye.