Lagrange multiplier condition

Necessary first-order condition for constrained extrema in terms of gradients.
Lagrange multiplier condition

Lagrange multiplier condition: Let URnU\subseteq\mathbb R^n be an . Let f:URf:U\to\mathbb R and g:URmg:U\to\mathbb R^m be continuously differentiable with m<nm<n, and consider the S={xU:g(x)=0}S=\{x\in U: g(x)=0\}. If xSx^\ast\in S is a local of ff restricted to SS and Dg(x)Dg(x^\ast) has rank mm (so xx^\ast is a of gg), then there exists λRm\lambda\in\mathbb R^m such that

Df(x)=λTDg(x). Df(x^\ast)=\lambda^{\mathsf T}Dg(x^\ast).

In the common case m=1m=1, this says the vectors satisfy f(x)=λg(x)\nabla f(x^\ast)=\lambda\,\nabla g(x^\ast), so the constrained extremum occurs at a point where ff has a compatible with the constraint.