# Thread: function for distance from a point outside a sphere to any point on its surface

1. ## function for distance from a point outside a sphere to any point on its surface

Hi

I have a point m outside a sphere. The sphere center is o and r is the radius of sphere. Distance from point m to o is l.
If we draw a line from m to any point on the surface of sphere, this line has a length. Minimum length is l - r and maximum length would be l + r.
I want the function for distance from m to any point on the surface of sphere. Also how to draw the graph of this function (all possible distances).

2. ## Re: function for distance from a point outside a sphere to any point on its surface

We can set up a coordinate system in which the sphere has center at the origin and the given point, m, is on the z-axis. The equation of the sphere in that coordinate system is $x^2+ y^2+ z^2= r^2$ and m is (0, 0, l). Given a point (x, y, z) on the sphere, above the xy-plane, then $z= \sqrt{r^2- x^2- y^2}$ then the distance from m to that point is $\sqrt{x^2+ y^2+ (l- \sqrt{r^2- x^2- y^2})^2}$. If (x, y, z) is below the xy-plane, $z= -\sqrt{r^2- x^2 y^2}$ then the distance is $\sqrt{x^2+ y^2+ (l+ \sqrt{r^2- x^2- y^2})^2}$.

3. ## Re: function for distance from a point outside a sphere to any point on its surface

Thanks. That was exactly what I was looking for.