Lagrange multiplier

Say we have a function f:Rn→Rf:\R^n \to \R constrainted by an equation g(…)=cg(\ldots) = c where g:Rn→Rg: \R^n \to \R. We can find the extrema of ff by finding the points where the ∇f\nabla f is parallel to ∇g\nabla g. Formally, the extrema of ff are the solutions to ∇f=λ∇g\nabla f = \lambda \nabla g where λ\lambda is the Lagrange multiplier.

The specific value for λ\lambda does not matter, it only matters that some λ\lambda exists for which the equation holds.

Consider why this works. ∇g\nabla g is always perpendicular to the level curve g=cg=c. If ∇f\nabla f is not parallel to ∇g\nabla g, then we can follow ∇f\nabla f along the level curve g=cg=c to reach a different ff. But when ∇f∥∇g\nabla f \parallel \nabla g, we have nowhere to move on g=cg=c that will change ff, so we have found a local extremum.