The haversine formula
It might seem straightforward to pull out a map and measure the distance between two distant points, however, the larger the distance the bigger the distortion caused by traveling on the curved surface of the Earth as opposed to flat 2D space. So while the distance you measure to your neighbouring town won't be too bad, if you're measuring between London and Rio the curvature of the Earth will make a big difference to the distance that you'll travel. To help figure out the correct distance there's the haversine formula.
The haversine formula allows you to calculate the shortest distance between two points on a sphere using their latitudes and longitudes — this will be the arc between them on the great circle that includes both points. A great circle is a circle on a sphere with the same centre as the sphere, like the Equator. The haversine formula isn't perfect in practice, as Earth isn't a perfect sphere — see the 3 tallest mountains.
It was invented around two hundred years ago, together with tables to speed any calculations, to help sailors navigate.
Also see, the Mercator projection