Lagrangian Method
The Lagrangian method is an approach for solving constrained maximization systems.
Univariate Formulation
Given a problem of maximizing f(x) given g(x) = 0, the system can be rewritten as a Lagrangian function: L(x, λ) = f(x) + λ g(x). λ is the Lagrange multiplier that enables this solution.
The solution exists at the point where (aside from the obvious: g(x) = 0) the derivative of L with respect to x is 0 and the derivative of L with respect to λ is 0. Therefore, solve for:
The problem can also be solved if the constraint is some other constant, like g(x) = h. This simply means that the Lagrangian function is L(x, λ) = f(x) + λ(g(x) - h). The first part of the solution is unchanged (as h is a constant and disappears after derivation) and the second part of the solution becomes:
Bivariate Formulation
Given a problem of maximizing f(x, y) given g(x, y) = 0, the system can be rewritten as: L(x, y, λ) = f(x, y) + λ g(x, y). Solve for:
Multivariate Formulation
Given a problem of maximizing f(x1, x2, ... xn) given g(x1, x2, ... xn) = 0:
The Lagrangian function L(x1, x2, ... xn, λ) is equal to f(x1, x2, ... xn) + λ · g(x1, x2, ... xn). (Note the dot product.) The solution exists where the gradient ∇L equals a vector of 0s. In other words, where ∂L/∂x1 = 0, ∂L/∂x2 = 0, and so on, and finally ∂L/∂λ = g(x1, x2, ... xn) = 0
Alternatively, at the solution, the gradient vectors are similar. In other words, while they may not be equal in degree, they can be set as equal if given a scalar multiplier. This is the Lagrangian multiplier.