Associated Topics || Dr. Math Home || Search Dr. Math

### Distance Between Points on the Earth

```
Date: 12/11/97 at 21:21:31
Subject: Proofs for Non-Euclidian Geometry

The problem is to solve for the distance between two latitude/
longitude points with no parallels, say...  24N 70E and 65N and 30W.
The actual points are irrelevant as long as they do not share a
meridian or parallel.

I began trying to solve this problem by trying to solve for the angle
between the points and the center of the earth. Along that line, I
planned to use that angle "X" in the formula: (X/360) (2pi Radius),
like finding the length of a chord on the circle made when the sphere
is intersected by the plane containing both points and the center of
the earth.

After realizing that there are x,y,and z- axis measurements for the
points on the surface of the sphere, I realized it was a bit more
complicated. I planned to break this line down into its three axis
components by doing sort of a reverse-vector addition type maneuver,
which miraculously worked.

This involved making a cube with the center of the earth at one corner
and inscribing 90 degree arcs in each of the three two-dimensional
planes: XY, XZ, and YZ. Accordingly I assumed that since the radius of
the earth is about 6400kM, this value could be placed as the three
axes radiating from the earth's center point. Then I inserted the
north latitude measurements (on separate graphs), solved using the
side-angle-side method for the third side, used this for the height of
the XY component, and then solved for the XZ and YZ components. This
left me with two different Cartesian coordinates; one for each point
(IN 3-D).

Here is the real problem: I know how to find the angle between two
points on a 2-D graph, relative to the origin; just find each
individual angle and take the absolute value of one minus the other.
But HOW ON DARWIN'S GREEN-AND-EVOLVING EARTH DO YOU DO THE SAME FOR
THREE DIMENSIONS?

If the Good Doctor, or anyone else knows any of the following...

1)   Is my method reasonably accurate?
1.b) If not, why not?
2)   Is there an easier formula than this?
2.b) If so, how much do I pay you for it?  and
2.c) If terms 2 and 2b are respectively affirmative and reasonable,
then can any type of geometric proof be applied in this situation to
make sure that people don't give me looks when I whip out this 10+
page math problem?

....then I would greatly appreciate sharing the solutions. I have
spent in excess of three hours of intense concentration deeply
pondering this problem, and all of the above procedures are of my own
creation. I don't want an answer to the question so much as a formula
to solve it.

Thank you, Doctor Math
```

```
Date: 12/31/97 at 11:53:26
From: Doctor Rob
Subject: Re: Proofs for Non-Euclidian Geometry

1.b. Not applicable.
2.   Yes, see below.
2.b. It is free.
2.c. The proof is embodied in the formulas connecting rectangular and
spherical coordinates, together with the fact that the dot
product of two vectors is the product of their lengths times the
cosine of the angle between them.  The formulas are:

x = r*sin(theta)*sin(phi),
y = r*cos(theta)*sin(phi),
z = r*cos(phi),
r = Sqrt[x^2+y^2+z^2],
phi = arctan(Sqrt[x^2+y^2]/z),
theta = arctan(x/y),

where phi is the angle the line containing the origin and (x,y,z)
makes with the z-axis, theta is the angle the plane containing
(x,y,z) and the z-axis makes with the xz-plane, and r is the
distance of (x,y,z) from the origin.

The dot product of (x1,y1,z1) and (x1,y2,z2) is
x1*x2 + y1*y2 + z1*z2 on the one hand, and on the other, it is
Sqrt[x1^2+y1^2+z1^2]*Sqrt[x2^2+y2^2+z2^2]*cos(t), where t is the
central angle.

Assume the Earth is a perfect sphere.  Let all angles be measured in
degrees.

If the latitude is North, let phi = 90 - latitude. If the latitude is
South, let phi = 90 + latitude. The North Pole has phi = 0, the South
Pole has phi = 180, and 0 <= phi <= 180.

If the longitude is East, let theta = longitude.  If the longitude is
West, let theta = -longitude.  Greenwich, England, has theta = 0, and
-180 <= theta <= 180.

Let the angles for the two points be (phi1, theta1) and (phi2,
theta2). Then compute

c = sin(phi1)*sin(phi2)*cos(theta1-theta2) + cos(phi1)*cos(phi2).

c is the angle at the center of the sphere made by radii from the
center to the two points.  Then the shortest great circle distance
between the two points is

d = R*Arccos(c)*Pi/180,

where R is the radius of the earth in miles (or kilometers), and the
arccosine is taken between 0 and 180 degrees, inclusive.

-Doctor Rob,  The Math Forum
Check out our web site!  http://mathforum.org/dr.math/
```
Associated Topics:
College Non-Euclidean Geometry
High School Non-Euclidean Geometry

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search