Maximize a function f(x, y) while staying on the curve g(x, y) = 0. Drag the point around the constraint. The constrained best isn't where f is biggest overall — it's the single spot where the constraint runs tangent to a contour of f, so their gradients point the same way: ∇f = λ ∇g.
g(x,y)=0 — the constraint you must stay onf — equal-value rings∇f — uphill on the objective∇g — normal to the constraint
Here f(x,y) = −(0.45·x² + 0.8·y²) + 0.6·x·y + 1.4·x + 0.5·y (a tilted dome — the rings are its level sets) and the constraint is the circle x² + y² = r². Walk the point around the circle and read the alignment meter: when ∇f (orange) and ∇g (blue) become parallel, the constraint is tangent to a contour and you're at a constrained max or min. The ratio of their lengths at that instant is λ — how much the best attainable f would move if you loosened the constraint by a notch. Drag the radius to watch the optima slide. Keys: ← → nudge.