# How do I measure distance on a globe?

I have a 3-D sphere of radius R, centered at the origin.
(x1,y1,z1) and (x2,y2,z2) are two points on the sphere. The Euclidean distance is easy to calculate, but what if I were to restrict myself to traveling on the surface of the sphere?
Two approaches come to mind: use arc-length in some way, or simply use trigonometry: calculate the angle between the two points and get a distance from that.
Will both/either of these methods work? Which would be easier?

Somewhat related to this question. Maybe it will inspire someone to go answer it!

-
Just got out of my great-circle distance class, etc. –  Larry Wang Jul 27 '10 at 1:09
This is my answer on a somewhat related question--there, the question was finding angles (which is not entirely unrelated), but the bigger difference is that the points are described by latitude and longitude. The Spherical Law of Cosines and the diagrams there may be helpful. –  Isaac Aug 2 '10 at 4:33

What you are looking for is what is called the great circle distance: the shortest curve connecting two points on the surface of a sphere is given by traveling along the (there will be exactly one unless the points are polar opposites) arc of the great circle (that is, the circle of radius R) connecting them. So you do need to find an arc length but it is easy to do this without invoking calculus if you know about the dot product. Suppose the two points on the circle are represented by the vectors v and w. If v*w denotes the dot product of these two vectors, then the angle between them will be arccos(v*w/R^2) (we divide by R^2 since v and w have length R). Assuming this is in radians, to get the length of the arc connecting them we just multiply this angle by R to get R*arcos(v*w/R^2).

We are quite lucky that there is such a simple formula. For most manifolds, the curves that minimize distances are not very easy to find since it involves solving a non-linear differential equation (the geodesic equation). The fact that the sphere is so symmetric helps in this case, and you can maybe convince yourself that an arc of a great circle minimizes distance.

You may find this wikipedia article interesting: http://en.wikipedia.org/wiki/Geodesic.

-