Find the smallest distance between point and ellipsoid 
Find the smallest distance between the points on the ellipsoid $x^2+2y^2+z^2=16$ and the point $(0,0,1)$.

Answer:
Let $(x,y,z)$ be the closest point of the ellipsoid. The distance is
$$\sqrt{x^2+y^2+(z-1)^2}$$
Let $f(x,y,z)=x^2+y^2+(z-1)^2$. Construct the Lagrangian:
$$L(x,y,z)=x^2+y^2+(z-1)^2+\lambda (x^2+2y^2+z^2-16)$$ 
For smallest distance,
$$L_x=0 \Rightarrow x(\lambda+1)=0\\
L_y=0 \Rightarrow y(2 \lambda+1)=0\\
L_z=0 \Rightarrow z(\lambda+1)=1$$
The 3rd equation implies that $\lambda\ne-1$. Thus we have $x=0$. Now 2nd and 3rd equation solution gives $y=0$ or $\lambda=-\frac12$ and $z=\frac1{1+\lambda}$.
But I can not find the final solution .
Help me out

If $\lambda=-\frac12$, $z=2$ and from the original constraint $x^2+2y^2+z^2=16$ (where $x=0$ as shown prior) we get $y=\pm\sqrt 6$. In this case, the distance is $d=\sqrt{0^2+\sqrt6^2+(2-1)^2}=\sqrt7$.
If $y=0$, from the original constraint we have $z=4\lor z=-4$, which give $d=\sqrt{0^2+0^2+(4-1)^2}=3$ and $d=\sqrt{0^2+0^2+(-4-1)^2}=5$ respectively.
$\sqrt7$ is thus the shortest distance from $(0,0,1)$ to the ellipsoid, the closest points being $(0,\pm\sqrt6,2)$.
