find points on intersection between cone and plane cone $z^2=x^2+y^2$ is cut by plane $z=1+x+y$ and the intersection is curve C.
Find the points on C that is nearest and furthest to origin.
This problem is related to lagrange multipler, but all the examples we learn are in form of $f(x,y,z) = something$. So I'm really lost.
My try:
let $f(x,y,z)=x^2+y^2-z^2$,
then $g(x,y,z) = 1+x+y-z = 0$
$\triangledown f = (2x,2y,-2z)$
$\triangledown g = (1,1,-1)$
then I have to find $\triangledown f = \lambda \triangledown g$ and use hessein to check maxiunm and minimum
and i have no idea how to proceed.
My biggest question would be how to deal with equations like this $z^2=x^2+y^2$, how do I transform them into $f(x,y,z)$? Do I parameterize it?
thank you in advance
 A: This is a "two constraint" problem.  You need to minimize and maximize the square of the distance $h(x,y,z) = x^2+y^2+z^2$ subject to your two equations.  You solve the system $\nabla h = \lambda \nabla f+\mu \nabla g.$  There are two "multipliers" here.
A: $f(x,y,z) = x^2+y^2+z^2$
$g_1(x,y,z) = x^2+y^2-z^2=0$
$g_2(x,y,z) = x+y-z+1 = 0$
$\nabla f = \lambda \nabla g_1+\mu \nabla g_2$ 
$2x\hat i+2y\hat j+2z\hat k = \lambda(2x\hat i+2y\hat j-2z\hat k) +\mu (\hat i + \hat j -\hat k)$
$2x = 2\lambda x +\mu$
$2y = 2\lambda y +\mu$
$2z = -2z\lambda -\mu$
$(\lambda-1)x = z(1+\lambda)$
$(\lambda-1)y = z(1+\lambda)$
Either $\lambda = 1$ and $z=0$ or $x=y$ and $\lambda \ne 1$
if Case 1)
$z = 0$
$x+y = -1$, $x^2+y^2 = 0$
$xy = \frac{1}{2}$
Using the identity $(a-b)^2 = a+b)^2 - 4ab$
find $x$ and $y$
You will find two points ($P_1$ and $P_2$) to be $(-\frac{1+i}{2},\frac{-1+i}{2},0)$ and $(\frac{-1+i}{2}, -\frac{1+i}{2},0)$
Other case 2)
$x = y$
$2x^2 = z^2$
$2x = z-1$
Find $x$ and $z$ using the above equations.
You will find points $P_3$ and $P_4$  to be $(-1+\frac{1}{\sqrt{2}},-1+\frac{1}{\sqrt{2}},-1+\sqrt{2})$ and $(-1-\frac{1}{\sqrt{2}},-1-\frac{1}{\sqrt{2}},-1-\sqrt{2})$
I will leave it to you for find the closest and farthest to the origin. (substitute the value of $P_1,P_2,P_3,P_4$ in f(x,y,z) and figure it out)
