Loading...
The Law of Cosines generalizes the Pythagorean theorem to all triangles. When the angle is 90°, cos(90°) = 0 and it reduces to a² + b² = c². Use it when you have SAS or SSS — situations where the Law of Sines does not apply directly.
Law of Cosines (c²)
c² = a² + b² − 2ab·cos(C)
Law of Cosines requires SAS (two sides and the included angle) or SSS (all three sides). For SAS: you need sides a, b and the angle C between them. For SSS: you have all three sides and need to find an angle.
SAS or SSS → Law of CosinesGiven a = 8, b = 6, C = 60°. Apply: c² = 8² + 6² − 2(8)(6)cos(60°) = 64 + 36 − 96(0.5) = 100 − 48 = 52. So c = √52 ≈ 7.21.
c² = a² + b² − 2ab·cos(C)Given a = 5, b = 7, c = 8. Rearrange: cos(C) = (a² + b² − c²) / (2ab) = (25 + 49 − 64) / (2·5·7) = 10/70 ≈ 0.143. C = arccos(0.143) ≈ 81.8°.
cos(C) = (a² + b² − c²) / (2ab)All angles must be positive and sum to 180°. All sides must satisfy the triangle inequality. If cos(C) = −1 to 1, the triangle is valid; outside this range means no valid triangle exists.
A + B + C = 180°Use Law of Cosines for SAS and SSS cases. Use Law of Sines for ASA, AAS, and the ambiguous SSA case. Quick rule: if you have two sides and the angle BETWEEN them, use Cosines. If you have an angle-side pair across from each other, use Sines.
The Law of Cosines is used in surveying (calculating distances when direct measurement is impossible), navigation (finding distances between GPS coordinates), physics (vector addition), and architecture (roof angles, structural triangulation).
Skip the manual calculations. Use our free Law of Cosines Calculator for instant results.
Open Law of Cosines Calculator →