# Distance minimum distance between point and sphere

How can I find minimum distance between point and sphere ?

sphere properties :

position of center a,b,c redius of the sphere R

point properties

position x,y,z

-
That would be the distance between the sphere's center and the point, minus the radius? – J. M. Nov 25 '12 at 13:32
Calculate the distance between the point and the sphere's center and substract from here the sphere's radius (can you see why this is so?) – DonAntonio Nov 25 '12 at 13:32
$\left\vert\sqrt{(a-x)^2+(b-y)^2+(c-z)^2}-R\right\vert$ – Hagen von Eitzen Nov 25 '12 at 13:34
Hehe...within 2 minutes, 3 answers that look different yet they convey exactly the same. Ah, I love it when we mathematicians drive nuts non-mathematicians. – DonAntonio Nov 25 '12 at 13:37
Well, one of you three ought to post a real answer! – Rahul Nov 25 '12 at 13:40

$$\sqrt{(a-x)^2+(b-y)^2+(c-z)^2}-R$$
where $a,b,c$ are the center of the sphere, $x,y,z$ are the cartesian coordinates of your point and $R$ is the radius of your sphere.
If the point lies within the sphere, by this formula you'd get a negative value. In that case, just do $$|\sqrt{(a-x)^2+(b-y)^2+(c-z)^2}-R|$$ In Vectornotation: $$|(||\left( \begin{array}{c} a-x \\ b-y \\ c-z \end{array} \right)||_2-R)|$$