I don’t understand why in the Lagrange multiplier formula the constraint has to have a gradient too. $\nabla f(x_1,\dots,x_n)= \lambda \nabla g (x_1, \dots, x_n)$
Isn’t $g(x_1, \dots, x_n)=0 $ just a curve?
I don’t understand why in the Lagrange multiplier formula the constraint has to have a gradient too. $\nabla f(x_1,\dots,x_n)= \lambda \nabla g (x_1, \dots, x_n)$
Isn’t $g(x_1, \dots, x_n)=0 $ just a curve?
First, note that even $g\left(x_1,\dots,x_n\right)=0$ that doesn't mean that $\nabla g\left(x_1,\dots,x_n\right)=0$.
$\nabla g$ is a vector, and with parametar $\lambda$ we can check when this vector is proportional to the vector $\nabla f$. If you remember that $\nabla f$ represent direction in which function $f$ grows, then proportionality of $\nabla g$ and $\nabla f$ tell us that curve $g=0$ is tangent to the levels of $f$ and that means that we have the stationary point of $f$ on the curve $g=0$.
Reading Wikipedia page on Lagrange multiplier should give you more motivation for the $\lambda$.