How do Lagrange multipliers work with functions of 3 variables?

148 Views Asked by At

I've been trying to imagine the workings of Lagrange multipliers for functions $\mathbb{R^3}\rightarrow \mathbb{R}$.

So, say we have a function $f(x,y,z)$. If we had one constraint (one level surface, say $g(x,y,z)=k$), then we could imagine this as follows: for every point on the surface of $g(x,y,z)=k$, we calculate $\nabla f$ and $\nabla g$ at those points, and then compare them. And when they're equal, we know that at this point $(x,y,z)$ there is either a maximum or minimum value (actually, I am not sure here, as well, will we get a maximum when we compare $\nabla f=\lambda\nabla g$, and minimum when $\nabla f=-\lambda\nabla g$? Please, clear this up for me, as well), since from here we can't move anywhere else to find an even higher (or lower) slope.

So this was one constraint. Given two constraints (say, another level sphere $h(x,y,z)$, we are likely to be working with a curve (intersection of two surfaces). So in this case what is really going on? It looks to me like it is going to be similar to the case when we are working with $\mathbb{R^2}\rightarrow \mathbb{R}$ functions, in that we are working with a curve (most likely), but in $\mathbb{R^3}\rightarrow \mathbb{R}$ case the gradient vectors are 3D, is that correct?

I have this formula which weren't really explained in my book: $$\nabla f=\lambda\nabla g+\mu \nabla h$$ What is it really saying, and where does it come from?