Law of cosines vs. Pythagorean theorem
The table below shows how the law of cosines behaves as the included angle changes, using the Pythagorean theorem as the special case at 90°.
| Angle C | cos C | Effect on c² |
|---|---|---|
| 90° (right angle) | 0 | c² = a² + b² (Pythagorean theorem exactly) |
| < 90° (acute) | positive | c² < a² + b² (c is shorter than the right-angle case) |
| > 90° (obtuse) | negative | c² > a² + b² (c is longer than the right-angle case) |
- The law of cosines works for any triangle, not just right triangles — it is the general case, with the Pythagorean theorem as its 90° special case.
- Angle C must be strictly between 0° and 180°; at either boundary the three points become collinear and no triangle exists.
What is the law of cosines?
The law of cosines relates the three sides of a triangle to the cosine of one of its angles: c² = a² + b² − 2ab·cos C. It generalizes the Pythagorean theorem — when angle C is exactly 90°, cos C = 0 and the formula reduces to c² = a² + b², the familiar Pythagorean relationship.
Given two sides and the included angle between them (the SAS case used here), the law of cosines finds the third side directly; the same formula, rearranged, then recovers the remaining two angles.
How to use this law of cosines calculator
- Enter side a and side b, the two known sides.
- Enter angle C, the angle included between sides a and b, strictly between 0° and 180°.
- Read side c (the missing side), angles A and B, and the triangle's area.
The law of cosines formula
The same base relationship is rearranged to solve for a side or, once all three sides are known, for an angle.
Common mistakes
- Entering an angle that is not actually included between sides a and b — the law of cosines requires the included angle for the SAS case.
- Forgetting the minus sign in c² = a² + b² − 2ab·cos C, which is easy to drop when the angle is acute and cos C is positive.
- Using the law of cosines to find a missing side when only two angles and one side are known — that case calls for the law of sines instead.
- Entering angle C in radians rather than the expected degrees.
Häufig gestellte Fragen
What is the law of cosines formula?
c² = a² + b² − 2ab·cos C, where C is the angle included between sides a and b, and c is the side opposite angle C.
How do you find a missing side using the law of cosines?
Take the square root after applying the formula: c = √(a² + b² − 2ab·cos C). For a = 5, b = 7 and C = 49°, c = √(25 + 49 − 2×5×7×cos 49°) ≈ √28.076 ≈ 5.2987.
How do you find an angle using the law of cosines?
Rearrange the formula to solve for cosine, then take the inverse cosine: A = cos⁻¹((b² + c² − a²) / (2bc)). For a = 5, b = 7, c ≈ 5.2987, angle A ≈ 45.4117°.
How is the law of cosines related to the Pythagorean theorem?
When the included angle C equals exactly 90°, cos C = 0, and the law of cosines c² = a² + b² − 2ab·cos C reduces exactly to the Pythagorean theorem, c² = a² + b².
When do you use the law of cosines instead of the law of sines?
Use the law of cosines when you know three sides (SSS) or two sides and the included angle (SAS) — cases the law of sines cannot solve directly. Use the law of sines when you know two angles and a side, or two sides and a non-included angle.
What is the area of a triangle with sides 5, 7 and an included angle of 49°?
Area = ½ × a × b × sin C = ½ × 5 × 7 × sin(49°) ≈ 0.5 × 35 × 0.754710 ≈ 13.2074 square units.
Quellenangaben
- Weisstein, Eric W. "Law of Cosines." MathWorld — A Wolfram Web Resource.
- Standard trigonometry textbook conventions (e.g. Larson, Trigonometry, Cengage Learning).