Law of Cosines
Introduction
The Pythagorean theorem relates the sides of a right triangle: . But what about triangles that aren't right triangles? The Law of Cosines answers this question, providing a generalization that works for any 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 , , opposite to angles , , respectively. The Law of Cosines states:
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 is the correction that accounts for the triangle not being a right triangle.
Connection to Pythagorean Theorem
When C°, we have , so the Law of Cosines reduces to:
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 at the origin and side b along the positive -axis. Then:
Vertex is at (, )
Vertex is at
Vertex is at
The distance from A to B is side c. Using the distance formula:
Expanding:
Since we obtain:
Vector Proof
Let vectors a and b represent two sides of the triangle emanating from vertex , with and . The third side is or , depending on orientation.
Computing the squared length:
where is the angle between vectors a and b, giving us:
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 < angle < in any triangle, the inverse cosine gives the unique answer.
Determining Triangle Type
The sign of reveals the type of angle :
If , then , so is acute
If , then , so (right angle)
If , then , so is obtuse
This generalizes the Pythagorean test for right triangles.
Worked Examples
Example 1: Finding a Side (SAS)
In triangle , , , and °. Find .
Using the Law of Cosines:
Example 2: Finding an Angle (SSS)
In a triangle with sides , , find angle .
Using the formula for :
Since , we have °. This is a right triangle (a -- triangle, which is a -- triangle scaled by ).
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 and act at angle , the resultant has magnitude:
Note the positive sign because we measure from one force to the other, not the angle opposite in the force triangle.
Computer Graphics
In D graphics and game development, the Law of Cosines helps compute distances and angles between objects, essential for collision detection, lighting calculations, and camera positioning.
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 , , (measured as angles from the sphere's center) and angle opposite side :
This formula is essential in navigation and astronomy for computing distances on Earth's surface.
Summary
The Law of Cosines states , relating the three sides of a triangle to one angle. It generalizes the Pythagorean theorem (which is the special case when °).
The law can be proved geometrically using coordinates or elegantly using the vector dot product. Rearranging gives , allowing computation of angles when all sides are known.
The sign of the cosine reveals whether an angle is acute (positive), right (zero), or obtuse (negative). This extends the Pythagorean criterion for right triangles.
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.