The Law of Cosines is a cornerstone of trigonometry, extending the Pythagorean theorem to acute and obtuse triangles. By leveraging the cosine function, we can derive this law in multiple geometrical frameworks, including the Euclidean plane, coordinate systems, and curved surfaces like spheres. This article provides a comprehensive exploration of these derivations, showing how cosine serves as a bridge between side lengths and angles in diverse settings.

The Law of Cosines in Euclidean Geometry

In a standard Euclidean triangle with sides a, b, and c, and angle C opposite side c, the Law of Cosines is expressed as:

c2 = a2 + b2 - 2ab cos C

This formula generalizes the Pythagorean theorem: when C = 90°, cos 90° = 0, reducing to c2 = a2 + b2. The derivation relies on constructing perpendicular drops that create right triangles, allowing the cosine definition to link adjacent side projections with the included angle.

Coordinate-Based Derivation

Place vertex C at the origin of a Cartesian coordinate system. Let side a lie along the positive x-axis from C to B, so point B = (a, 0). Point A is located at (b cos C, b sin C), where b is the length of side AC. The side c is the distance between points A and B. Using the distance formula:

c2 = (ab cos C)2 + (0 – b sin C)2

Expanding gives:

c2 = a2 – 2ab cos C + b2 cos2 C + b2 sin2 C

Since sin2 C + cos2 C = 1, this simplifies directly to c2 = a2 + b2 – 2ab cos C. This approach cleanly demonstrates how the cosine function emerges from projecting side b onto the axis aligned with side a.

Derivation Using Vector Dot Products

A powerful and elegant derivation uses vector algebra. Represent sides as vectors: let u and v be vectors from vertex C to vertices A and B respectively. Then side c corresponds to the vector uv. Compute the squared length:

c2 = |uv|2 = (uv) · (uv) = |u|2 + |v|2 – 2 u · v

The dot product is defined as u · v = |u||v| cos C = ab cos C. Substituting yields the same formula:

c2 = a2 + b2 – 2ab cos C

This method highlights the geometric meaning of the cosine as the scaling factor for the projection of one side onto another. For more on vector dot products, see this explanation.

Applications in Coordinate Geometry

In coordinate geometry, the Law of Cosines calculates distances and angles between any two points, even when the triangle is not right-angled. Given three points P(x₁, y₁), Q(x₂, y₂), and R(x₃, y₃), the distance PQ can be expressed using the coordinates and the angle at R. For example, to find the angle at R, use the dot product of vectors from R to P and R to Q:

cos R = ( (PR) · (QR) ) / (|PR| |QR|)

This is directly derived from the Law of Cosines and is essential in fields like computer graphics for collision detection and physics for force decomposition. For a practical application, consider determining the distance between two ships given their bearings from a lighthouse — a classic navigation problem that relies on this law.

Spherical Geometry and the Spherical Law of Cosines

On the surface of a sphere, triangles are formed by arcs of great circles. The Euclidean Law of Cosines does not hold; instead, it generalizes to the spherical law of cosines. For a spherical triangle with sides a, b, c (measured as angles subtended at the sphere's center) and angle C at the vertex opposite side c, the law states:

cos c = cos a · cos b + sin a · sin b · cos C

This formula reduces to the Euclidean law when the sides are small relative to the sphere's radius, as cos x ≈ 1 – x²/2 and sin xx for small x. The derivation uses the dot product of vectors from the sphere's center to the triangle's vertices on the unit sphere. For example, let vectors A, B, and C point to the vertices from the center. Then side c is the angle between A and B, so cos c = A · B. By expressing A and B in terms of C and the angles, one obtains the spherical form. This law is critical in astronomy for calculating distances between stars, in geodesy for mapping, and in global navigation. For a detailed tutorial, refer to Wolfram MathWorld's page.

Deriving the Spherical Law from the Euclidean Law

Consider a triangle on a unit sphere. Drop perpendiculars from a vertex to the opposite side along great circles. Using the cosine definition for spherical right triangles — where a side can be expressed via the cosine of an adjacent angle — one can algebraically manipulate to reach the spherical law. Alternatively, use the rotation of coordinate axes. The key difference from Euclidean geometry is that the sum of angles exceeds 180°, and the law introduces sine terms alongside cosine, reflecting the curvature. Compare this with the hyperbolic law of cosines for negatively curved spaces.

Non-Euclidean Geometries and Generalizations

The pattern of the Law of Cosines extends beyond spheres to hyperbolic geometry, where surfaces have constant negative curvature. The hyperbolic law of cosines is:

cosh c = cosh a · cosh b – sinh a · sinh b · cos C

Here, hyperbolic functions replace trigonometric ones, reflecting the geometry of a saddle-shaped surface. This law emerges from the metric of the hyperbolic plane and is essential in the theory of relativity and complex analysis. The derivation follows a similar vector approach but within the framework of hyperbolic space, often using the Minkowski model. For an introduction to this generalization, see Khan Academy's coverage of the basic law before exploring advanced forms.

Practical Examples and Problem Solving

To solidify understanding, consider a triangle with sides a = 7 cm, b = 10 cm, and angle C = 60°. Using the Euclidean law: c² = 7² + 10² – 2·7·10·cos 60° = 49 + 100 – 140·0.5 = 149 – 70 = 79, so c = √79 ≈ 8.89 cm. In a spherical context, if the same side lengths represent arc lengths on a sphere of radius 1, and C = 60°, then cos c = cos 7° · cos 10° + sin 7° · sin 10° · cos 60°. Converting to radians and computing yields c in radians, which can then be converted to linear distance by multiplying by the sphere's radius.

For a coordinate geometry problem: Find the distance between points (2,3) and (5,7) using the angle at (0,0). Vectors: u = (2,3), v = (5,7). The angle between them is cos θ = (2·5+3·7)/(√(4+9)·√(25+49)) = (10+21)/(√13·√74) = 31/√962 ≈ 0.9998. Then using law of cosines with sides √13 and √74, the third side squared = 13+74-2·√13·√74·0.9998 ≈ 87-2·15.62·0.9998 ≈ 87-31.23 = 55.77, so distance ≈ 7.47 units. Direct Euclidean distance gives √((5-2)²+(7-3)²)=√(9+16)=√25=5. The discrepancy is because the angle is not at the origin for the triangle? Actually, the law of cosines applies between the two vectors from the same point. If we take the triangle with vertices (0,0), (2,3), (5,7), then sides from (0,0) are √13 and √74, and the third side is the distance between the points, which is 5. So our calculation should yield 5. Let's correct: using law of cosines at (0,0): c² = a² + b² - 2ab cos θ = 13+74-2·√13·√74·(31/√962) = 87 - 2·√(13·74)·31/√(13·74) = 87 - 2·31 = 87-62=25, so c=5. This confirms the law works. This exercise illustrates the importance of careful application.

Conclusion

The cosine function provides a unifying thread for deriving the Law of Cosines across Euclidean, coordinate, spherical, and hyperbolic geometries. Each derivation reinforces the relationship between side lengths and the cosine of the included angle, whether through perpendicular drops, vector algebra, or curved space formulations. Understanding these contexts deepens one's grasp of triangle relationships and equips mathematicians, scientists, and engineers with tools for a wide range of problems—from measuring distances on maps to navigating the cosmos. For further study, explore the comprehensive Wikipedia article which includes multiple proofs and history.