A common problem that arises in applications is the need to optimize a function under a constraint. This means wanting to do something like find which dimensions of a cylindrical aluminum can has the least surface area (and thus requires the least amount of material to produce) for a given volume.
The method of Lagrange multipliers has two requirements:
Let the function to be optimized be f and the constraint be g. Our constraint is given by g(x)=k for some fixed value k. What we want to find is a level curve of the function f which gives the largest (or smallest) possible value when it intersects g(x)=k. That is find the largest (or smallest) c for which f(x)=c intersects g(x)=k. This intersection will occur when the tangent lines of both of these level curves at a point are parallel, and so this tells us that their gradients must be parallel. Taking advantage of this requirement that the gradients must be parallel, we can define the following method of optimization:
Method of Lagrange Multipliers ¶
The minimum and maximum values of a function f(x) under the constraint g(x)=k for some k∈R (assuming that the extrema exist and ∇g≠0 on g(x)=k) may be found by the following procedure:
- Determine all values of x1, x2,... xn, and λ which satisfy in the conditions
∇f(x)=λ∇g(x)g(x)=k
- Evaluate f at all points x found in the first step. The greatest value of f is the maximum and the smallest value of f is the minimum.
In the aluminum can example, we optimize for minimal surface area under a fixed volume.
Suppose a soda company is making cylindrical aluminum cans and these cans are designed to hold 355 mL of soda. What is the height and radius of a cylindrical can that holds 355 mL with the minimum surface area?
The surface area of a cylinder is
A(h,r)=2πr2+2πrh
Two notes as we get started:
- For solving systems that arise from Lagrange multipliers, there is no consistent approach that works. Every problem requires examining the resulting system and puzzling out the best way to find the solution.
- The Lagrange multiplier λ is here to help you solve the problem, but you don't always need to find a specific value for it. Sometimes you'll see that is must be one of a couple of specific values and other times you won't need to know anything particular about it. This is something that comes naturally from the system once it is formed. If you can find all of the solutions (all (h,r) in this example) without determining λ, that is OK.
Taking the first equation, we can see that a factor of πr divides out and we see that λ=2r. Plugging this into the second equation,
4πr+2πh=2(2r)πrh=4πh4πr=2πh2r=h
It is not possible to always draw pictures that fully represent the optimization process for Lagrange multipliers, but it can be done in simpler cases. Take the following example of the function f(x,y)=e−2(x2+y2) and the constraint g(x,y)=(x−1)2+(y−1)2=0.25. Plotting both of these surfaces and examining the intersection, we have
Since one of these surfaces may be represented in the form g(x,y)=k, their intersection shows the set of candidate points for optimizing f. Geometrically, we can see that the value of f under the constraint are larger nearer the origin.
Use Lagrange multipliers to find the maximum and minimum values of
f(x,y)=e−2(x2+y2)
We begin by setting ∇f=λ∇g and using our constraint to find the system
fx=−4xe−2(x2+y2)=2λ(x−1)=λgxfy=−4ye−2(x2+y2)=2λ(y−1)=λgy(x−1)2+(y−1)2=14
Our previous image is repeated with the extrema we just found plotted so that we may visually verify our result.
Find the optimal values of f(x,y,z)=exyz under the constraint 2x2+y2+z2=24.
Optimization problems may also be presented with multiple constraints. In these cases, gradient of the function to be optimized is set equal to a linear combination of the constraint functions. To optimize f(x) under the constraints g(x)=k and h(x)=c we use the system
∇f(x)=λ∇g(x)+μ∇h(x)g(x)=kh(x)=c
Find the maximum and minimum volumes of a rectangular box whose surface area is 1500 cm2 and whose total edge length is 200 cm.
The volume of a rectangular box is V=lwh, its surface area is A=2lw+2wh+2lh, and its total edge length is L=4l+4w+4h. Our expression using Lagrange multipliers looks like
∇V=λ∇A+μ∇L
Taking the difference of the first two equations in our system
wh−lh=2λ(w+h)+4μ−(2λ(l+h)+4μ)(w−l)h=2λ(w−l)h=2λ
By symmetry, this would work if we took either w or h to be the side with a distinct length.
Creative Commons Attribution-NonCommercial-ShareAlike 4.0
Attribution
You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
Noncommercial
You may not use the material for commercial purposes.
Share Alike
You are free to share, copy and redistribute the material in any medium or format. If you adapt, remix, transform, or build upon the material, you must distribute your contributions under the
same license
as the original.