2026-08-28·by Sijie Wang#idea#math

lagrangian-worked-example

Worked example: the Lagrange method (equality) end-to-end

Parent: lagrangian · Prereq: lagrangian

A representative equality-constrained instance — pure Lagrange multipliers, no inequality (so no complementary slackness). Note the method returns all constrained stationary points at once: here a minimum and a maximum.

Problem. Extremize f(x,y)=x+2y on the circle h(x,y)=x²+y²−1=0. Geometrically: how far can the linear function x+2y reach while staying on the unit circle.

1. Lagrangian & stationarity

L(x,y,λ)=x+2y+λ(x2+y21).L(x,y,\lambda)=x+2y+\lambda\,(x^2+y^2-1).

∇ₓL=0 gives 1+2λx=0, 2+2λy=0x=−1/(2λ), y=−1/λ; and ∂L/∂λ=0 recovers x²+y²=1.

2. Solve — both stationary points

Substitute into the constraint: 1/(4λ²)+1/λ²=1 ⟹ 5/(4λ²)=1 ⟹ λ=±√5/2.

  • λ=+√5/2: (x,y)=(−1/√5,−2/√5), f=−√5minimum;
  • λ=−√5/2: (x,y)=(+1/√5,+2/√5), f=+√5maximum.
 minf=5  at  (15,25),λ=52. \boxed{\ \min f=-\sqrt5\ \text{ at }\ \Big(-\tfrac1{\sqrt5},-\tfrac2{\sqrt5}\Big),\quad \lambda=\tfrac{\sqrt5}{2}.\ }

3. Geometric check

The known result: min aᵀx subject to ‖x‖=1 is −‖a‖, attained at x=−a/‖a‖. Here a=(1,2), ‖a‖=√5, so x*=−(1,2)/√5 ✓. At x*, ∇f=(1,2) is parallel to ∇h=(2x,2y) (∇f=−λ∇h) — the level line of f is tangent to the circle.

4. Shadow price

Relax the constraint to x²+y²=c. By scaling, p*(c)=−√(5c), so dp*/dc=−√5/(2√c). At c=1: =−√5/2=−λ. Hence ∂p*/∂c=−λ — the multiplier is the marginal value of the constraint level, exactly as derived in general. ✓

Inequality version (with complementary slackness) → kkt-worked-example.

about this entry

One of sijie's wiki entries. The AI on this site is grounded in the same corpus and answers in sijie's voice, with citations back to entries like this one — answering costs sijie money, so it waits behind a code: enter an access code →