Visualizing the proof of Lagrange Multipliers

Play with the applet to get a feel for it.

Set the applet as follows

  1. Choose f(x,y) = x-y
  2. Choose g(x,y) = x^2 + y^2
  3. Set xMin, xMax to -5, 5 and yMin, yMax to -5, 5.
  4. Select 'Show grad f' and 'Show grad g'
  5. Click the 'Plot curves' button.
  6. Set the a slider to 10 and the b slider to 8.

The following will guide you through a visual explanation of why Lagrange Multipliers work.

  1. The blue lines are the level curves for the objective function f(x,y).
    The yellow circle is the constraint --our maxima and minima must come from points on this curve.
  2. Use the a slider to slowly decrease the value of a.
    You should see a green line moving from the bottom right-hand corner towards the upper left-hand corner. This is the level curve for the current value of a.
  3. Stop moving the slider when the green line first touches the yellow circle. This is the maximum value of f(x,y) on the circle.
  4. Notice that when they first touch the green line and yellow circle are tangent. This means the vectors perpendicular to each curve are parallel.
  5. Move the purple dot with the gradient arrows attached to the point where the green line and yellow circle touch.
    Since the gradients of f(x,y) and g(x,y) are perpendicular to their respective level curves they will become parallel as the purple dot goes to the point of intersection.
  6. Now decrease a until the last point where the green line intersects the yellow circle. This is the minimum value of f(x,y) on the circle.
  7. As in steps 4 and 5, you should see the gradients of f and g are parallel (though in opposite directions) at the point of intersection.
  8. Now look at other choices of f and g and play with the applet.