Law of Cosines Calculator
With side a 5, side b 7, angle c (between a and b) 60 °, law of cosines comes to 6.2450 — side c. It is reached in 5 steps, the last of which is sqrt(5 ^ 2 + 7 ^ 2 - 2 * 5 * 7 * cos(1.0471976)), and each one is printed on the page with its numbers filled in. The formula is the one published by Encyclopedia of Mathematics, not an approximation fitted to it.
Solves a triangle from two sides and the angle between them: the third side, the other two angles and the area, using c² = a² + b² − 2ab·cos C.
Formula and sources checked · How we check
Side a 5, Side b 7, Angle C (between a and b) 60 °
6.2450
Side c for the example below. Editing a field recomputes the calculator below; this figure holds the answer the page was loaded with.
It is written into the HTML rather than drawn by a script, so a search engine reading this page without running JavaScript still finds an answer.
- Side c
sqrt(5 ^ 2 + 7 ^ 2 - 2 * 5 * 7 * cos(1.0471976))6.245- Angle A
acos(max(-1, min(1, (7 ^ 2 + 6.244998 ^ 2 - 5 ^ 2) / (2 * 7 * 6.244998)))) * 180 / pi43.898 °- Angle B
180 - 43.897886 - 6076.102 °- Perimeter
5 + 7 + 6.24499818.245- Area
0.5 * 5 * 7 * sin(1.0471976)15.155
Worked example
c² = 25 + 49 − 2 × 5 × 7 × cos 60° = 74 − 35 = 39, so c = 6.2450. Angle A works out at 43.8979 degrees and angle B at 76.1021, and the area is 15.1554 square units. Set angle C to 90 degrees and the cosine term vanishes: what is left is Pythagoras.
How to work it out yourself
- 1.The angle has to be the one between the two sides you know. An angle anywhere else gives the ambiguous case, which this form does not accept.
- 2.Read the third side first, then the two remaining angles. The largest angle is opposite the longest side, which is the sanity check.
- 3.For all three sides and no angle, enter any two of them with a guessed angle and rearrange: cos C = (a² + b² − c²)/(2ab). The step for angle A on this page is that rearrangement.
The formula
- Side c
sqrt(5 ^ 2 + 7 ^ 2 - 2 * 5 * 7 * cos(1.0471976)) - Angle A
acos(max(-1, min(1, (7 ^ 2 + 6.244998 ^ 2 - 5 ^ 2) / (2 * 7 * 6.244998)))) * 180 / pi - Angle B
180 - 43.897886 - 60 - Perimeter
5 + 7 + 6.244998 - Area
0.5 * 5 * 7 * sin(1.0471976)
Source: Encyclopedia of Mathematics — cosine theorem, NIST DLMF §4.14 — trigonometric functions
Questions people actually ask
- How is this related to Pythagoras?
- It is Pythagoras with a correction term. When C is 90 degrees, cos C is zero and c² = a² + b². For a smaller angle the third side is shorter than Pythagoras predicts, for a larger one it is longer, and 2ab·cos C is exactly the amount.
- Can I use it with three sides and no angle?
- Yes — rearranged. cos C = (a² + b² − c²)/(2ab), then take the arccosine. That is how the angle A step on this page is computed once side c is known.
- Why does an obtuse angle make the third side longer?
- Because the cosine goes negative past 90 degrees, so −2ab·cos C becomes an addition. Opening the angle between two sticks moves their far ends apart, and the formula says so.
Related
- Law of Sines CalculatorSolves a triangle from one side and two angles: the third angle, the remaining two sides and the area, using a/sin A = b/sin B.
- Sin Cos Tan CalculatorSine, cosine and tangent of an angle in degrees or radians, with the angle also shown in the other unit and the reciprocal functions.
- Pythagorean Theorem CalculatorSolves a² + b² = c² in either direction — the hypotenuse from two legs, or the missing leg from a leg and the hypotenuse — with the squares shown.
- Inverse Trig CalculatorArcsine, arccosine and arctangent: the angle whose sine, cosine or tangent is the ratio you have, in degrees and radians.
- Diagonal & Rafter Length CalculatorHypotenuse of a right triangle in feet and inches — brace lengths, rafter runs, and squaring a layout.
- Circle CalculatorArea, circumference and radius of a circle from its diameter — in square feet and square inches.
Put this calculator on your site
Free, no attribution required beyond the link.
<iframe src="https://rulecalculators.com/embed/law-of-cosines" width="100%" height="420" style="border:1px solid #e7e4de;border-radius:12px" title="Law of Cosines Calculator"></iframe>