The law of cosines generalises the Pythagorean theorem to any triangle.
About this calculator
The law of cosines generalises the Pythagorean theorem to any triangle. When angle C is 90°, cos C is zero and the formula collapses to c² = a² + b². For oblique triangles it accounts for the acute or obtuse corner between the two known sides.
Enter sides a and b plus angle C to solve side c (SAS). Enter all three sides with angles at zero to recover every angle (SSS). Results include area from Heron's formula and the full perimeter.
Use this for land plots where two fence lengths and the corner angle are measured, or for vector magnitude when two components and their separation angle are known. Pair with [[law-of-sines]] for AAS cases, [[triangle]] for quick 3-side checks, and [[distance]] when the triangle sits on a coordinate plane.
Common uses
- SAS triangle homework — two sides and the included angle
- Find all angles when three sides are measured on site
- Vector magnitude from two components and the angle between them
- Land-survey corner checks with two edges and a turning angle
- Verify whether a 5-7-8 triangle is acute or obtuse
Frequently asked questions
How do I find side c when a = 5, b = 7, and angle C = 60°?
c² = 5² + 7² − 2(5)(7)cos(60°) = 25 + 49 − 35 = 39, so c ≈ 6.24. Enter a, b, and angle C; leave side c and other angles at 0.
How do I get angles from three sides?
Enter sideA, sideB, and sideC with all angles at 0. The calculator applies the cosine rule three times to recover angles A, B, and C.
Is the law of cosines the same as the Pythagorean theorem?
It is the general form. When C = 90°, cos C = 0 and you get c² = a² + b². For any other angle the −2ab cos C term adjusts the result.
Which angle is the included angle for SAS?
Angle C lies between sides a and b, and side c is opposite it. Match the labels on the diagram: the included angle sits at the corner touching both known sides.