Lagrange multipliers, step by step
6 min read
Short answer
To maximize or minimize subject to , solve together with . Then evaluate at every solution: the largest value is the maximum and the smallest is the minimum on the constraint.
The geometric idea
Walk along the constraint curve. As long as the level curves of cross your path you can still go uphill by moving along the constraint. The extreme point is where a level curve of just touches the constraint without crossing. There the two curves share a tangent, so their normals, and , are parallel: .
The recipe
- Write the constraint as .
- Set , giving one equation per variable.
- Add the constraint equation.
- Solve the system, keeping all solutions.
- Evaluate at each candidate and compare.
On a closed bounded constraint curve (like a circle) the maximum and minimum are guaranteed to exist, so they will be among your candidates.
Worked example
Find the maximum and minimum of on the circle .
and . The equations are Substituting the first into the second: . If then , which violates the constraint, so and .
- : , so , giving and with .
- : , giving and with .
The maximum is 1 (at with equal signs) and the minimum is .
Try it yourself
Maximize on the circle .
Show the answer
gives . The constraint gives , so . The maximum is at (and the minimum is ).
Keep going with practice
Optimization with constraints is covered in Vidi's Multivariable & Vector Calculus course, with interactive contour plots.