trigonometry calculators

Law of Cosines Calculator

Find the unknown side of a triangle when you know two sides and the angle between them. Essential for solving oblique (non-right) triangles in surveying, navigation, and structural engineering.

About this calculator

The Law of Cosines generalizes the Pythagorean theorem to any triangle, not just right triangles. The formula is c = √(a² + b² − 2ab·cos(C)), where a and b are the two known sides and C is the included angle between them. The angle C must be converted from degrees to radians for computation: cos(C) = cos(angle × π / 180). When C = 90°, cos(90°) = 0, so the formula reduces exactly to the Pythagorean theorem: c = √(a² + b²). For angles greater than 90°, cos(C) is negative, which increases the value of c beyond what the Pythagorean theorem would predict. This formula is indispensable when you cannot use the simpler right-triangle rules because no right angle is present.

How to use

Suppose side a = 7 units, side b = 10 units, and the included angle C = 60°. Enter these values in the calculator. It computes: c = √(7² + 10² − 2 × 7 × 10 × cos(60°)). Since cos(60°) = 0.5, this becomes √(49 + 100 − 2 × 7 × 10 × 0.5) = √(49 + 100 − 70) = √79 ≈ 8.888 units. So the side opposite the 60° angle is approximately 8.89 units long.

Frequently asked questions

What is the Law of Cosines and when should I use it instead of the Pythagorean theorem?

The Law of Cosines states c = √(a² + b² − 2ab·cos(C)) and applies to any triangle, whether or not it contains a right angle. The Pythagorean theorem is a special case valid only for right triangles (where C = 90° and the cosine term vanishes). Use the Law of Cosines whenever you have two sides and the included angle (SAS) and need the third side, or when you have all three sides (SSS) and need an angle. It is the correct choice for oblique triangles encountered in navigation, land surveying, and structural design.

How does the Law of Cosines relate to the Pythagorean theorem?

The Pythagorean theorem is actually a special case of the Law of Cosines. When the included angle C equals 90°, cos(90°) = 0, so the term −2ab·cos(C) drops out entirely, leaving c² = a² + b². For angles less than 90°, cos(C) is positive, meaning the third side is shorter than the Pythagorean prediction. For angles greater than 90°, cos(C) is negative, so the third side is longer. This makes the Law of Cosines a powerful generalization of the familiar theorem.

Can the Law of Cosines be used to find an angle if all three sides are known?

Yes. Rearranging the formula gives cos(C) = (a² + b² − c²) / (2ab), from which C = arccos((a² + b² − c²) / (2ab)). If you know all three sides of a triangle, you can find any of the three angles by substituting the appropriate sides. Apply this version when you have an SSS (side-side-side) triangle and need to determine one or more of its interior angles. This is commonly needed in structural engineering and 3D graphics to compute the orientation of surfaces.