<s>[INST] The shortest distance from surface to a point Many have asked the question about finding the shortest distance from a point to a plane. I have checked those questions and answers and haven't found what I am looking for. Might still have missed some question though. 
I have a problem where I am to calculate the shortest distance from the surface $z = x^2 + 3y^2$ to the point $P = (5, 0, 1)$
I want to use the Langrange multiplier for this. 
This is what I have done: 
I am to minimize $$(x-5)^2 + y^2 + (z - 1)^2$$
s.t.
$$x^2 + 3y^2 - z = 0$$
So the Lagrange function is 
$$L(x, y, z, \lambda) = (x-5)^2 + y^2 (z-1)^2 + \lambda(x^2 + 3y^2 - z)$$
I have taken the gradient of $L$ and am looking for where each partial derivative equals to zero. 
And I am stuck. Is $\lambda = 1/3$? It seems like that, otherwise $y=0$. But if $y\neq 0$ and lambda is $1/3$ then I get that $y=0$ anyway :/ 
 [/INST] Set
$$f(x,y,z)=(x-5)^2+y^2+(z-1)^2$$
$$g(x,y,z)=z-x^2-3y^2=0$$
By application of Lagrange method, we have 
$$\nabla f=\lambda \nabla g$$
$$(2x-10\,,\,2y\,,\,2z-2)=\lambda(-2x\,,\,-6y\,,\,1)$$
therefore
$$\left\{ \begin{align}
  & y=0\,\,\,\,\quad\Rightarrow \,\,\,z={{x}^{2}} \\ 
 & \lambda =-\frac{1}{3}\,\,\,\Rightarrow \,\,\,x=\frac {15} 2\,\,\,\,,\,\,z=\frac{5}{6} \\ 
\end{align} \right.$$
Case 1
$y=0\quad,\quad z=x^2$
$$f(x,0,x^2)=(x-5)^2+(x^2-1)^2=x^4-x^2-10x+26$$
Now you should minimize $f(x,0,x^2)$
Case 2
$x=\frac {15} 2\,\,\,\,,\,\,z=\frac{5}{6} $
$$g\left(\frac {15} 2,\,y\,,\frac{5}{6}\right)=\frac{5}{6}-\frac{225}{4}-3y^2=0$$
therefore
$$y=\pm \frac{\sqrt{185}}{3}$$
Now you should calculate $f\left( \frac{15}{2},\frac{\sqrt{185}}{3},\frac{5}{6} \right)$ and $f\left( \frac{15}{2},-\frac{\sqrt{185}}{3},\frac{5}{6} \right)$
</s>