What is the Law of Cosines?
The Law of Cosines relates the lengths of a triangle's three sides to the cosine of one of its angles. It generalises the Pythagorean theorem to any triangle (not just right triangles) and is the key tool for solving triangles when you know either all three sides (SSS) or two sides and the included angle (SAS). For sides a, b, c opposite angles A, B, C, the rule states \(a^2 = b^2 + c^2 - 2bc\cdot\cos A\), which rearranges to give any angle from the three sides.
How to use this calculator
Pick what you want to Calculate. In the angle modes (Angle A, B or C), simply enter all three side lengths a, b and c — the solver finds the named angle, then the other two, and reports the full triangle. In the side modes (Side a, b or c), enter the two known sides and the included angle; the missing side is computed with the SAS form. Choose your angle unit (degrees or radians), an optional length-unit label, and the number of significant figures for rounding.
The formula explained
To find an angle from three sides, rearrange the Law of Cosines: $$A = \arccos\!\left(\frac{b^2 + c^2 - a^2}{2bc}\right)$$. To find a side from two sides and the included angle, use $$a = \sqrt{b^2 + c^2 - 2bc\cos A}$$. Once all sides are known, the calculator adds the triangle characteristics: perimeter \(P = a + b + c\), semi-perimeter \(s = P/2\), area by Heron's formula \(K = \sqrt{s(s-a)(s-b)(s-c)}\), inradius \(r = K/s\), and circumradius \(R = abc/(4K)\).
Worked example
For a 3-4-5 triangle: $$A = \arccos\!\left(\frac{16+25-9}{40}\right) = \arccos(0.8) = 36.8699^\circ,$$ $$B = \arccos\!\left(\frac{9+25-16}{30}\right) = \arccos(0.6) = 53.1301^\circ,$$ and \(C = \arccos(0) = 90^\circ\). They sum to \(180^\circ\), confirming a right triangle. The perimeter is 12, semi-perimeter 6, area 6, inradius 1 and circumradius 2.5.
FAQ
What if my sides don't form a triangle? Each side must be shorter than the sum of the other two (the triangle inequality). If this fails, no real triangle exists and the calculator shows an error.
When should I use the Law of Cosines instead of the Law of Sines? Use the Law of Cosines for SSS and SAS cases. The Law of Sines is better when you know two angles and a side (AAS/ASA) or two sides and a non-included angle.
Does the length unit change the angles? No. Angles depend only on the ratios of the sides, so the geometry is scale-invariant. The length unit is just a display label.