Formula & Calculator
Law of Cosines
Generalizes the Pythagorean theorem to any triangle, relating one side's length to the other two sides and the angle between them.
Variables
| Symbol | Quantity | Unit |
|---|---|---|
| a, b, c | Side lengths of the triangle | |
| C | Angle opposite side c |
What it means
The law of cosines gives the relationship between the three sides of any triangle and one of its angles. It states that the square of one side equals the sum of the squares of the other two minus twice their product times the cosine of the included angle. It is a generalisation of the Pythagorean theorem (which is the special case when the angle is 90°). This law is used in surveying (triangulation), navigation, physics (resolving vectors), and computer graphics (angle between vectors). It is also used to find angles when all sides are known. Understanding the law of cosines is essential for trigonometry and its applications.
Worked example
Law of Cosines – Two Examples
Real‑World| Parameter | Value |
|---|---|
| a | 5 |
| b | 7 |
| C | 60° |
| Parameter | Value |
|---|---|
| a | 8 |
| b | 6 |
| C | 120° |
Common mistakes
- Law of Cosines: c² = a² + b² − 2ab·cos(C) – where C is the angle opposite side c.
- Angle: C is in the triangle, between sides a and b.
- Unit: The angle is in radians or degrees – ensure your calculator is in the correct mode.
- Check: If C = 90°, the term 2ab·cos(C) = 0, so it reduces to the Pythagorean theorem.
- Side lengths: a, b, c are lengths in the same units.
Applications
The law of cosines, c² = a² + b² − 2ab·cos(C), generalises the Pythagorean theorem to any triangle, relating the sides to the included angle. This is used to solve triangles when two sides and the included angle are known, or when three sides are known. In surveying and navigation, it helps compute distances and bearings. In physics, it resolves vectors using non‑right‑angle components. In engineering, it is used in structural analysis, bridge design, and robotics kinematics. By applying the law of cosines, professionals can analyse oblique triangles, which are common in real‑world geometry, enabling accurate measurements and design.
- Surveying and land measurement (triangulation)
- Navigation and course calculation (great‑circle routes)
- Structural analysis of trusses and frames
- Robotics – forward and inverse kinematics
- Physics – resultant of non‑perpendicular vectors