All right quick shameless plug for my website there it is in this video. We're going to talk about finding Max and mins
using Lagrangian multipliers
so
The basic idea is you're again trying to find a maximum or minimum of a function? [I] wrote [it]
Generically depending on three variables my actual first example
I'm just going to use [two], but the idea is going to be the same it's going to be subject to
another equation
Involving x Y&Z that's going to equal some number
And this is what's called your constraint so we'll make some more sense out [of] this I [think] in our actual concrete example
The basic idea and you can do this stuff
If you've seen gradient notation and things like that you can use all that, but I'm going to do it. I mean it's equivalent
I'm going to do it without it though
so what you do is you form a new function that depends on x y z and the symbol lambda and
To get that new function you just take whatever you're trying to maximize or minimize
And you subtract away the original constraint you set it equal to zero though, and then you also multiply that by Lambda
so that's how you come up with this new function and
Then you basically this new function you take partial derivatives of that with respect to x y z and lambda whatever your variables are
set it equal to zero this is going to be the tricky part usually because you're going to get a big system of
Equations that you have to solve and in general
There's just no procedure to you know solve a generic system of equations
If they're linear you can use matrices things like that, but in general that will not happen
and then once you get your solutions from the system you just plug them back into your original function and
That's either going to give you a maximum or a minimum
All right
So let's do a concrete example here to make some sense out of this
so just [kind] of a little bit of a word problem to put it in context I guess so
Suppose you make TV sets at two different factories will call them factory a and Factory B suppose
You're making portable TVs and plasma TVs who cares
Suppose you make x TVs at Factory a y TVs at Factory B
and the cost giving by the production of x
TVs and y TVs is this function 6x squared plus 12y squared?
Now suppose you have to produce 90 TV sets [a] month and what you're trying to do is figure out well
How many of x should you produce and how many of y should you produce?
so that you meet that requirement of 90 exactly 90 TV sets but
Obviously in this case you're going [to] want [to] keep your cost to the minimum. Okay [unless] [you're] a bad business guy or gal
[we'll] assume though. We're not because hey we're smart people. We're taking calculus, so probably want to minimize this function
okay, [so] what I'm going to do on this again is I'm basically going to
Do like I said in the last part you take whatever function. You're trying to maximize or minimize
and
Then you subtract away, lambda times your constraint and notice in this case our constraint since we have to produce
90 TV sets
Our constraint would be that well the number of TV sets from Factory a plus the number of TV sets from Factory B
Turn on the light here. Sorry about that
That would have to equal well 90
What you do with this?
Constraint again though is you want to make one side [equal] to 0 so I'm going to write this as x plus y?
minus 90
And now I'll have 0 on the right side and in this case. This is my function
Well, it's not in terms of xy and z but it is in terms of x y and the symbol lambda
[okay]
So what I get to do now is I should take partial derivatives of all of this
So maybe I'll just multiply it out first to make it a little clearer
So I'll get minus lambda x minus
Lambda Y
plus 90 times Lambda
Okay, and now I'm going to take partial derivatives
So the partial derivative with respect to x remember, we're treating now y and lambda as constants
I'll get 12x my 12 y squared will go away. I'll get a minus lambda and then everything else will disappear
if I take the partial derivative with respect to y, I'll get
24 y
minus Lambda everything else will disappear
and then if I take the partial derivative whoops almost [over] [to] z with respect to Lambda
The x squared the y squared's will disappear. It looks like I'm going to get a minus x term a
minus y term
plus 90 okay, [so] now what we [have] to do is we [actually] set each of these equal to 0 and
we solve
ok so if I set this first one equal to 0 if I solve this for x
notice I could add Lambda to both sides and
Get that x equals LAmbda over 12
If I do that to the middle one as well, I'll add lambda to both sides and [divide] by 24
And I'll get that y equals lambda over 24
now what I'm going to do is I'm going [to] take these two things and plug it [into] [my]
Other partial derivative [ok] and what this is going to allow [me] [to] do is it will allow me to solve for Lambda
[I'll] then be able to go back and figure out values for x and y
okay, so if I plug in that x is negative
Well, it's negative Lambda over 12 minus Lambda over 24 plus 90 equals 0
and
now on the left side you could simply get
Common denominators multiply top and bottom of the first one by two on top you would get negative three Lambda over 24
I'm going to subtract the 90 and get negative 90 on the right side if
You divide both sides by negative three we'll get that lambda over
24
equals
Looks like positive 30 to me whoops squeeze it in there and multiply both sides by 24
And you'll get that lambda equals 720
All right, so now at this point
I'm going to plug lambda back into my x and y [values] because after all I'm trying to find values for x and y that
maximize or minimize
So if I plug [that] back in I'm going to get that x equals lambda
Which is 720 over 12? I'll get that y equals okay. That was LAmbda over 24
So I'll get 720 over 24 and you can simplify both of these down it looks to me like x should equal 60
Y [should] equal 30
Okay, typically what you do once you have values for x and y you may find more than one pair. That works here
We're only finding a single pair
60 comma 30 and what you need to do is you need to plug those back into the original equation [and]
So the thing you're trying to minimize or maximize in this case, we're trying to
Minimize this cost function 6x squared plus 12y squared
Well the cost of making 60 TV sets times 30 and 30 of the other TV sets will be 6 times
60 Squared
Plus 12 times
30 Squared and
to justify that this in if this at this point does either has to be [a]
Maximum or a minimum if you wanted to to justify that it's a that
It's a minimum cost you could also take just some other random point
Maybe you make [61] of the other TV sets from Factory a which means you only make 29 from Factory B
Plug that in - this cost equation, and you'll see that
the value you get out
When you plug in 61 and 29 you'll actually find out that this cost is greater
than the cost
We found up here when you make when you plug in 60 and 30
So since you can actually make the cost greater that in fact now
Justifies that well this it was either a maximum or a minimum. Well we can make it bigger. So okay
We've [now] reduced it to the fact that this must be a minimum. Okay, so this is the basic [idea] with
Lagrange's
[the] only thing that's going [to] be trickier again is if you have more variables floating around you're going to get more partial derivatives
You're going to have more variables floating around your equations more than likely and again solving the system of equations
[to] me turns out to [be] the tricky part in general, so this one wasn't [so] bad
I was trying to take a straightforward [example], but um sometimes you have to be pretty clever and
definitely, there's times where I look at them and get stuck myself, so
this is the tricky part again, whatever values you find for [X&y] you should plug those back into your
whatever, you're trying to maximize or minimize, and then just justify that that is a maximum or a minimum, so
Again, you can do this stuff using gradient notation and some other notation I prefer this notation myself
But um you know use whatever you're comfortable with I'm going to do another one as well using
Xy z-- and z so take a look for that. [I] hope this helps if you have any questions, shoot me an email
I'll be happy to get [to] them as soon as I can