Lagrange visualizer
This will help you visualize what's happening with the Lagrange multipliers approach, and where the equation comes from.
Input the objective function and the constraint function . C is the value of the constraint (if you pick wisely, you can leave C=0). The constraint curve is displayed in red.
The slider c controls the level set , displayed in black. If red constraint curve crosses the black level curve, then moving along the constraint curve can take the value of f from below c to above c -- thus, the point of intersection is not a local extreme. So we are looking for points of tangency between the red and black curves.
Move the slider c to achieve tangency; in doing so you will find the extreme values of constrained by .
This is a 3D applet -- if you rotate the perspective, you can enable the graph of to see what's going on in 3D; but you should remember that we're really interested in the 2D picture.