The great-circle distance is calculated between two points along a
spherical surface using the shortest distance and disregarding
topography.
Method 1: Haversine Formula
$$a = \sin^2((\phi_2 - \phi_1)/2) + \cos(\phi_1) \cos(\phi_2) \sin^2((\lambda_2 - \lambda_1)/2)$$
$$c = 2~\mathrm{atan2}(\sqrt{a}, \sqrt{1-a})$$
$$d = R c$$
where
\(\phi\) = latitude (in radians),
\(\lambda\) = longitude (in radians),
\(R\) = radius (km) of the Earth,
\(a\) = square of half the chord length between the points,
\(c\) = angular distance in radians,
\(d\) = great-circle distance (km) between two points.
Method 2: Spherical Law of Cosines
$$d = \mathrm{acos}(\sin(\phi_1)\sin(\phi_2) + \cos(\phi_1)\cos(\phi_2)\cos(\lambda_2 - \lambda_1)) R$$
The initial bearing (aka forward azimuth) for the start point can be calculated using:
$$\theta = \mathrm{atan2}(\sin(\lambda_2-\lambda_1)\cos(\phi_2), \cos(\phi_1)\sin(\phi_2) - \sin(\phi_1)\cos(\phi_2)\cos(\lambda_2-\lambda_1))$$