Law of Cosines Calculator
Find the third side from two sides and the included angle.
Angle between sides b and c
Results update as you type.
How it works
The law of cosines is the go-to formula for finding the third side of a triangle when you know two sides and the angle between them, a situation the law of sines cannot handle directly. This law of cosines calculator takes the two known sides and their included angle and returns the length of the remaining side. The formula says the square of the unknown side equals the sum of the squares of the two known sides, minus twice their product multiplied by the cosine of the included angle. It is a direct extension of the Pythagorean theorem: when the included angle is a right angle, the cosine term becomes zero and the formula collapses to a squared plus b squared equals c squared. For any other angle, the extra cosine term corrects for how the sides lean toward or away from each other. Surveyors, navigators, engineers, and physicists reach for the law of cosines whenever they must resolve an oblique triangle from side-angle-side information, such as finding the straight-line distance across two measured legs meeting at a known angle. It also underpins vector subtraction and the computation of resultant forces, making it one of the most practical results in trigonometry.
a² = b² + c² − 2bc·cos A
The law of cosines generalises the Pythagorean theorem to any triangle. The square of the side opposite the known angle equals the sum of the squares of the other two sides minus twice their product times the cosine of that angle. When the angle is ninety degrees its cosine is zero and the correction term vanishes, leaving the familiar Pythagorean relation, so the law of cosines contains the right-triangle case as a special instance.
Source:Trigonometry (law of cosines)
We review all our tools from time to time to ensure accuracy.
Worked example
How to use this calculator
- 1
Enter your values
Enter side b, side c and included angle a (°).
- 2
Adjust the options
Fine-tune any options to match your situation.
- 3
Read your result
Side a (opposite A) updates instantly as you type — no button to press.
Frequently asked questions
What is the law of cosines?
The law of cosines relates the three sides of a triangle to the cosine of one of its angles. It states that the square of one side equals the sum of the squares of the other two sides minus twice their product times the cosine of the angle between them. It works for every triangle and reduces to the Pythagorean theorem when that angle is ninety degrees.
When should I use it instead of the law of sines?
Use the law of cosines when you know two sides and the angle between them, or all three sides. These are exactly the cases the law of sines cannot solve directly because you lack a matching side-and-opposite-angle pair. Once the law of cosines gives you a third side, you can switch to the law of sines to find the remaining angles if you need them.
How is it related to the Pythagorean theorem?
The law of cosines is a generalisation of the Pythagorean theorem to non-right triangles. When the included angle is exactly ninety degrees, its cosine is zero, so the final term disappears and the formula becomes a squared equals b squared plus c squared. For sharper or wider angles, the cosine term adjusts the result up or down to match the true geometry.
Can it find an angle from three sides?
Yes. By rearranging the formula you can solve for the cosine of an angle when all three sides are known, then take the inverse cosine to get the angle itself. This calculator focuses on finding the third side from two sides and the included angle, which is the most common side-angle-side use, but the same law answers the all-sides case with algebraic rearrangement.
Does the angle need to be between the two sides?
For this calculator, yes: the angle you enter must be the one formed where the two given sides meet, known as the included angle. The formula specifically pairs the unknown side with the angle opposite it, which sits between the two known sides. Supplying an angle that is not the included one would give an incorrect result for the third side.