
"Lagrange Multipliers" is the name given to a method of finding the extrema of a function subject to a constraint.
Suppose you have an objective function, f(x,y,z), that you wish to minimize (or maximize) subject to the constraint g(x,y,z)=c. Imagine the shape of the contours of f as the value of f increases. At some point, as you blow f up like a balloon, its surface will touch the constraint. At that point, the contour of f is exactly parallel to the constraint. That is, the gradient of f is parallel to the gradient of g at this constrained minimum. Being parallel means the gradient of f equals the gradient of g times some constant, called the lagrange multiplier. This boils down to the fact that all the partial derivatives of f equal the corresponding partial derivatives of g times the lagrange multiplier.
For simplicity, we start by defining the constraint function, g, so that g(x,y,z)=0 is the constraint we want. (If we started with the constraint g(x,y,z)=c, then we define a different function g(x,y,z)c=0, and we simply call the new function g.)
Next, we want to find where the gradient of f(x,y,z) equals the gradient of −λg(x,y,z), so we define a new function, called the Lagrangian function,
F(x,y,z,λ) = f(x,y,z) + λg(x,y,z)
Now, we find the partial derivatives of F with respect to each of its four variables, and set them all to zero, giving us four equations in four unknowns. This gives us the stationary point(s) of F, and we have found the constrained maxima and minima of f.
Clearly this is not a good example, because the solution could not be found. This is a question that came up on NRICH, and it turned out that the student wasn't supposed to find a solution, just show that one exists!
Minimize f(x,y,z) = (xx_{0})^{2}+(yy_{0})^{2}+(zz_{0})^{2} (the squared distance of x,y,z from the given point) subject to the constraint x^{2}/a^{2}+y^{2}/b^{2}+z^{2}/c^{2}1=0 (it lies on the given ellipsoid).
F(x,y,z,λ) = (xx_{0})^{2}+(yy_{0})^{2}+(zz_{0})^{2} + λ(x^{2}/a^{2}+y^{2}/b^{2}+z^{2}/c^{2}1)
The partial derivatives are
dF/dx = 2(xx_{0}) + 2wx/a^{2}
dF/dy = 2(yy_{0}) + 2wy/b^{2}
dF/dz = 2(zz_{0}) + 2wz/c^{2}
dF/dw = x^{2}/a^{2}+y^{2}/b^{2}+z^{2}/c^{2}1
Setting these four equations to zero, and solving for x,y,z,λ,
0 = 2(xx_{0}) + 2wx/a^{2}
0 = 2(yy_{0}) + 2wy/b^{2}
0 = 2(zz_{0}) + 2wz/c^{2}
0 = x^{2}/a^{2}+y^{2}/b^{2}+z^{2}/c^{2}1
From the first three, we get
x = a^{2}f/(a^{2}+λ)
y = b^{2}g/(b^{2}+λ)
z = c^{2}h/(c^{2}+λ)
Substituting these values of x, y, z into the fourth equation gives us
0 = (a^{2}f/(a^{2}+λ))^{2}/a^{2}+(b^{2}g/(b^{2}+λ))^{2}/b^{2}+(c^{2}h/(c^{2}+λ))^{2}/c^{2}1
which simplifies to
0 = a^{2}f^{2}/(a^{2}+λ)^{2}+b^{2}g^{2}/(b^{2}+λ)^{2}+c^{2}h^{2}/(c^{2}+λ)^{2}1
Unfortunately, I wasn't able to find a solution to this equation.
The webmaster and author of this Math Help site is Graeme McRae.