Lagrange
Multipliers
Master constrained optimization by learning how gradients reveal extrema along curves and surfaces.
What Is Constrained Optimization?
In many real problems we want to maximize or minimize a function \( f(x, y) \) but we are not free to choose any point in the plane. Instead, we must stay on a curve defined by a constraint \( g(x, y) = k \).
The Geometric Idea
Level curves of \( f \) are curves where \( f \) is constant. The constraint \( g(x,y)=k \) is another curve. An extremum of \( f \) on the constraint occurs where a level curve of \( f \) is tangent to the constraint curve.
Why Gradients Must Be Parallel
If \(\nabla f\) had a component along the constraint curve, you could still increase \( f \) by moving in that direction while staying on the constraint. At an extremum, any such tangential component must vanish.
The Lagrange Condition
To find extrema of \( f(x,y) \) subject to \( g(x,y) = k \), solve the system:
In component form for two variables, this gives three equations in three unknowns \((x, y, \lambda)\):
Extension to Three Variables
For \( f(x,y,z) \) subject to \( g(x,y,z) = k \), the same principle gives four equations in four unknowns \((x,y,z,\lambda)\):
For two constraints \( g = k \) and \( h = c \), introduce a second multiplier \(\mu\):
Unconstrained vs Constrained
| Unconstrained | Constrained (Lagrange) | |
|---|---|---|
| Condition | \(\nabla f = \vec{0}\) | \(\nabla f = \lambda\,\nabla g\) |
| Variables | \(x, y\) only | \(x, y, \lambda\) |
| Tests | Second derivative test | Bordered Hessian or evaluate candidates |
| Domain | All of \(\mathbb{R}^n\) | Only points on \(g = k\) |
| Typical result | Interior critical points | Boundary extrema on constraint |
How to Apply the Method
Example 1: Circle Constraint
Find the extrema of \( f(x,y) = x + y \) subject to \( x^2 + y^2 = 1 \).
Example 1: Visualized
Example 2: Ellipse Constraint
Find the extrema of \( f(x,y) = xy \) subject to \( \tfrac{x^2}{4} + y^2 = 1 \).
Example 3: Three Variables
Find the minimum of \( f(x,y,z) = x^2 + y^2 + z^2 \) subject to \( x + y + z = 3 \).
What Does \(\lambda\) Mean?
The multiplier \(\lambda\) has a powerful interpretation: it measures the sensitivity of the optimal value of \(f\) to changes in the constraint constant \(k\).
The Lagrangian Function
We can package the entire method into a single function called the Lagrangian:
Setting all partial derivatives of \(\mathcal{L}\) to zero recovers exactly the Lagrange conditions:
Common Mistakes
Summary Table
| Aspect | Detail |
|---|---|
| Core equation | \(\nabla f = \lambda\,\nabla g\) |
| Geometric meaning | Gradients are parallel at extremum |
| Variables solved | \(n\) coordinates + one \(\lambda\) per constraint |
| \(\lambda\) interpretation | Rate of change of optimal \(f\) w.r.t. \(k\) |
| Lagrangian | \(\mathcal{L} = f - \lambda(g - k)\) |
| Classify extrema | Evaluate \(f\) at all candidates |
Question 1 of 5
The Lagrange condition \(\nabla f = \lambda\,\nabla g\) geometrically means:
Question 2 of 5
To optimize \( f(x,y) \) subject to \( g(x,y) = k \), how many equations does the Lagrange system produce?
Question 3 of 5
Find the maximum of \( f(x,y) = x + y \) on the circle \( x^2 + y^2 = 1 \).
Question 4 of 5
Find the minimum of \( f(x,y,z) = x^2 + y^2 + z^2 \) subject to \( x + y + z = 3 \).
Question 5 of 5
The Lagrangian for optimizing \( f \) subject to \( g = k \) is defined as: