Solution (source code)

= Solution

The <Lagrange multiplier>[Lagrange multiplier theorem] for one regular constraint says: if $f,k$ are $C^1$ near $x$, $f(x)=0$, $\nabla f(x)\ne0$, and $x$ is a local extremum of $k$ restricted to $f^{-1}(0)$, then
$$
\boxed{\nabla k(x)=\lambda\nabla f(x)\quad\text{for some }\lambda\in\mathbb R.}
$$
For several constraints with linearly independent <gradients>, the objective <gradient> lies in their linear span. The regularity assumption rules out singular points where the usual multiplier conclusion can fail.