Law Of Cosines CalculatorFree online math calculator — instant results, no sign-up

Find a triangle's third side from two sides and their included angle.

Inputs

Result
6.2449979984

Sign in to save results and favorites.

About the Law Of Cosines Calculator

The Law Of Cosines Calculator finds a triangle’s third side from two known side lengths and the angle between them. Enter sides a and b in the same length unit and the included angle in degrees to calculate the opposite side. With the default inputs of 5, 7, and 60°, the result is 6.2449979984.

Side a
The length of one side bordering the included angle, entered in the same length unit as side b; the default is 5.
Side b
The length of the other side bordering the included angle, entered in the same length unit as side a; the default is 7.
Included angle (degrees)
The interior angle between sides a and b, measured in degrees; the default is 60.

Formula and method

c = √(a² + b² − 2ab cos(C × π/180)); with the defaults, c = √(5² + 7² − 2 × 5 × 7 × cos(60 × π/180)) = √(25 + 49 − 35) = √39 ≈ 6.2449979984.
  • aThe first known side length.
  • bThe second known side length, in the same unit as a.
  • CThe included angle between a and b, expressed in degrees.
  • cThe calculated third side, opposite angle C, in the same length unit as a and b.
  • πPi; multiplying a degree angle by π/180 converts it to radians for evaluating the cosine.

Convert the included angle from degrees to radians, evaluate its cosine, and subtract 2ab times that cosine from a² + b². Take the positive square root to obtain the third side. For a = 5, b = 7, and C = 60°, the cosine is 0.5, so c² = 25 + 49 − 35 = 39 and c ≈ 6.2449979984.

Worked example

These are the calculator's starting values and the results it actually produces for them.

Inputs

  • Side a5
  • Side b7
  • Included angle (degrees)60

Results

  • Result6.2449979984

How to use the Law Of Cosines Calculator

  1. 1Enter Side a as 5 for the default example.
  2. 2Enter Side b as 7, using the same length unit as Side a.
  3. 3Enter Included angle (degrees) as 60, ensuring this is the angle between the two known sides.
  4. 4Calculate the result using the law of cosines.
  5. 5Read Result = 6.2449979984 as the length of the third side, opposite the 60° angle.

Reading your result

The Result row gives c, the third side opposite the included angle. For the default inputs, Result = 6.2449979984 in the same unit used for sides 5 and 7. This is a rounded decimal representation of √39, and it lies between |7 − 5| = 2 and 7 + 5 = 12, as required by the triangle inequality.

Limitations

This calculation assumes a flat, Euclidean triangle with positive side lengths and an included angle strictly between 0° and 180°. Angles of 0° or 180° produce degenerate configurations, not ordinary triangles. Both side lengths must use the same unit, and the supplied angle must be between those sides, not another angle in the triangle. Rounded input measurements limit the accuracy of the result; displayed decimal places do not guarantee measurement precision. Very small angles with nearly equal sides can also be sensitive to numerical rounding.

Common questions

Why must I enter the angle between sides a and b?+

The formula c² = a² + b² − 2ab cos(C) requires C to be the angle enclosed by the two known sides. Using a different triangle angle would generally calculate the wrong third side.

Why do sides 5 and 7 with an included angle of 60° give 6.2449979984?+

Because cos(60°) = 0.5, the calculation gives c² = 5² + 7² − 2 × 5 × 7 × 0.5 = 39. The positive square root is √39 ≈ 6.2449979984.

Will swapping Side a and Side b change the calculated third side?+

No. Swapping 5 and 7 leaves both a² + b² and 2ab unchanged, so the same included angle of 60° still gives 6.2449979984.

How does this calculator relate to the Pythagorean theorem?+

When the included angle is 90°, its cosine is zero, so the law of cosines reduces to c = √(a² + b²). In that case, the calculated third side is the hypotenuse.

Does the calculator save my information?+

Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.

Further reading

You might also like

Results are estimates for informational purposes and are not financial, medical or legal advice.