Law of cosines

Law of cosines: use side a, side b, included angle. Review the formula, worked example and calculation steps.

Inputs

Use the units shown
RESULT
—

Enter your values and select Calculate.

Formula & explanation
c = √(a²+b²−2ab cos C)

Variables & units

Side a
m · minimum 0.000001, maximum 1000000000000
Side b
m · minimum 0.000001, maximum 1000000000000
Included angle
° · minimum 0.000001, maximum 179.999999

Worked example

Sides 3 and 4 with a 90° included angle give side 5.

Assumptions

The angle is between the two known sides.

Formula version 1.0.0. JavaScript floating-point arithmetic applies. Results display up to 6 decimal places; stored values retain available precision. Use the units shown.

Practice with an example

Use the default input values to find the answer. The reset icon restores those values.

Calculated on your device. Your latest 100 calculations stay in this browser.