Law of Cosines Side Calculator

Solve the third triangle side from two sides and their angle.

How it is calculated

You give two sides, a and b, and the angle C between them in degrees. The tool converts the angle to radians and evaluates c = √(a² + b² − 2ab × cos C), giving the side opposite C, rounded to two decimals. Sides must be greater than zero and the angle must lie strictly between 0 and 180 degrees; an angle of 0, 180 or more returns no result. The angle must be the included one, the angle formed where sides a and b meet. If C is 90 degrees the cosine term vanishes and the answer is the Pythagorean hypotenuse. Sides can use any length unit, and the result comes out in the same unit. Angles are degrees only, not radians or grads.

Worked example

Two sides measure 7 and 9, and the angle between them is 60 degrees. Square the sides: 7² = 49 and 9² = 81, which add up to 130. Now the cosine term: cos 60° = 0.5, so 2 × 7 × 9 × 0.5 = 63. Subtract: 130 − 63 = 67. The square root of 67 is about 8.185, and the tool displays 8.19 in the same unit as the inputs.

Try this example →

Common mistakes

  • Entering an angle that is not between the two known sides. The formula needs the included angle; an angle opposite one of the sides requires the law of sines or a different arrangement.
  • Typing the angle in radians. The field is in degrees, so 1.047 would be read as about one degree, not 60.
  • Calculating with a calculator set to the wrong angle mode when checking by hand. The tool itself always uses degrees.
  • Mixing units for the two sides, for example meters and centimeters, which gives a meaningless third side.
  • Expecting a result for 180 degrees (a straight line) or 0 degrees. The tool rejects these as they do not form a triangle.

About this calculator

The law of cosines extends the Pythagorean theorem to non-right triangles: c² = a² + b² − 2ab·cos(C), where C is the angle between the two known sides a and b. When C happens to be 90°, cos(C) = 0 and the formula collapses back to a² + b² = c², which is why it's often introduced as the "generalized Pythagorean theorem."

Surveyors use it to compute an unknown boundary length from two measured sides and the angle between them, navigators use it for dead-reckoning triangles, and structural engineers use it to size a diagonal brace when the two connecting members and their included angle are already fixed by the design.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators