I've been practicing for exams today and one of the problems involved finding max of a surface given another surface as restriction.
$f(x, y, z) = x^2 + 2y^2 + 3z^2:$ The surface
$g(x,y,z) = x^2 + y^2 + z^2 = 4:$ The restriction.
The problem is that in class we learned that the Lagrangian is $L(x,y,z,\lambda)=f(x,y,z)+\lambda g(x,y,z).$
But also the theory is that $\nabla f(x,y,z) = \lambda\nabla g(x,y,z).$ How can this be true? If I move the right side to the left I get $\nabla f(x,y,z) - \lambda\nabla g(x,y,z),$ but the Lagrangian is given as $f(x,y,z)+\lambda g(x,y,z).$ I know the former uses gradients but to my knowledge partial differentiation doesn't change positive to negative. Please help me understand.
This is a matter of notation, and probably you're studying from two different sources. Some authors prefer to write the Lagrangian as
$$ L({\bf x}) = f({\bf x}) \color{red}{-}\lambda g({\bf x}) \tag{1a} $$
which leads to
$$ \nabla_{\bf x} f({\bf x}) = \color{red}{+}\lambda g({\bf x}) \tag{2a} $$
While other authors write
$$ L({\bf x}) = f({\bf x}) \color{orange}{+}\lambda g({\bf x}) \tag{1b} $$
resulting in
$$ \nabla_{\bf x} f({\bf x}) = \color{orange}{-}\lambda g({\bf x}) \tag{2b} $$
You just need to be aware of the convention the author is using and make sure you keep it until the end