Law of Cosines Calculator

Reviewed by CalcMulti Editorial Team·Last updated: ·Geometry Hub

The law of cosines relates the lengths of the sides of a triangle to the cosine of one of its angles: c² = a² + b² − 2ab·cos(C). It generalizes the Pythagorean theorem — when C = 90°, cos(C) = 0 and the formula reduces to c² = a² + b².

Use the law of cosines when you have: (1) all three sides (SSS) and want the angles, or (2) two sides and the included angle (SAS) and want the third side.

The law of cosines can be rearranged for any side/angle: a² = b² + c² − 2bc·cos(A), b² = a² + c² − 2ac·cos(B), c² = a² + b² − 2ab·cos(C). This calculator solves all three cases.

Formula

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

a, b, c
side lengths of the triangle
C
angle opposite side c
cos(C)
cosine of angle C

Disclaimer

This calculator is for educational purposes only and does not constitute professional advice. Results are based on standard mathematical formulas. Always verify critical calculations with a qualified professional before making important decisions.

Frequently Asked Questions