The previous post looked at the analog of the Pythagorean theorem on a sphere. This post looks at the law of cosines on a sphere.

Yesterday we looked at triangles on a sphere with sides *a* and *b* meeting at a right angle and hypotenuse *c*. Denote the angle opposite a side with the capital version of the same letter, so *C* is the angle opposite *c*. We assumed *C* is a right angle, but now we will remove that assumption.

The spherical analog of the law of cosines says

cos(*c*) = cos(*a*) cos(*b*) + sin(*a*) sin(*b*) cos(*C*).

Note that we have two kinds of angles: the arcs that make up the sides, and the angle formed by the intersection of arcs [1]. So the cos(*C*) term at the end is different animal from the other terms in the equation.

If *C* is a right angle, cos(*C*) = 0 and the second term drops out, leaving us with the spherical counterpart of the Pythagorean theorem. But we do not require that *C* be a right angle.

## Application to air distance

Suppose we want to find how far a plane would travel between Los Angeles (LAX) and Houston (IAH), assuming it takes a great circle path. The lat/long coordinates of the two airports are (33.94°, −118.41°) and (29.98°, −95.34°).

Los Angeles and Houston are approximately at the same latitude, but even if they were at exactly the same latitude we couldn’t just find the flight distance by finding the length of the arc of constant latitude between them because that arc would not be part of a great circle.

To find the distance between LAX and IAH we form a triangle with vertices at LAX, IAH, and the north pole. Call the arc from LAX to the north pole *a* and the arc from IAH to the north pole *b*. Since latitude is the angle up from the equator, the angle down from the pole is 90° minus latitude. So

*a* = 90° − 33.94° = 56.06°

and

*b* = 90° − 29.98° = 60.02°

The arcs *a* and *b* meet at the angle *C* equal to the differences in the two longitudes. That is,

*C* = 118.41° − 95.34° = 23.07°.

The law of cosines

cos(*c*) = cos(*a*) cos(*b*) + sin(*a*) sin(*b*) cos(*C*)

reduces to

cos(*c*) = cos(56.06°) cos(60.02°) + sin(56.06°) sin(60.02°) cos(23.07°)

in our problem.

This tells us

cos(*c*) = 0.9402

from which we find *c* = 0.3477 radians or 19.92°. Assume the earth is a perfect sphere of radius *r* = 3959 miles. The arc length we’re after is *r* times *c* in radians, or 1376 miles.

## Related posts

[1] In the language of differential geometry, the arcs are geodesics on the sphere and the angles of intersection are measured in the tangent space at the intersection point.