# Spherical Trigonometry and Navigational Calculations

## Introduction

Navigation is the process of planning, recording, and controlling the movement of a craft or vehicle from one location to another. The word derives from the Latin roots navis (“ship”) and agere (“to move or direct”). To achieve these goals in a general way, a coordinate system is needed that allow quantitative calculations. The most commonly used notation involves latitudes and longitudes in a spherical coordinate system. Spherical Trigonometry deals with triangles drawn on a sphere The development of spherical trigonometry lead to improvements in the art of earth-surfaced, orbital, space and inertial navigation, map making, positions of sunrise and sunset, and astronomy.

## History

Spherical trigonometry was dealt with by early Greek mathematicians such as Menelaus of Alexandria who wrote a book that dealt with spherical trigonometry called “Sphaerica”. The subject further developed in the Islamic Caliphates of the Middle East, North Africa and Spain during the 8th to 14th centuries. It arose to solve an apparently simple problem: Which direction is Mecca? In the 10th century, Abu al-Wafa al-Buzjani established the angle addition identities, e.g. $\sin (\alpha + \beta)$, and discovered the law of sines for spherical trigonometry. Al-Jayyani (989-1079), an Arabic mathematician in Islamic Spain, wrote what some consider the first treatise on spherical trigonometry, circa 1060, entitled “The Book of Unknown Arcs of a Sphere” in which spherical trigonometry was brought into its modern form. This treatise later had a strong influence on European mathematics. In the 13th century, Nasir al-Din al Tusi (1201–74) and al-Battani, continued to develop spherical trigonometry. Tusi was the first (c. 1250) to write a work on trigonometry independently of astronomy. The final major development in classical trigonometry was the invention of logarithms by the Scottish mathematician John Napier in 1614 that greatly facilitated the art of numerical computation – including the compilation of trigonometry tables.

Although the Earth is very round, in fact, it is a ﬂattened sphere or spheroid with values for the radius of curvature of 6336 km at the equator and 6399 km at the poles. Approximating the earth as a sphere with a radius of 6370 km results in an actual error of up to about 0.5%. The flattening of the ellipsoid is ~1/300 (1/298.257222101 is the defined value for the GPS ellipsoid WGS-84). Flattening is $(a-b)/a$ where $a$ is the semi-major axis and $b$ is the semi-minor axis. The value of $a$ is taken as 6378.137 km in GPS ellipsoid WGS-84.

The position of a point on the surface of the Earth, or any other planet, for that matter, can be specified with two angles, latitude and longitude. These angles can be specified in degrees or radians. Degrees are far more common in geographic usage while radians win out during the calculation.

Latitude is the angle at the center of the Earth between the plane of the Equator ($0^o$ latitude) and a line through the center passing through the surface at the point in question. Latitude is positive in the Northern Hemisphere, reaching a limit of $+90^o$ at the North Pole, and negative in the Southern Hemisphere, reaching a limit of $-90^o$ at the South Pole. Lines of constant latitude are called parallels. Longitude is the angle at the center of the planet between two planes passing through the center and perpendicular to the plane of the Equator. One plane passes through the surface point in question, and the other plane is the prime meridian ($0^o$ longitude), which is deﬁned by the location of the Royal Observatory in Greenwich, England. Lines of constant longitude are called meridians. All meridians converge at the north and south poles ($90^o$N and $-90^o$S). Longitudes typically range from $-180^o$ to $+180^o$. Longitudes can also be speciﬁed as east of Greenwich (E or positive) and west of Greenwich (W or negative). Figure 1 illustrates the typical latitudes and longitudes on Earth. In spherical or geodetic coordinates, a position is a latitude taken together with a longitude, e.g., $(lat, lon)$, which deﬁnes the horizontal coordinates of a point on the surface of a planet. Azimuth or bearing or true course is the angle a line makes with a meridian, taken clockwise from north. Usually azimuth is measured clockwise from north (0 = North, 90 = East, 180 = South 270= West, 360=0=North).

