56.3: The Cosine Formula
( \newcommand{\kernel}{\mathrm{null}\,}\)
The cosine formula from spherical trigonometry gives the angular separation between two points on the surface of a sphere, where the apex of the angle is at the center of the sphere. If the two points have latitudes ϕ1 and ϕ2 and longitudes L1 and L2, then the cosine formula gives the angular separation of the two points θ :
cosθ=sinϕ1sinϕ2+cosϕ1cosϕ2cos(L1−L2)
This formula may be used to compute, for example, the angular separation between two stars in the sky, where ϕ=δ and L=α are the celestial counterparts of latitude and longitude, called declination and right ascension, respectively (see Chapter 54). To find the distance s between two points on the Earth's surface, convert θ to radians and use s=R⊕θ, where R⊕=6371.0 km is the average radius of the Earth.
If the angular separation θ between the two points is small, better accuracy may be obtained by using the haversine function, hav(x). The haversine is defined by
havθ≡sin2(θ2)
and so the inverse haversine function is given by
hav−1y≡2sin−1√y.
Using the haversine function, the cosine formula can be replaced by
havθ=hav(ϕ1−ϕ2)+cosϕ1cosϕ2hav(L1−L2)