# Lagrange Multiplier Method

Lagrange multipliers can be used to find the extreme of a multivariate function $f\left({x}_{1},{x}_{2},...,{x}_{n}\right)$ subject to the constraint $g\left({x}_{1},{x}_{2},...,{x}_{n}\right)=0$

Where, $f$ and $g$ are functions with continuous first partial derivatives on the open set containing the constraint curve, and $\nabla g\ne 0$ at any point on the curve (where $\nabla$ is the gradient).

To find the extreme, write:(1)
$df=\frac{\partial f}{\partial {x}_{1}}d{x}_{1}+\frac{\partial f}{\partial {x}_{2}}d{x}_{2}+...+\frac{\partial f}{\partial {x}_{n}}d{x}_{n}=0$
But, because $g$ is being held constant, it is also true that(2)
$dg=\frac{\partial g}{\partial {x}_{1}}d{x}_{1}+\frac{\partial g}{\partial {x}_{2}}d{x}_{2}+...+\frac{\partial g}{\partial {x}_{n}}d{x}_{n}=0$
So multiply 式 2 by the as yet undetermined parameter $\lambda$ and add to 式 2,(3)
$\left(\frac{\partial f}{\partial {x}_{1}}+\lambda \frac{\partial g}{\partial {x}_{1}}\right)d{x}_{1}+\left(\frac{\partial f}{\partial {x}_{2}}+\lambda \frac{\partial g}{\partial {x}_{2}}\right)d{x}_{2}+...+\left(\frac{\partial f}{\partial {x}_{n}}+\lambda \frac{\partial g}{\partial {x}_{n}}\right)d{x}_{n}=0$
Note that the differentials are all independent, so any combination of them can be set equal to 0 and the remainder must still give zero. This requires that:(4)
$\left(\frac{\partial f}{\partial {x}_{k}}+\lambda \frac{\partial g}{\partial {x}_{k}}\right)d{x}_{k}=0$
for all k = 1, ..., n, and the constant $\lambda$ is called the Lagrange multiplier. For multiple constraints, ${g}_{1}=0$ , ${g}_{2}=0$ , ...,(5)
$\nabla f={\lambda }_{1}\nabla {g}_{1}+{\lambda }_{2}\nabla {g}_{2}+...$
The Lagrange multiplier method can be applied to contact-impact problems. In this case, the multivariate function is the expression of total energy subjected to the contact conditions:(6)
$f\left({x}_{1},{x}_{2},...,{x}_{n}\right)\equiv \Pi \left(x,\stackrel{˙}{x},\stackrel{¨}{x}\right)$
(7)
$g\left({x}_{1},{x}_{2},...,{x}_{n}\right)\equiv Q\left(x,\stackrel{˙}{x},\stackrel{¨}{x}\right)=0$
Where, $x,\stackrel{˙}{x},\stackrel{¨}{x}$ are the global vectors of DOF. The application of Lagrange multiplier method to the previous equations gives the weak form as:(8)
$M\stackrel{¨}{x}+{f}_{int}-{f}_{ext}+L\lambda =0$
with (9)
$Lx=b$
$\left[\begin{array}{cc}K& {L}^{T}\\ L& 0\end{array}\right]\left\{\begin{array}{c}x\\ \lambda \end{array}\right\}=\left\{\begin{array}{c}f\\ 0\end{array}\right\}$