WOLFRAM|DEMONSTRATIONS PROJECT

The Geometry of Lagrange Multipliers

​
show
3D
2D
point
f(x,y) = 0.866025
near max
Move a point around a constraint curve to see the relationship between the blue gradient of the function
f(x,y)
to be optimized and the red gradient of the function
g(x,y)
for the constraint
g(x,y)=0
. The orange vector is the projection of the gradient of
f
onto the tangent line of the constraint curve; its direction is the direction of increase along the constraint and its magnitude is the slope (that is, the directional derivative) of
f
in that direction. There are both 2D and 3D views, with the constraint curve laid out upon the graph of the function.
At a local extremum, the gradients of the functions
f
and
g
are parallel. Thus we get the condition for an extremum
∇f=λ∇g
, where
λ
is called a Lagrange multiplier.