Figure 1: Typical latitude and longitude values on earth surface

A rhumb line is a curve that crosses each meridian at the same angle. Although a great circle is a shortest path, it is difficult to navigate because your bearing (or azimuth) continuously changes as you proceed. Following a rhumb line covers more distance than following a geodesic, but it is easier to navigate. Unlike a great circle which encircles the earth, a pilot flying a rhumb line would spiral indefinitely poleward. The rumb line formulas are more complicated and will not be discussed.

## Spherical Trigonometry

#### Great/Small Circles and Geodesic

Any plane will cut a sphere in a circle. A great circle is a section of a sphere by a plane passing through the center. Other circles are called small circles. All meridians are great circles, but all parallels, with the exception of the equator, are not. There is only one great circle through two arbitrary points that are not the opposite endpoints of a diameter. The smaller arc of the great circle through two given points is called a geodesic, and the length of this arc is the shortest distance on the sphere between the two points. The great circles on the sphere play a role similar to the role of straight lines on the plane.

#### Spherical Triangle

A ﬁgure formed by three great circle arcs pairwise connecting three arbitrary points on the sphere is called a spherical triangle or Euler triangle as shown in Figure 2. The vertices of the triangles are formed by 3 vectors $(\vec{OA},\vec{OB},\vec{OC})$. The angles less than $\pi$ between the vectors are called the sides $a$, $b$ and $c$ of a spherical triangle. To each side of a triangle there corresponds a great circle arc on the sphere. Each pair of vectors forms a plane. The angles $A$, $B$ and $C$ opposite the sides $a$, $b$ and $c$ of a spherical triangle are the angles between the great circle arcs corresponding to the sides of the triangle, or, equivalently, the angles between the planes determined by these vectors.

Figure 2: A spherical triangle on a sphere

In navigation applications the angles and sides of spherical triangles have specific meanings. Sides ($a$, $b$ or $c$) when multiplied by the radius of the Earth gives the geodesic distances between the points. By definition one nautical mile is equivalent to 1min of latitude extended at the surface of Earth. When one point is the North pole, the two sides originating from that point ($b$ and $c$ in Figure 2) are the co-latitudes of the other two points. The angles at the other two points ($B$ and $C$ in Figure 2) are the azimuth or bearing to the other point.

#### Spherical Triangle Formulas

Most formulas from plane trigonometry have an analogous representation in spherical trigonometry. For example, there is a spherical law of sines and a spherical law of cosines. Let the sphere in Figure 2 be a unit sphere. Then vectors $\vec{OA}$, $\vec{OB}$ and $\vec{OC}$ are unit vectors. We take $OA$ as the Z-axis, and $OB$ projected into the plane perpendicular to $OA$ as the X-axis. Vectors $\vec{OB}$ and $\vec{OC}$ has components $(\sin c, 0, \cos c)$ and $(\sin b \cos A, \sin b \sin A, \cos b)$ respectively. From dot product rule:

$\cos a = \vec{OB} \bullet \vec{OC}$
$\cos = (\sin c, 0, \cos c) \bullet (\sin b \cos A, \sin b \sin A, \cos b)$

This gives the identity (and its two analogous formulas) known as law of cosines for sides.

$\cos a = \cos b \cos c + \sin b sin c \cos A$
$\cos b = \cos c \cos a + \sin c sin a \cos B$
$\cos c = \cos a \cos b + \sin a sin b \cos C$

Similarly by using the $\sin$ formula for vector cross product we get the law of sines.

$\frac{\sin A}{\sin a} = \frac{\sin B}{\sin b} = \frac{\sin C}{\sin c}$

The law of cosines for angle is given by.

$\cos A = -\cos B \cos C + \sin B \sin C \cos a$
$\cos B = -\cos C \cos A + \sin C \sin A \cos b$
$\cos C = -\cos A \cos B + \sin A \sin B \cos c$

There are numerous other identities. All these identities allow us to solve the spherical triangles when appropriate angles and sides are given.

