for f(x,y,z) find point on surface nearest to origin $f(x,y,z)=x^2+2y^2-z^2$, $S=\{(x,y,z): f(x,y,z)=1\}$ find point on S nearest to origin.
I thought I would use Lagrange multipliers to solve this problem, but when I use $f(x,y,z)=x^2+2y^2-z^2$ and $g(x,y,z)=x^2+2y^2-z^2-1$, along with,
$$g(x,y,z)=0$$
$$f_x=\lambda g_x$$
$$f_y=\lambda g_y$$
$$f_z=\lambda g_z$$
I am getting not so good answers.  How to solve this type of problem

The distance from $(x,y,z)$ to the origin is $\sqrt{x^2+y^2+z^2}$.
We therefore want to minimize $\sqrt{x^2+y^2+z^2}$, or equivalently $x^2+y^2+z^2$, subject to the condition $x^2+2y^2-z^2-1=0$. So $x^2+y^2+z^2$  should be your $f$. Now the usual process should work well.
