Envelope

A Dynamic View of Lagrange Multipliers

You see a contour map of a function $z = f(x,y)$; The light grey curves are curves of constant $z$ value, spaced 10 apart. There is also a path (the red ellipse) $g(x,y) = c$ for some constant value $c$. The dark blue curve is a contour of $f$ whose $z$ value you can vary by using the slider. There is a point $A$ on the path showing unit vectors in the directions of the gradient of the functions $f$ and $g$.

The extreme values of $f$ along the path $g(x,y) = c$ occur at points on the path where the contours of $f$ are tangent to the curve. At these points, the gradients of $f$ and $g$ will be along the same line (parallel to one another, either in the same direction or in opposite directions.) You can vary the slider until you get a contour of $f$ to just touch the path; At these points, the contour and path will be tangent. You can also drag the point $A$ around the path to find the points where the two vectors are parallel

Information