# Why is the $\nabla g\neq0$ condition needed for the method of Lagrange multipliers?

Based on my Calculus textbook, the method of Lagrange multipliers is stated as follow:

Suppose that $$f(x,y,z)$$ and $$g(x,y,z)$$ are differentiable and $$\nabla g \ne \mathbf 0$$ when $$g(x,y,z) = 0$$. To find the local extremum values of $$f$$ subject to the constraint $$g(x,y,z) = 0$$, find the values of $$x,y,z$$ and $$\lambda$$ simultaneously satisfying the equations $$\nabla f = \lambda \nabla g$$ and $$g(x,y,z) = 0$$.

My questions are:

1. Why do we need $$\nabla g \ne \mathbf 0$$ in the assumption? (Is there something realted to the implicit function theroem?)
2. What happens if $$\nabla g = \mathbf 0$$?
• If you have $g(x,y,z) = 0$ and $\nabla g(x,y,z) = 0$ for all $(x,y,z)\in \mathbb{R}^3$ then $g(x,y,z)$ is the null function. Commented Oct 14, 2018 at 15:08
• Suppose $g$ isn't null. Is it possible that $P$ is an extremum of $f$ subject to the constraint $g(x,y,z)=0$ while $\nabla g(P) = \mathbf 0$?
– Jack
Commented Oct 14, 2018 at 15:19
• Make $g(x,y,z) = f(x,y,z)$ . Now if $P$ is a local extremum $\nabla f(P) = \lambda \nabla g(P) = 0$ In this case is possible. Commented Oct 14, 2018 at 15:30
• So by letting $f = g$, the original optimization problem are transformed into finding local extrema of $f$ without any constraint. I think I've understood the case that for a non-null function, it is possible that $\nabla g(P) = 0$ and $P$ is an extremum.
– Jack
Commented Oct 14, 2018 at 16:13
• On the other hand, supposing that $g$ is not null, is there any geometric interpretation of the assumption $\nabla g \ne \mathbf 0, \forall (x,y,z) : g(x,y,z)=0$?
– Jack
Commented Oct 14, 2018 at 16:17

I think the best way to understand the condition is to see what can go wrong when $$\nabla g=0$$. Try working through the following examples:

Apply Lagrange's method to the following problem and then solve it graphically:

$$\min_{x,y} x^2 +y^2\text{ subject to (x−1)^3 −y^2 = 0}$$

Apply the method to $$\max_{x,y} y−2x^2 +x\text{ subject to (x+y)^2 = 0}$$ and compare your findings to the equivalent problem:

$$\max_{x,y} y−2x^2 +x\text{ subject to x+y = 0}$$

• In problem 1, I get $\nabla g(x,y) = (3x^2 - 6x + 3, -2y)$ and $(1,0)$ is the only extremum. Also, $\nabla g(1,0) = (0, 0)$. In problem 2.1, $\nabla g(x,y) = (2x+2y, 2x+2y)$, $(1,0)$ is the only extremum, and $\nabla g(1,0) = (0, 0)$. While in problem 2.2, though equivalent to problem 2.1, $\nabla g(x,y) = (1,1), \forall (x,y) \in \mathbb R^2$, $(1,0)$ is the only extremum, and $\nabla g(1, 0) = (1,1)$.
– Jack
Commented Oct 14, 2018 at 15:58
• It seems that $P$ can be an extremum, even if the constraint function $g$ satisfying $\nabla g(P) = \mathbf 0$.
– Jack
Commented Oct 14, 2018 at 16:01
• So I guess it is save to drop out the assumption $\nabla g = \mathbf 0$.
– Jack
Commented Oct 14, 2018 at 16:20
• You are right that $(1,0)$ is the solution to the first problem. I think you meant $(0,0)$, rather than $(1,0)$, is the solution to the second problem.
– smcc
Commented Oct 14, 2018 at 16:56
• If you apply Lagrange's method to problem 1, then you will not find any stationary points of the Lagrangean, i.e. you will not find a solution $(x,y,\lambda)$ to $\nabla f(x,y)=\lambda \nabla g(x,y)$. Problem 1 shows that $\nabla f(x,y)=\lambda \nabla g(x,y)$ is not a necessary condition for a (local) minimizer if the constraint qualificaiton ($\nabla g(x,y)\neq 0$) is not satisfied. In problem 2, the constraint curve has a cusp at the solution, so does not define $x$ or $y$ as an implicit function of the other variable near the solution.
– smcc
Commented Oct 14, 2018 at 16:57

Let me consider again some of the examples discussed in the other answer, but working out the details of the calculations.

• Considering the optimisation problem $$\max_{x,y} (y-x^2)$$ subject to the constraint $$x+y=0$$. Graphically, the solution is straightforward, and we can also just substitute $$y=-x$$ into the cost, which then reads $$-x-x^2$$, and easily find out that it maximises at $$x=-1/2$$.

Same answer is obtained via Lagrange's multipliers: computing the gradients of cost and constraint we have $$\begin{pmatrix}-2x\\1\end{pmatrix} = \lambda \begin{pmatrix}1\\1\end{pmatrix},$$ which has the only solution $$x=-1/2$$.

• Let's consider now the completely equivalent problem $$\max_{x,y}(y-x^2)$$ subject to $$(x+y)^2=0$$. The constraint is clearly equivalent, and thus so is the solution, however, if we now follow the Lagrange multipliers scheme we get $$\begin{pmatrix}-2x\\1\end{pmatrix} = 2\lambda(x+y)\begin{pmatrix}1\\1\end{pmatrix}.$$ But this system now doesn't have any solution in the feasible set. To see it, observe that the components on the LHS must be equal, thus $$x=-1/2$$, but on the RHS $$x+y=0$$, which is a contradiction. We conclude that the Lagrange multipliers approach doesn't capture the local maximum at $$x=-y=-1/2$$ in this case.

• For another even simpler example, say we want to find $$\min x$$ subject to $$(x-1)^2+y^2=1$$. The solution is clearly $$x=0$$, which you see because the constraint is a unit-radius circle with center $$(1/2,0)$$. Lagrange gives the condition $$\binom{1}{0}=\lambda\binom{2(x-1)}{2y}$$, which has solution $$y=0$$ and $$\lambda(x-1)=1/2$$. In the feasible set for $$y=0$$ we can have $$x=0$$ or $$x=2$$, both of which are viable solution corresponding to $$\lambda=-1/2$$ and $$\lambda=1/2$$, respectively (one of these corresponds to the min and the other to the max).

Now let's do this again but with the constraint written as $$[(x-1)^2+y^2]^2=1$$. The Lagrange condition becomes $$\begin{pmatrix}1\\0\end{pmatrix} = 2\lambda[(x-1)^2+y^2]\begin{pmatrix}2(x-1)\\ 2y\end{pmatrix}.$$ But on the feasible set the RHS is identically zero, thus there is no solution.