The Math Forum

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

Distance Between Two Points on the Earth

Date: 6/21/96 at 12:5:28
From: Jonathan Coopersmith
Subject: Distance Between Two Points on the Earth

Dear Dr. Math,

I have found your article on calculating the distance between two 
points given latitude and longitude, but I can't seem to come up 
with the right answer. I don't think I'm using your equations 

My latitude and longitude are in the form 40.266934, -74.204930 
respectively, with negatives for South and West. Given two points in 
this form, how do I calculate the distance between them?

Your help is greatly appreciated!

Thank you very much,

Date: 6/21/96 at 16:43:45
From: Doctor Anthony
Subject: Re: Distance Between Two Points on the Earth

I will repeat the calculation here as I am not sure if it is one of my 
posts to which you are referring.

The calculation is done using the scalar product of two vectors to 
find the angle between those vectors. Let the vectors be 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 coords 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.

I will do an example, finding the distance between point A at 
56 degrees west 33 degrees south, and point B at 12 degrees east and 
40 degrees north.  [Note, I shall be taking east and south as 

cos(AOB)= cos(-33)cos(40)cos(-12-56) + sin(-33)sin(40)
        = cos(33)cos(40)cos(68) - sin(33)sin(40)
        = -0.109417873

So AOB = 96.28175959 degrees
       = 1.680433715 radians 

Finally to get the great circle distance between A and B we need the 
value of R, the radius of the earth. This is about 6371 km or 3959 

In miles the distance between A and B is 6652.84 miles.

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