The Math Forum

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

Distance using Latitude and Longitude

Date: 12/31/97 at 11:28:30
From: Brian K. Reed
Subject: Distance using Lat and Long ?


Is there a simple formula for calculating distance using known 
latitude and longitude?

Thanks in advance,
Brian Reed
Senior Research Analyst
Booz*Allen & Hamilton

Date: 12/31/97 at 11:35:28
From: Doctor Rob
Subject: Re: Distance using Lat and Long ?


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

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).

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, and the arccosine is 
taken between 0 and 180 degrees, inclusive.

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

Date: 12/31/97 at 11:56:20
From: Reed Brian
Subject: RE: Distance using Lat and Long ?

Thanks!  This is just what I need!


Date: 11/16/98 at 12:45:35
From: Tom Reilly
Subject: Wrong formula

The answer from Dr. Rob to a student's question posting [see below] 
has an incorrect formula. 
 c = sin(phi1)*sin(phi2)*cos(theta1-theta2) + cos(phi1)*cos(phi2).

should be:

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

Date: 11/16/98 at 15:34:28
From: Doctor Rick
Subject: Re: Wrong formula

Hi, Tom. Did you notice the way Dr. Rob defined phi? If phi is simply 
the latitude (+ for north, - for south latitude), then your formula is 
correct - it is the formula I use. But  Dr. Rob defined phi as 90 - lat for north latitudes (90 + lat for south latitudes). This definition switches sines and cosines, since sin(90-phi) = cos(phi) 
and cos(90-phi) = sin(phi).

Dr. Rob defined phi this way because it is the standard way that 
spherical coordinates are defined. Admittedly it's a little confusing 
to those who are used to working with latitudes, but then, those who 
are NOT accustomed to latitude math are more likely to ask the question!

Mistakes do sometimes make it into our archives, and we appreciate 
diligent readers who catch these errors. But I don't think we are 
wrong here. Keep looking! :-)

- Doctor Rick, The Math Forum   

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.