<s>[INST] Distance between set and point, confused of partial derivatives. Let $H = \{(x,y,z)\ \in \mathbb{R}^{3}: x^2+y^2 - z^2 + 4 = 0$
Compute the shortest distance between H and point $p=(2,4,0)$.
I am a bit confused because I tried a direct approach.
$$ x^2+y^2 + 4 =  z^2$$
Let $D(H,p) = \sqrt{(2-x)^{2}+(4-y)^{2} + x^{2} + y^{2}+4}$
So I tried compute $$\frac{\partial D}{\partial x} = (\sqrt{2} (-1 + x))/\sqrt{12 - 2 x + x^2 - 4 y + y^2}$$
$$\frac{\partial D}{\partial y} = (\sqrt{2} (-2 + y))/\sqrt{12 - 2 x + x^2 - 4 y + y^2}$$
It seems not nice to compare with zero.
Do you have another idea?
 [/INST] 
Let $H = \{(x,y,z)\ \in \mathbb{R}^{3}: x^2+y^2 - z^2 + 4 = 0\}$.
Compute the shortest distance between $H$ and the point $P\equiv(2,4,0)$.

Approach other than Lagrange's multipliers:
Since the graph is symmetric in $\phi$, you can also minimize $(\sqrt{2^2+4^2}-r)^2+(r^2+4)=2r^2-2\sqrt{20}r+24$ for some $r$, where $\sqrt{(\sqrt{2^2+4^2}-r)^2+(r^2+4)}$ is the distance between the point $(\sqrt{2^2+4^2},\phi,0)$ and $(r,\phi,z)$.

</s>