In this part we’ll cover the method of Lagrange multipliers. This is a strategy, for finding local minimum/maximums for a function with a constraint.
Let’s define it properly
Setup
Say we have a function, f(x,y), which we want to find the min/max points. But this function is subject of some constraint of the form, g(x,y)=k.
Recall our rectangular box problem from the last part:
V(x,y,z)=xyz2zx+2zy+yx=12
So if it’s difficult to try to rewrite this using only two variables, we can instead use this method.
Let’s first get a geometrical sense.
Geometrical sense of Lagrange multipliers
If min/max of f, is subject to constraint, g(x,y)=k, which occurs at (x0,y0), then the level curve containing (x0,y0) must touch the constraint curve.
If two curves are touching at (x0,y0), in other words they have a common tangent line at (x0,y0).
Which is just equivalent of saying that they have a common perpendicular line at (x0,y0), and what do we know which is orthogonal to the level curve?
The gradient.
Therefore, this means:
∇f(x0,y0)∥∥∇g(x0,y0)
If two vectors are parallel, it’s equivalent of saying:
∇f(x0,y0)∥∥λ∇g(x0,y0)
All of this assuming that ∇g=0
Let’s properly define our method now.
Algorithm (Lagrange multiplier method)
To find minimum/maximum values of function, f, subject to constraint, g(x,y)=k, assuming minimum/maximum points exists and ∇g=0
Find all numbers x,y and λ, such that:
∇f(x,y)=λ∇g(x,y)=k
Compute values from step 1, choose the minimum/maximum value(s).
Let’s do an example.
Example 1
Find the extreme values of, f(x,y)=xy on the disc, x2+y2≤1.
Step 1 - Find critical points (as usual):
∇f=0⟨y,x⟩=0
Which means:
{y=0x=0
So we have a critical point at (0,0). Let’s compute the value:
f(0,0)=0
Step 2 - Find absolute minimum/maximum values on boundary.
Since we have a unit circle, with equation, x2+y2=1, we can view this as a constraint.
g(x,y)=kx2+y2=1
Let’s first see if all our assumptions hold, since this is a bounded closed set, by the extreme value theorem, absolute values must exists. So we know that they exists.
Let’s check that ∇g=0:
∇g=⟨2x,2y⟩
Which is only 0 at (0,0) which isn’t on the boundary of the circle.
So we can try our new method!
{⟨y,x⟩=λ⟨2x,2y⟩x2+y2=1
So we have a vector that must be equal to another vector, this means they share coordinates.
So, we have finally found our minimum and maximum values, −21 and 21, respectively.
Remark 1
A little remark, it is important that the constraint has to be of the form g(x,y)=k. For example, our rectangle problem from last time, we can not describe a rectangular box in that form.
So no lagrange multiplier there.
Let’s look at more difficult example.
Example 2
Find the points on the sphere, x2+y2+z2=4, that are closest and furthest from the point (3,1,−1).
So we have to calculate the distance between these points, or in other words:
d(x,y,z)=(x−3)2+(y−1)2+(z+1)2
But this function isn’t really that pleasant, so instead, let’s calculate the distance squared, or:
d(x,y,z)=(x−3)2+(y−1)2+(z+1)2
We can work with this function instead, so let’s use our method. Let’s first compute gradients: