Initial Heading⚠ unverified
Aerospace / Navigation · Initial great-circle heading between two points
Parameters
| Input | Symbol | Unit | Default | Description |
|---|---|---|---|---|
| lat1 | lat1 | deg | 0.0 | Start latitude |
| lon1 | lon1 | deg | 0.0 | Start longitude |
| lat2 | lat2 | deg | 1.0 | End latitude |
| lon2 | lon2 | deg | 1.0 | End longitude |
| Output | Symbol | Unit | Description |
|---|---|---|---|
| hdg | ψ | deg | Heading |
The science & history
Understanding the Parameters
-
Bearing convention — measured clockwise from true north: $0^\circ$ = north, $90^\circ$ = east, $180^\circ$ = south, $270^\circ$ = west. This is the standard aviation/marine convention, and the reason the formula uses $\operatorname{atan2}(\text{east-ish}, \text{north-ish})$ rather than the mathematician's counter-clockwise-from-east angle.
-
Why $\operatorname{atan2}$, not $\arctan$ — the two-argument $\operatorname{atan2}(y,x)$ returns the correct angle in all four quadrants and handles the poles/antimeridian gracefully, whereas a plain $\arctan(y/x)$ loses the quadrant and blows up when $x=0$. Navigation bearings span the full $360^\circ$, so $\operatorname{atan2}$ is mandatory.
-
The bearing changes along a great circle — this is the key conceptual point. A great circle (except the equator and meridians) crosses each meridian at a different angle, so a great-circle flight is constantly altering heading. A New York–Tokyo great circle departs heading roughly north, sweeps over the Arctic, and arrives heading roughly south. The "initial" heading is just the first value; flight computers recompute it continuously.
-
Contrast with the rhumb line — a rhumb line (loxodrome) holds a constant compass heading, appearing straight on a Mercator chart, but is longer than the great circle (except along a meridian or the equator). Old ships sailed rhumb lines for simplicity; modern aircraft fly great circles for efficiency, accepting the continuously-varying heading that this formula's "initial" caveat flags.
-
True vs magnetic — this is the true bearing (from geographic north). To fly it with a magnetic compass, apply the local magnetic declination (variation), as in Magnetic Heading.
Derivation (Approaching a Proof)
The initial bearing is the angle at the origin vertex of the spherical triangle formed by the origin, the destination, and the North Pole. Work it out with vectors, which cleanly yields the $\operatorname{atan2}$ arguments.
At the origin, set up the local tangent-plane axes: north (toward the pole along the meridian) and east (perpendicular, toward increasing longitude). The bearing $\psi$ is the angle from north to the initial direction of the great circle, measured toward east:
$$\tan\psi = \frac{(\text{east component of the initial direction})}{(\text{north component})}.$$
The initial direction of the great circle toward the destination, projected onto these axes, gives (from spherical trigonometry / the derivative of the position along the geodesic):
$$\text{east} = \sin\Delta\lambda\,\cos\phi_2, \qquad \text{north} = \cos\phi_1\sin\phi_2 - \sin\phi_1\cos\phi_2\cos\Delta\lambda,$$
where $\Delta\lambda = \lambda_2 - \lambda_1$. The east component is largest when the destination is due east and far in longitude; the north component is the "how much more poleward" term. Taking the four-quadrant arctangent:
$$\psi = \operatorname{atan2}(\text{east}, \text{north}) = \operatorname{atan2}\!\big(\sin\Delta\lambda\cos\phi_2,\; \cos\phi_1\sin\phi_2 - \sin\phi_1\cos\phi_2\cos\Delta\lambda\big),$$
and finally normalise into $[0^\circ,360^\circ)$ by adding $360^\circ$ and taking the modulus. $\qquad\blacksquare$
Sanity checks. Two points on the equator ($\phi_1=\phi_2=0$) give north $= 0$ and east $=\sin\Delta\lambda$, so $\psi = 90^\circ$ (due east) for an eastward destination — correct. A destination due north on the same meridian ($\Delta\lambda=0$, $\phi_2>\phi_1$) gives east $=0$ and north $>0$, so $\psi=0^\circ$ — correct.
Dimensional check. Both $\operatorname{atan2}$ arguments are products of sines/cosines (dimensionless), so $\psi$ is a pure angle ✓.
History and Development
-
The spherical triangle. Computing a bearing is solving the "PZX triangle" (Pole–Zenith–star, or here Pole–origin–destination) of classical spherical astronomy and navigation — the same apparatus mariners used with sextants and nautical almanacs for centuries.
-
Great circle vs rhumb line. The tension between the shortest path (great circle, varying heading) and the simplest to steer (rhumb line, constant heading) shaped centuries of navigation. Gerardus Mercator's 1569 projection was revolutionary precisely because it turned rhumb lines into straight lines, at the cost of distorting the great circles into curves.
-
Flight management systems. Modern FMS and GPS receivers compute the great-circle bearing to the active waypoint continuously, updating the commanded heading as the aircraft moves — the practical realisation of "initial heading recomputed everywhere." Combined with the cross-track error, it keeps an aircraft on the intended geodesic.
Related Concepts: Great-Circle Distance, Cross Track Error, Magnetic Heading, Time To Go, Ground Track Velocity
Notes: Registry latex is the placeholder $\operatorname{atan2}(\ldots)$; real form is the four-quadrant arctangent above. True bearing, clockwise from north, $[0^\circ,360^\circ)$; apply declination (Magnetic Heading) for magnetic. Initial only — a great circle's heading changes continuously along the route (unlike a constant-heading rhumb line, which is longer). $\operatorname{atan2}$ (not $\arctan$) for correct quadrant. Inputs in degrees.