04 // Interactive Formula Compendium // GEOMETRY-TRIGd = 2R · arcsin( √[ sin²(Δφ/2) + cos(φ₁) cos(φ₂) sin²(Δλ/2) ] )
Haversine Formula — Great-Circle Geodesic Distance on a Sphere
The Haversine formula determines the great-circle distance d between two points (φ₁, λ₁) and (φ₂, λ₂) on a sphere of radius R via d = 2R arcsin(√[sin²(Δφ/2) + cos(φ₁)cos(φ₂)sin²(Δλ/2)]), avoiding small-separation rounding errors.
Formula Reference
Main Formula
d = 2R · arcsin( √[ sin²(Δφ/2) + cos(φ₁) cos(φ₂) sin²(Δλ/2) ] )
Rearranged Forms
hav(θ) = sin²(θ / 2) = (1 − cos θ) / 2 (Haversine Function)
a = sin²(Δφ/2) + cos(φ₁) cos(φ₂) sin²(Δλ/2)
d = R · 2 atan2(√a, √(1 − a)) (Numerically Stable Form)
Variables & Units
| Symbol | Name | Unit |
|---|---|---|
| d | Great-Circle Geodesic Distance (d) | km |
| lat1 | Origin Latitude φ₁ (degrees) | deg |
| lon1 | Origin Longitude λ₁ (degrees) | deg |
| lat2 | Destination Latitude φ₂ (degrees) | deg |
| lon2 | Destination Longitude λ₂ (degrees) | deg |
Inputs & Parameters
[deg]
[deg]
[deg]
[deg]
Calculated Result (Great-Circle Geodesic Distance (d))
d =5,570.23km
Formula Notes & Background
- Start with the spherical law of cosines: cos(c) = sin(φ₁)sin(φ₂) + cos(φ₁)cos(φ₂)cos(Δλ), where c = d/R is the central angle.
- Replace cos(θ) with 1 − 2sin²(θ/2) = 1 − 2 hav(θ) to eliminate subtraction of nearly equal cosines at short distances.
- Solve for hav(d/R) = hav(Δφ) + cos(φ₁)cos(φ₂)hav(Δλ) and invert via d = 2R arcsin(√a).
Step-by-Step Examples
#1: Calculate the great-circle flight distance from New York (40.7128°N, 74.0060°W) to London (51.5074°N, 0.1278°W).
φ₁ = 40.7128°, λ₁ = −74.0060°φ₂ = 51.5074°, λ₂ = −0.1278°R = 6,371.0 km
Δφ = 10.7946°, Δλ = 73.8782° ⇒ a = 0.18995 ⇒ c = 2 arcsin(√0.18995) = 0.87442 rad
→ d = 5,570.9 km (3,461.6 miles)
#2: Find the surface distance along the equator across Δλ = 1° of longitude (φ₁ = φ₂ = 0°).
φ₁ = 0°, φ₂ = 0°Δλ = 1°
d = 6371.0088 × (π / 180)
→ d = 111.195 km per degree of equatorial longitude
Was this tool helpful?
Frequently Asked Questions
Why is the Haversine formula preferred over the spherical law of cosines for short GPS distances?+
For points a few meters apart, cos(d/R) is 0.9999999999..., which loses precision in IEEE 754 floats, whereas sin²(Δφ/2) preserves full precision near zero.
How accurate is Haversine on the real oblate Earth?+
Because Earth bulges 0.335% at the equator, spherical Haversine has a maximum error of ~0.3% (compared to Vincenty's WGS-84 ellipsoid formula).
What earth radius R does the IUGG recommend for spherical calculations?+
The IUGG mean volumetric/authalic radius is R = 6,371.0088 km (3,958.7613 statute miles).