Problem Statement
Find the stationary points of f(x,y) subject to constraint g(x,y)=0.
The constraint restricts us to a curve (or surface), so we seek constrained extrema rather than global ones.
Geometric Intuition
At a constrained stationary point:
- ∇f is perpendicular to the level curve of f passing through that point
- ∇g is perpendicular to the constraint curve g=0
- For an extremum, these level curves must be tangent

Therefore: ∇f and ∇g are parallel at the extremum.
∇f=λ∇g
where λ is called the Lagrange multiplier.
Method
To find stationary points of f(x,y) subject to g(x,y)=0:
-
Form the Lagrangian: L(x,y,λ)=f(x,y)−λg(x,y)
-
Solve the system:
- ∂x∂L=0
- ∂y∂L=0
- ∂λ∂L=0 (which is just g(x,y)=0)
-
Evaluate f at each solution to classify.
Example
Maximise f(x,y)=xy subject to x2+y2=1.
Setup: L=xy−λ(x2+y2−1)
Equations:
- ∂x∂L=y−2λx=0 …(i)
- ∂y∂L=x−2λy=0 …(ii)
- ∂λ∂L=−(x2+y2−1)=0 …(iii)
Solve:
From (i): y=2λx
Substitute into (ii): x−2λ(2λx)=x(1−4λ2)=0
So x=0 or λ=±21.
If x=0: Then y=±1 from (iii). f=0.
If λ=21: From (i), y=x. From (iii), x2+x2=1, so x=±21.
Points: (21,21) and (−21,−21) with f=21.
If λ=−21: y=−x. Points: (21,−21) and (−21,21) with f=−21.
Maximum occurs when x=y=±21, giving f=21.
Multiple Constraints
For constraints g1(x,y)=0 and g2(x,y)=0:
∇f=λ1∇g1+λ2∇g2
The Lagrangian becomes:
L=f−λ1g1−λ2g2
Interpretation of λ
Adding a small change ε to the constraint:
g(x,y)=ε
The optimal value f∗(ε) satisfies:
dεdf∗=λ
λ measures the sensitivity: how much the optimal value changes per unit change in the constraint.
Example: In economics, if f is profit and g is a budget constraint, λ is the marginal value of relaxing the budget.
When Lagrange Multipliers are Needed
- Constraints cannot be easily substituted into the objective
- Multiple constraints interact
- Need to understand the “cost” of constraints (via λ)
- Generalising to higher dimensions (constrained on surfaces)
When a single constraint can be substituted, that’s often simpler. Lagrange multipliers are a systematic method for complex situations.
Why This Method Matters
- Optimisation: Constraints arise naturally in real problems
- Economics: Utility maximisation under budget constraints
- Physics: Equilibrium under constraints (frictionless motion)
- Machine learning: Regularisation as constrained optimisation