Haversine Formula¶
A half-angle spherical-trigonometry relation that converts two latitude–longitude positions into their central angle and great-circle arc distance, with explicit radius, angle-unit, and numerical-boundary controls.
Core Idea¶
The haversine formula converts the latitude and longitude of two points on a sphere into their central angle and hence the length of the shorter great-circle arc between them. It does so through the half-angle function
For latitudes \(\varphi_1,\varphi_2\), longitude difference \(\Delta\lambda\), and sphere radius \(R\), form
Scope of Application¶
Literal uses arise whenever positions are represented on a sphere and a scalar shortest surface separation is required: celestial angular separation, idealized planetary or stellar surfaces, introductory great-circle navigation, rapid geographic proximity screening, database measurements under a declared spherical Earth option, simulation on spherical meshes, and validation fixtures for more elaborate geospatial systems.
The formula is often an appropriate approximation when application tolerances dominate Earth-figure error, when inputs are coarse, or when a fast preliminary filter will later hand close cases to an ellipsoidal solver. PostGIS exposes this decision explicitly: its spherical-distance operation is faster but less accurate than its spheroidal counterpart.
Clarity¶
A reader should be able to audit a Haversine calculation by answering eight questions:
- Are the two positions latitude–longitude pairs on the same reference surface and datum? 2. Are all trigonometric inputs in radians, or is conversion performed before evaluation? 3. How is longitude difference wrapped across the antimeridian? 4. Which radius is used, in what units, and why is that radius appropriate?
Manages Complexity¶
The formula compresses a three-dimensional shortest-path problem on a sphere into a fixed scalar pipeline: coordinate differences, two squared half-angle terms, inverse-haversine recovery, and radius scaling. The practitioner need not construct planes through the sphere's center, calculate Cartesian radius vectors, identify their great circle, or integrate an arc for every pair.
Abstract Reasoning¶
The point-pair relation is a specialization of spherical trigonometry. If the north pole and the two positions form a spherical triangle, the included angle at the pole is \(\Delta\lambda\), the relevant side lengths are related to the co-latitudes, and rearranging the spherical law of cosines with \(1-\cos x=2\sin^2(x/2)\) yields the haversine form.
Knowledge Transfer¶
The formula transfers literally across practices that share spherical angular coordinates and great-circle separation. A navigator comparing waypoints, an astronomer measuring angular separation after converting coordinates to a common spherical frame, and a simulation measuring nodes on a spherical shell instantiate the same roles. Only the radius, coordinate frame, and acceptable approximation change.
It also transfers as a software contract. A geospatial database, scientific library, embedded navigation routine, or spreadsheet can expose the same inputs, central-angle intermediate, radius policy, and error boundaries.
Relationships to Other Abstractions¶
Current abstraction Haversine Formula Domain-specific
Parents (1) — more general patterns this builds on
-
Haversine Formula is a kind of Metric Prime
The formula specializes Metric: its output is the geodesic distance on a sphere expressed through one coordinate relation.
Hierarchy path (1) — routes to 1 parentless root
- Haversine Formula → Metric → Function (Mapping)
Neighborhood in Abstraction Space¶
Haversine Formula sits in a sparse region of the domain-specific corpus (82nd percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.
Family — Unclustered & Miscellaneous (1565 abstractions)
Nearest neighbors
- Wiechel Projection — 0.88
- Hammer Projection — 0.88
- Trilateration — 0.81
- World Geographic Reference System — 0.80
- Karlsruhe Metric — 0.80
Computed from structural-signature embeddings · 2026-09-08