Constrained optimization · 3D

The optimum is the crest of the draped path.

Same setup as the flat view, lifted into 3D. The objective f(x, y) is now a surface; the constraint circle x² + y² = r² is the curve draped across it (the teal ribbon). Walk the point around the constraint and watch its height: the constrained maximum is simply the highest point of that ribbon — where, moving along the constraint, you stop climbing. That "stops climbing" moment is exactly ∇f = λ ∇g.

drag to orbit · scroll to zoom

State on the constraint

position (x, y)
height f
slope along path
multiplier λ
are you at the crest?

Controls

Legend

constraint — ribbon draped on surface
point you're walking
constrained max — ribbon's high point
constrained min — ribbon's low point
level curve — tangent to the ribbon at a crest

f(x,y) = −(0.45·x² + 0.8·y²) + 0.6·x·y + 1.4·x + 0.5·y, constraint x² + y² = r². The flat contour rings of the 2D view are this surface's level sets seen from above. Toggle show level curve and snap to Max or Min: the amber level curve touches the teal constraint ribbon exactly at the crest — that tangency is the geometry, and the gradients being parallel there (∇f = λ∇g) is its algebra. λ is the height the crest gains per unit you loosen r. Drag the radius and watch the crest migrate. Keys: walk.