Recipe
Solve a Lagrange multiplier problem with two constraints active at once
Use when: two equality constraints, or two inequality constraints both active at the candidate point, must hold at the same time, so one multiplier can't account for \nabla f alone
Goal: a candidate point solving the full stationarity system for both multipliers, checked against both constraints and (for an inequality constraint) checked for a nonnegative multiplier
Taught in Two constraints at once, revisited · extends Solve an equality-constrained problem with Lagrange multipliers
Quick recipe
-
1
Write L(x,y,\lambda_1,\lambda_2)=f(x,y)+\lambda_1g_1(x,y)+\lambda_2g_2(x,y), one term per constraint — Section 5's sign convention, not Section 1's, though for an equality constraint's own multiplier the sign is a free choice either way.
Example
For f(x,y)=(x-5)^2+(y-5)^2 with both boundary constraints from the worked example below active as equalities, g_1(x,y)=x+y-4 and g_2(x,y)=x-y+1: L(x,y,\lambda_1,\lambda_2)=(x-5)^2+(y-5)^2+\lambda_1(x+y-4)+\lambda_2(x-y+1)
Why: with two constraints pulling on the same point, \nabla f generally needs BOTH gradients' combined pull to be matched — one multiplier per constraint is Step 1 of the one-constraint recipe, run for two constraints at once.
-
2
Set \partial L/\partial\lambda_1=0 and \partial L/\partial\lambda_2=0 — these just hand back the two original constraints — and solve that pair directly for x and y, before touching the multipliers at all.
Example
x+y=4 and x-y=-1. Adding the two equations: 2x=3\implies x=1.5; then y=4-1.5=2.5.
- the two constraints are linear in x,y — solve them as a direct pair, as here.
- a constraint is curved (a circle, say) — solve the full four-equation system in x,y,\lambda_1,\lambda_2 simultaneously, since x,y may not separate out first.
Why: two constraint equations in two unknowns often pin x and y down completely on their own — free information the next step doesn't need to rediscover.
-
3
Set \partial L/\partial x=0 and \partial L/\partial y=0, substitute the x,y already found, and solve the resulting pair of equations for \lambda_1 and \lambda_2 together.
Example
\partial L/\partial x=2(x-5)+\lambda_1+\lambda_2=0 and \partial L/\partial y=2(y-5)+\lambda_1-\lambda_2=0. At (1.5,2.5): \lambda_1+\lambda_2=7 and \lambda_1-\lambda_2=5. Adding: \lambda_1=6; then \lambda_2=1.
Why: this is Step 2 of the one-constraint recipe, extended to two stationarity equations in two multiplier unknowns instead of one equation in one.
-
4
Confirm the candidate satisfies both original constraints, then evaluate f there. If either constraint is an inequality rather than a genuine equality, also confirm its multiplier is nonnegative (Section 5's rule) — a negative one means the guess that this constraint is active was wrong.
Example
f(1.5,2.5)=(1.5-5)^2+(2.5-5)^2=18.5. Both constraints check exactly: g_1(1.5,2.5)=0, g_2(1.5,2.5)=0. Both boundaries here are inequalities, so both multipliers also need checking: \lambda_1=6\ge0 and \lambda_2=1\ge0 — both pass.
Why: Step 4's own check of the one-constraint recipe already reappears here; the sign check is the one genuinely new condition two ACTIVE INEQUALITY constraints add over two equality constraints.
Common mistakes
- Solving only the stationarity equations and forgetting the two constraint equations are equations too — Step 2 needs solving, not just Step 3.
- Carrying over the base recipe's -\lambda(g-k) sign convention here without adjusting — this recipe follows Section 5's +\lambda g convention, flipping every multiplier's sign.
- Treating a negative multiplier as an arithmetic slip to hunt down, instead of a signal that the wrong pair of constraints was guessed active.
- Skipping the sign check because both constraints happened to be equalities in an earlier problem — it only applies when a constraint is a genuine inequality.