TITLE: How to prove Lagrange multiplier theorem in a rigorous but intuitive way?
QUESTION [35 upvotes]: Following some text books, the Lagrange multiplier theorem can be described as follows.
Let $U \subset \mathbb{R}^n$ be an open set and let $f:U\rightarrow \mathbb{R}, g:U\rightarrow \mathbb{R}$ be $C^1$ functions. Let $\mathbf{x}_{0} \in U, c=g(\mathbf{x}_0)$, and let $S$ be the level set of $g$ with value $c$. Suppose that $\nabla g(\mathbf{x}_0) \neq 0$. 
If the function $f|_S$ has a local extremum at $\mathbf{x}_0$ then there is a $\lambda \in \mathbb{R}$ so that $\nabla f(\mathbf{x}_0)=\lambda g(\mathbf{x}_0)$
Some textbooks give a strict proof using implicit function theorem (see proof). The proof is very clear, however I can't build some intuition from the proof. Can someone help me prove this theorem in a rigorous but more intuitive way? Thanks.

REPLY [5 votes]: Here's a different way to see that Lagrange multipliers are "intuitively" the correct way to go. To first order, the change in $f$ due to a change in $\vec r$ is simply:$$\delta f = f(\vec r + \delta\vec r) - f(\vec r) \approx \nabla f\cdot\delta\vec r.$$This has the obvious interpretation for $f$ above, "go in the direction of $\nabla f$ to increase $f$," but it also has an interpretation for constraints: to first order, the paths allowed by a constraint $g(\vec r) = c$ must be the ones such that $\nabla g \cdot \delta \vec r = 0,$ otherwise you would increase $c$ to first-order by following that tangent vector. That is, if you obey the constraint, we must have $\delta g = 0.$
Now we simply combine these two. At the constrained extremum of $f$ on $S,$ it must be the case that for all $\delta\vec r$ such that $\nabla g \cdot \delta \vec r = 0,$ we also have $\delta f = \nabla f\cdot\delta\vec r = 0,$ otherwise we can follow $\pm \delta\vec r$ to increase/decrease $f$, proving that this wasn't either sort of extremum on $S$ after all. So just to phrase the very condition for a constrained maximum, we would have to write it as $$\forall \vec a . (\nabla g \cdot \vec a = 0) \rightarrow (\nabla f \cdot \vec a = 0)$$
But that "for-all" is 100% sufficient to prove that they are proportional! Effectively, you can't have two linearly independent vectors $\vec a, \vec b$ such that the nullspaces of  $(\vec a \cdot)$ and $(\vec b \cdot)$ are the same. Let's just prove this last aspect to complete the proof.
Consider $\vec p = \vec a - \alpha \vec b$ for $\alpha = \vec a \cdot \vec b / (\vec b \cdot \vec b)$, this satisfies by construction $\vec b \cdot \vec p = 0$ and therefore we must have $\vec a \cdot \vec p = 0$ due to the shared nullspace. But when you chug through the algebra of this it means ultimately that $(\vec a \cdot \vec a)(\vec b \cdot \vec b) = (\vec a \cdot \vec b)^2.$ That guarantees the = sign in a triangle inequality looking like either of $$|\vec a \pm \vec b|^2 = |\vec a|^2 + |\vec b|^2 \pm 2 (\vec a \cdot \vec b) ~\le~ (|\vec a| + |\vec b|)^2 = |\vec a|^2 + |\vec b|^2 + 2 |\vec a||\vec b|.$$ We know that those equals signs only hold when the vectors are degenerate, that is, $\vec a = \lambda \vec b.$