# Lagrangian Multipliers to find maximum and minimum values

1. Apr 9, 2014

### cooev769

I'm just learning this theory and the maths is really trivial but the theory is slightly confusing me.

I understand that if we have some function z=f(x,y) and we graph this on a three dimensional set of axis we will have some surface, we can then extend this by creating level curves in the x, y plane for differing values of z.

We then set up a function g(x,y)=k such that k is a constant, we call this our constraint curve and it looks something as shown in the link I have provided.

http://en.wikipedia.org/wiki/File:LagrangeMultipliers2D.svg

I understand how the theory that the maximum/minimum value will occur when the grad of function f and the grad of function g are scalar multiples of each other. But imagine for a second that the constraint curve was a straight line and it went straight through the centre of the circle created by the level curve of the function f. In that case the maximum value would be at the centre of this level curve, but to my knowledge at no time were the gradients parallel.

Or imagine a sloping flat surface sloping up. If the constraint curve started off running up the slope then for a second ran tangent to one of the level curves and then ran at some angle up this surface and stopped, then the point at which the gradients were scalar multiples only in the middle of the curves, so the supposed maximum/minimum occured at a random place. If you could clarify this it would be extremely helpful thanks!

2. Apr 9, 2014

### HallsofIvy

Staff Emeritus
So like: "Minimize $f(x,y)= x^2+ y^2$ subject to the constraint y= x"? The constraint can be written g(x,y)= y- x so $\nabla f= 2x\vec{i}+ 2y\vec{j}$ and $\nabla g= -vec{i}+ vec{j}$. The Lagrange multiplier method says that the max or min will be where $2x= -\lambda$ and $2y= \lambda$.

Eliminate $\lambda$ by dividing one equation by the other: $x/y= -1$ or y= -x. That, together with y= x, the constraint, give y= x= 0. The two gradients are never parallel but if one is 0 that will also satisfy $\nabla g= \lambda\nabla f$.

Another way of putting this is that if the two gradients are never parallel, then the "constraint" doesn't really constrain anything. The max or min will be where the gradient of the given function is 0.