Connect via MCP →

Enter Calculation

In side-solve modes, leave the side being solved blank and enter the included angle here (in the chosen angle unit).

Formula

Formula: Law of Cosines Calculator
Show calculation steps (1)
  1. Law of Cosines (side from two sides + included angle)

    Law of Cosines (side from two sides + included angle): Law of Cosines Calculator

    Find a side when the two adjacent sides and the included angle are known (SAS).

Advertisement

Results

Triangle Solved (Law of Cosines)
A = 36.8699 deg
B = 53.1301 deg, C = 90 deg
Side a 3
Side b 4
Side c 5
Perimeter P 12
Semi-perimeter s 6
Area K 6
Inradius r 1
Circumradius R 2.5
Primary Equation: A = arccos[(b^2 + c^2 - a^2) / (2bc)]

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.

Triangle with sides a, b, c and opposite angles A, B, C
A triangle labeled with sides a, b, c opposite their respective angles A, B, C.

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)\).

Advertisement
Triangle showing the b squared plus c squared minus a squared relationship around angle A
The Law of Cosines relates side a to the two adjacent sides b and c and the included angle A.

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.

Last updated: