I'm trying to find extrema of $f(x,y,z)=x^2+y^2-2z^2$ restricted to the curve that is the intersection of $z=x+y$; $x^2+y^2=4$.
I got the intersection by getting $|x|=\sqrt{4-y^2}$ and then replacing in $z$ to get $g(x,y,z)=\pm\sqrt{4-y^2}+y-z$.
However, when I try to say that $\nabla f= \lambda \nabla g$ I get the problem that I have two different values of g (one positive, one negative) when I try to get the gradient vector. What can I do about it?
You can use the method of Lagrange multipliers with two constraints given by $g_1=0$ and $g_2=0$; introduce a second Lagrange multiplier: $$\nabla f= \lambda \nabla g_1 +\mu \nabla g_2$$ In your case, you can take $g_1 = z-x-y$ and $g_2 = x^2+y^2-4$.