In the last post a proof of the spherical law of cosines was made.

For the figure below, following equality holds:

(***)

The earth is more like an ellipsoid but for computing the air distance with enough accuracy it is fine to consider it a sphere. Imagine that the earth is the sphere from the figure, has the GPS coordinates and has GPS coordinates . All the coordinate are expressed in radians. Note that the angle is the difference between longitudes because and are meridians:

The longitude of will be and the will be .

It follows that we can substitute those values in (***) to find :

= =

Having the angle, the length of the arc can be computed by multiplying with the earth radius.

Note that this formula holds for sure if both and are in the north hemisphere and if the difference between longitudes is smaller than . For other situations it may need some adjustments.