The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Finding Distance Using the Earth's Grid System

Date: 08/05/97 at 22:28:15
From: Nathan Grand
Subject: Finding distance using the earth's grid system

Dr. Math,
My question is: How do I find the distance between two points on the 
earth using degrees of latitude and longitude, and how do I find the 
shortest way to get there? 

I have a feeling that my question may lie in the way an airplane 
taking off from Washington, U.S.A and travelling to Japan banks off 
the North Pole instead of going straight to Japan. 

Please help me in my quest to find the answer. 

Date: 08/06/97 at 08:21:13
From: Doctor Jerry
Subject: Re: Finding distance using the earth's grid system

Hi Nathan,

Assuming the earth is a sphere and you want the great circle distance 
between two points:

Let (x,y,z) be a point on a sphere of radius a. The spherical 
coordinates of (x,y,z) are (a,phi,theta), where phi is like latitude, 
but it is measured from the positive z-axis. The angle phi varies 
between 0 and pi. The angle theta is like longitude, but is measured 
from the positive x-axis (towards the positive y-axis).  The angle 
theta varies between 0 and 2*pi.

If you are given the spherical coordinates (a,phi,theta) of a point, 
the (x,y,z) coordinates are given by

x = a*cos(theta)*sin(phi)
y = a*sin(theta)*sin(phi}
z = a*cos(phi).

So, if you have a point on the earth's surface, you know the number a, 
which is the radius of the earth, you know or can easily calculate phi 
from the latitude, and you know or can easily calculate theta from the 

So, suppose you are given the points (a,phi_1,theta_1) and 
(a,phi_2,theta_2). The first thing to do is to calculate the 
rectangular coordinates r_1=(x_1,y_1,z_1) and r_2=(x_2,y_2,z_2) of 
these points, as above. After that, letting alpha be the angle between 
the lines joining the center (0,0,0) of the sphere to r_1 and r_2, use 
the dot product of the vectors r_1 and r_2 to calculate alpha.

You will find that 

alpha= arccos(r_1.r_2/a^2) = arccos(cos(phi_1)*cos(phi_2)

The great circle distance between r_1 and r_2 is 

d = a*arccos(alpha).  

-Doctor Jerry,  The Math Forum
 Check out our web site!   

Date: 08/06/97 at 12:17:01
From: Doctor Anthony
Subject: Re: Finding distance using the earth's grid system

This can be done quite easily by using the scalar product of
two vectors to find the angle between those vectors. If the
vectors are OA and OB where A and B are the two points on
the surface of the earth and O is the centre of the earth,
the scalar product gives OA*OB*cos(AOB) = R^2*cos(AOB)
where R = radius of the earth. Having found angle AOB the
distance between the points is R*(AOB) with AOB in radians.

To find the scalar product we need the coordinates of the
two points. Set up a three-dimensional coordinate system
with the x-axis in the longitudinal plane of OA and the xy
plane containing the equator, the z-axis along the earth's
axis.  With this system, the coordinates of A will be

Rcos(latA), 0, Rsin(latA)

and the coordinates of B will be


The scalar product is given by xA*xB + yA*yB + zA*zB

= R^2cos(latA)cos(latB)cos(lonB-lonA)+ R^2sin(latA)sin(latB)

Dividing out R^2 will give cos(AOB)

cos(AOB) = cos(latA)cos(latB)cos(lonB-lonA)+sin(latA)sin(latB)

This gives AOB, and the great circle distance between A and
B will be
             R*(AOB)   with AOB in radians.

The great circle path is the shortest route, but that means you cannot 
steer a single magnetic course to follow this path. If the two points 
are in the Northern Hemisphere, you would find that the path tends 
north of the straight line path drawn on a conventional map. There are 
various map projections which allow you to plot the great circle as a 
straight line, and you will find that this line cuts lines of 
longitude at varying angles along its length.

-Doctor Anthony,  The Math Forum
 Check out our web site!   
Associated Topics:
High School Geometry
High School Higher-Dimensional 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

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.