| MadSci Network: Earth Sciences |
It is not a simple matter. Some fairly complicated trigonometry is required to derive the formula. Quite apart from that, there are some extra complications.
The Earth is not a sphere. It is significantly flattened at the poles. The equatorial radius of the earth is 6378.5 km, while the polar radius is 6356.9 km. Calculating the lengths of elliptical arcs is ridiculously complicated.
But for most purposes, we could assume that the earth is a sphere with a radius of 6371.3 km, and that we are dealing with circular arcs. The error could be as large as 1 part in 1000, but will probably be rather less.
The second point that we need to clarify is whether we are talking about arc distance (over the earth's surface) or straight line distance (which would tunnel through the earth to get there by the shortest route. I will assume that you are wanting the arc distance.
The formula for straight line distance works out as:
stlinedist = 6371.3 * sqrt( 2 - 2 * cos[lat1] * cos[lat2] * cos[longdiff] - 2 * sin[lat1] * sin[lat2] )
where lat1 is the latitude of the first point, lat2 is the latitude of the second point, and longdiff is the difference in longitude.
Surface distance is obtained from straight line distance by
surfdist = 12742.6 * arcsin (stlinedist/12742.6)
where the arcsin function has to be calculated in radians.
I notice that you have not put in a grade level. I hope you can cope with this much maths. If not, the essence of my answer is that the calculation can be made accurately and straightforwardly, but it is rather complicated.
Try the links in the MadSci Library for more information on Earth Sciences.