The Math Forum

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

Longitude and Latitude to Determine Distance

Date: 5/21/96 at 21:9:50
From: Peter Atlas
Subject:Longitude and Latitude to Determine Distance

On the College Geometry page, a user writes in asking:

I've been looking for the equation that finds the distance between
two cities, given the latitude and longitude of both cities.

I am a high school teacher, and quite interested in this question. Is 
there a way to solve it using rectangular coordinates (my students 
don't study spherical geometry)? 
I have the formula:

distance (along a great circle) = R * ACos[sin(lat1)*sin(lat2) +

but can't seem to derive it using only rectangular coordinates.

Thank you for your help,
Peter Atlas

Date: 6/17/96 at 18:31:38
From: Doctor Anthony
Subject: Re: Longitude and Latitude to Determine Distance

I have used my own notation, but you should be able to see how it fits 
in with the equation you quote.

This problem can be done 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.

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