The method of Lagrange multipliers solves the constrained optimization problem by transforming it into a non-constrained optimization problem of the form:
![{\displaystyle \operatorname {\mathcal {L}} (x_{1},x_{2},\ldots ,x_{n},\lambda )=\operatorname {f} (x_{1},x_{2},\ldots ,x_{n})+\operatorname {\lambda } (k-g(x_{1},x_{2},\ldots ,x_{n}))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/69ae7af1b3c09eb39393a41530d8ca002ba1f96b)
Then finding the gradient and Hessian as was done above will determine any optimum values of
.
Suppose we now want to find optimum values for
subject to
from [2].
Then the Lagrangian method will result in a non-constrained function.
![{\displaystyle \operatorname {\mathcal {L}} (x,y,\lambda )=2x^{2}+y^{2}+\lambda (1-x-y)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/4fdc6748f50f24ac98cafab07e57e16fe046d93d)
The gradient for this new function is
![{\displaystyle {\frac {\partial {\mathcal {L}}}{\partial x}}(x,y,\lambda )=4x+\lambda (-1)=0}](https://wikimedia.org/api/rest_v1/media/math/render/svg/8160dab477422583989cf07322c78c5428155b29)
![{\displaystyle {\frac {\partial {\mathcal {L}}}{\partial y}}(x,y,\lambda )=2y+\lambda (-1)=0}](https://wikimedia.org/api/rest_v1/media/math/render/svg/0af0d8a90a28b63f064b02a3e2b77823e8fbc208)
![{\displaystyle {\frac {\partial {\mathcal {L}}}{\partial \lambda }}(x,y,\lambda )=1-x-y=0}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a456a14306c9f8437088ebb0aa140ef58dbc1a0c)
Finding the stationary points of the above equations can be obtained from their matrix from.
![{\displaystyle {\begin{bmatrix}4&0&-1\\0&2&-1\\-1&-1&0\end{bmatrix}}{\begin{bmatrix}x\\y\\\lambda \end{bmatrix}}={\begin{bmatrix}0\\0\\-1\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c53ef5589e31ae6b92804b51b00eff724baacd79)
This results in
.
Next we can use the Hessian as before to determine the type of this stationary point.
![{\displaystyle H({\mathcal {L}})={\begin{bmatrix}4&0&-1\\0&2&-1\\-1&-1&0\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/4967acf461ca21ac5075fea4b449116a93124e99)
Since
then the solution
minimizes
subject to
with
.