Law of Cosines
Introduction
The Pythagorean theorem relates the sides of a right triangle:
The Law of Cosines connects the three sides of a triangle to one of its angles. It serves two main purposes: computing an unknown side when two sides and the included angle are known, and computing angles when all three sides are known.
This theorem, known since antiquity, appears in the works of Euclid and was refined by later mathematicians. It remains fundamental in surveying, navigation, physics, and any field requiring precise distance calculations.
Statement of the Law
Consider a triangle with sides
By symmetry, analogous formulas hold for the other sides:
Each formula relates one side to the other two sides and the angle opposite to it. The term
Connection to Pythagorean Theorem
When C
This is precisely the Pythagorean theorem! The Law of Cosines is thus a proper generalization that includes the Pythagorean theorem as a special case.
Geometric Proof
Place the triangle in a coordinate system with vertex
Vertex
Vertex
Vertex
The distance from A to B is side c. Using the distance formula:
Expanding:
Since
Vector Proof
Let vectors a and b represent two sides of the triangle emanating from vertex
Computing the squared length:
where
This elegant vector proof reveals the Law of Cosines as a direct consequence of the dot product definition.
Solving for Angles
When all three sides are known, we can solve for any angle. Rearranging the formula:
Similarly for the other angles:
The angle is then found using the inverse cosine function. Note that since
Determining Triangle Type
The sign of
If
If
If
This generalizes the Pythagorean test for right triangles.
Worked Examples
Example 1: Finding a Side (SAS)
In triangle
Using the Law of Cosines:
Example 2: Finding an Angle (SSS)
In a triangle with sides
Using the formula for
Since
Applications
Navigation and Surveying
Surveyors use the Law of Cosines to determine distances that cannot be measured directly. Given two accessible points and the angle between sightlines to an inaccessible third point, the distance to that point can be calculated.
Physics: Force Addition
When two forces act at an angle, their resultant magnitude follows from the Law of Cosines. If forces of magnitude
Note the positive sign because we measure
Computer Graphics
In
Relationship to Law of Sines
The Law of Cosines and Law of Sines are complementary tools for solving triangles:
Law of Cosines: Best for SAS (two sides and included angle) and SSS (three sides) problems
Law of Sines: Best for AAS, ASA (two angles and a side) and SSA (two sides and non-included angle) problems
When solving triangles, choose the appropriate law based on which information is given. Often, one uses the Law of Cosines first to find a missing side, then the Law of Sines to find remaining angles.
Generalization: Spherical Law of Cosines
On a sphere, the planar Law of Cosines generalizes to the spherical law of cosines. For a spherical triangle with sides
This formula is essential in navigation and astronomy for computing distances on Earth's surface.
Summary
The Law of Cosines states
The law can be proved geometrically using coordinates or elegantly using the vector dot product. Rearranging gives
The sign of the cosine reveals whether an angle is acute (positive), right (zero), or obtuse (negative). This extends the Pythagorean criterion
Applications span surveying, navigation, physics (force composition), and computer graphics. Together with the Law of Sines, it provides a complete toolkit for solving any triangle given sufficient information.