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

Alternative way:
We have found that $x=0$, and we need $|z| \le 4$,
\begin{align}x^2+y^2+(z-1)^2&=\frac{16-z^2}2+(z-1)^2 \\
&=\frac{16+z^2-4z+2}{2}\\
&=\frac{(z-2)^2-4+16+2}{2}\\
&=\frac{(z-2)^2}{2}+7\end{align}
Note that $|2| \le 4$, and hence the smallest distance is $\sqrt{7}$.
