Why is sine-squared used in the haversine formula?

94 Views Asked by At

The traditional "haversine" formula for great-circle distance is traditionally expressed as

$$ 2R \arcsin\left(\sqrt{ \sin\left(\frac{\Delta\varphi}{2}\right)^2 + \cos\left(\varphi_1\right) \cos\left(\varphi_2\right) \sin\left(\frac{\Delta\lambda}{2}\right)^2 }\right) $$

See e.g. here.

Given the identity:

$$ \mathrm{haversin}\left( \theta \right) = \frac{1 - \cos\left( \theta \right)}{2} = \sin\left( \frac{\theta}{2} \right) ^2 $$

Why do we typically express the formula in terms of sine-squared, and not in terms of cosine? Does it look prettier? Is there an historical reason for doing it? Is it more numerically stable?

2

There are 2 best solutions below

2
On BEST ANSWER

Closely related to this question is MSE question 2874940 about cosine similarity. You can read my answer to that question there. Briefly, when an angle $\theta$ is small, then $\cos(\theta)$ is close to $1$ causing the difference $1−\cos(\theta)$ to lose significance (Catastrophic cancellation) while $\sin^2$ does not. The Wikipedia article Haversine formula explains this particular case.

0
On

My theory is that $\sin^2(x/2)$ is preferred because the result is always positive or zero, in contrast to answers containing $\cos(x)$ which does not make it so obvious.

Sometimes it is important to know when a quantity is non-negative, especially when used inside a radical.