## Visualizing the proof of Lagrange Multipliers

### Play with the applet to get a feel for it.

- It is color coordinated
so that things with the same color are related.
- Try to figure out the relationships.

### Set the applet as follows

- Choose f(x,y) = x-y
- Choose g(x,y) = x^2 + y^2
- Set xMin, xMax to -5, 5 and yMin, yMax to -5, 5.
- Select 'Show grad f' and 'Show grad g'
- Click the 'Plot curves' button.
- 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.

- 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.
- 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*.
- 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.
- Notice that when they first touch the green line and
yellow circle are tangent. This means the vectors perpendicular to
each curve are parallel.
- 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.
- 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.
- 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.
- Now look at other choices of f and g and play with the applet.