No ads, no sign-upChecked 2026-08-24

Law of Cosines Calculator

Result

6.2450units

Result: 6.2450 units
How the result moves° → 

The law of cosines finds the third side from two sides and the angle between them: c = √(a² + b² − 2ab·cos C). Sides of 5 and 7 with 60° give √39, about 6.245. At exactly 90° the cosine term vanishes and the rule falls back to Pythagoras.

Worked examples

How it's calculated

c = √(a² + b² − 2ab·cos C)

  1. StepEnter the two known sides in one length unit.
  2. StepEnter the angle between them, in degrees.
  3. ResultRead the third side, opposite that angle, in the same unit.

What this number means

Pythagoras is the 90° special case

At C = 90° the cosine is zero, the −2ab·cos C term vanishes and a² + b² is all that remains. Sides of 3 and 4 at 90° give √25 = 5, the same answer the Pythagorean theorem returns.

The route when the law of sines stalls

Reach for it with two sides and the angle between them, or with all three sides — the cases where no side lies opposite a known angle. The law of sines needs exactly such a pair and cannot start without one.

C must be the angle between a and b

The included angle is the one the two entered sides form, and the side that comes out is the one facing it. Feed in another angle of the triangle and the length returned is not side c.

Degrees in, and c grows as C opens

Type 60 for sixty degrees; the radian conversion lives inside the formula. Past 90° the cosine turns negative, so the term adds instead of subtracting: 7 and 9 give √130 ≈ 11.402 at 90° but √193 ≈ 13.892 at 120°.

Commonly misread

c = √(a² + b²) works for every triangle.

Only at an included angle of exactly 90°. At any other angle −2ab·cos C is non-zero, and leaving it out misses c in one direction or the other.

An obtuse angle has to shorten the third side.

It lengthens it. Above 90° the cosine is negative, so −2ab·cos C adds to the sum: sides of 7 and 9 give about 11.402 at 90° and 13.892 at 120°.

For a 60° angle you enter π/3.

Enter 60. Degrees go into the field, and the formula converts to radians on its own.

Reference table

Sides a, b and angle CExactSide c
3, 4, 90√255.0000
5, 7, 60√396.2450
5, 12, 90√16913.0000
7, 9, 120√19313.8924
8, 8, 60√648.0000

Questions

How do I use the law of cosines?

Take the two sides you know, a and b, and the angle C between them, then compute c = √(a² + b² − 2ab·cos C). Sides of 5 and 7 with a 60° angle give √(25 + 49 − 70 × 0.5) = √39 ≈ 6.245.

What is the law of cosines?

It is a rule of plane geometry that links the three sides of a triangle to the cosine of one of its angles. It gives the third side whenever two sides and the angle between them are known, even when the triangle has no right angle.

How does it relate to the Pythagorean theorem?

The Pythagorean theorem is the special case at an included angle of 90°. There the cosine is zero, the −2ab·cos C term disappears, and the formula collapses to c = √(a² + b²). At any other angle the cosine term adjusts the result.

Should the angle be in degrees or radians?

In degrees — enter 60 for sixty degrees. The angle must stay above 0° and below 180°, because at those limits the triangle flattens into a line. The conversion to radians happens inside the formula.

Why does a wider angle give a longer third side?

An obtuse angle above 90° has a negative cosine, so the −2ab·cos C term adds to the total and lengthens c. An acute angle has a positive cosine that subtracts and shortens c. With both sides fixed, c grows steadily as the angle opens from 0° toward 180°.

Sources and last check

  1. mathworld.wolfram.com

Information, not professional advice.