The sum of the angles of a spherical triangle is between $\pi$ and $3\pi$ radians ($180^o$ and $540^o$). The spherical excess is defined as $E = A + B + C - \pi$, and is measured in radians. The area $A$ of spherical triangle with radius $R$ and spherical excess $E$ is given by the following Girard’s Theorem.

$A = R^2E$

The spherical geometry is a simplest model of elliptic geometry, which itself is a form of non-Euclidean geometry, where lines are geodesics. It is inconsistent with the “parallel line” postulate of Euclid. In the elliptic model, for any given line $l$ and a point $A$, which is not on $l$, all lines through $A$ will intersect $l$. Moreover the sum of angles in the triangle will be greater than $180^o$. For example for two of the sides, take lines of longitude that differ by $90^o$. For the third side, take the equator. This gives us a triangle with an angle sum of $270^o$.

#### Distance and Bearing Calculation

The problem of determining the distance and bearing can easily be calculated. Let point $B$ and $C$ have positions $(lat1, lon1)$ and $(lat2, lon2)$ respectively. Let point $A$ be the North Pole as shown in Figure 2. The angle $A$ is the difference between the longitudes. Moreover the sides $b$ and $c$ are $(90^o - lat1)$ and $(90^o - lat2)$ respectively. Keeping theses in mind and using law of cosines for sides we get.

$\cos a = \sin (lat1) \sin (lat2) + \cos (lat1) \cos (lat2) \cos (lon2 - lon1)$

Taking $\cos^{-1}$ we get the value of side $a$ between $0$ and $\pi$ radians. By multiplying it with the radius of earth we get the required distance. The triangle can be solved for all sides. The angle $B$ is the bearing from $B$ to $C$. The values of $\sin B$ and $\cos B$ can be calculated using the flowing relations.

$\cos B = \cos (lat2) \sin (lon2 - lon1)$
$\cos B = \cos (lat1) \sin (lat2) - \sin (lat1) \cos (lat2) \cos (lon2 - lon1)$

The angle $B$ can be computed using two-argument inverse tan function (usually denoted by $tan2^{-1}$ or $atan2$), which gives the value between $\pi$ and $-\pi$ radians.

Dead reckoning (DR) is the process of estimating one’s current position based upon a previously determined position, or fix, and advancing that position based upon known speed, elapsed time (or distance) and course. In studies of animal navigation, dead reckoning is more commonly (though not exclusively) known as path integration, and animals use it to estimate their current location based on the movements they made since their last known location. Here we present the algorithm to compute the position of the destination if the distance and azimuth from previous position is known. Let the starting point has position $(lat, lon)$. The azimuth from starting point is $azm$ and the angular distance covered is $dis$ in radians. Let the position of the destination be $(newlat, newlon)$. Then latitude can be calculated by

$newlat = \sin^{-1}(\sin (lat) \cos (dis) + \cos (lat) \sin (lat) \sin (dis) \cos (azm)$

The calculation of longitude can be carried out as under.

$lon1 = lon + tan2^{-1}(\sin (dis) \sin (azm), \cos (lat) \cos (dis) - \sin (lat) \sin (dis) \cos (dis)$

The value of $lon1$ can be outside the range of $\pi$ and $\pi$ radians. The function $angpi2pi$ brings it in the required range.

$newlon = angpi2pi(lon1)$

## Conclusion

Spherical trigonometry is used for most calculations in navigation and astronomy. For the most accurate navigation and map projection calculation, ellipsoidal forms of the equations are used but these equations are much more complex. Dead reckoning is used extensively in Inertial Navigation Systems (INS). Spherical trigonometry along with linear algebra forms the backbone for modern navigation systems such as GPS. It is a prerequisite for good understanding of GIS. It is much more pertinent to integrate course of spherical trigonometry in the engineering curriculum.

Note: This is the edited version of the paper I presented at Institute of Space Technology in end 2008. You can download the associated paper from here and PowerPoint presentation from here.