Lagrange Multipliers in 50 Seconds: Where Gradients Line Up

You want the highest point, but you must stay on a path. Lagrange multipliers solve it with one picture and one equation.

Hook

Highest Point, Fixed Path

Find the highest point, but you must stay on a path. How?

  • Maximize f
  • Stay on the path

Setup

Contours of f

Draw the hill as contour lines. Higher rings mean higher ground.

  • f(x, y) is height
  • Rings are equal height

Constraint

The Constraint

Now add a rule. You may only walk along this curve.

  • g(x, y) = 0
  • Walk only on the curve

Sliding

Slide Along the Curve

Slide along it. While the curve crosses contours, you can still climb.

  • Crossing contours
  • f keeps rising

Tangency

Tangent at the Best Point

At the best point, the curve just touches one contour. They are tangent.

  • Curve touches one contour
  • No more climbing

Gradients

Two Gradients

The gradient of f points uphill, perpendicular to its contour. The gradient of g is perpendicular to the curve.

  • grad f ⟂ contour
  • grad g ⟂ constraint

Insight

Gradients Line Up

Tangent means the same perpendicular. So both gradients point along one line.

  • Same tangent, same normal
  • Parallel at the optimum

Equation

∇f = λ∇g

One equation captures it. Gradient of f equals lambda times gradient of g.

  • One equation
  • Lagrange condition

Payoff

Next: Lesson 37

Lambda just scales one arrow into the other. Lesson thirty-seven puts numbers to it. Follow for more.

  • λ scales the arrow
  • Worked numbers next