Overview
The law of cosines finds a triangle's third side when you know two sides and the angle between them. It works for any triangle, not only right triangles.
Enter sides a and b and the included angle C in degrees. You also get the triangle's area.
Worked examples
| Inputs | Result |
|---|---|
| Side a5Side b7Angle C (degrees)60 | Side c: 6.24Area: 15.16 |
Show 2 more examples
| Side a3Side b4Angle C (degrees)90 | Side c: 5Area: 6 |
| Side a10Side b12Angle C (degrees)120 | Side c: 19.08Area: 51.96 |
Side c by angle c
With the calculator's starting values, the side c is 6.24. The table shows how it changes with the angle c.
| Angle C (degrees) | Side c |
|---|---|
| 30 | 3.66 |
| 40 | 4.51 |
| 50 | 5.39 |
| 60starting value | 6.24 |
| 70 | 7.08 |
| 80 | 7.86 |
| 90 | 8.6 |
Other inputs: Side a: 5 · Side b: 7. Change them in the calculator above for your own numbers.
How it works
The law extends the Pythagorean theorem with a correction for the angle. When C is 90°, its cosine is 0, the correction disappears and you get the familiar a² + b² = c². The area comes from half the two sides times the sine of the angle.
The formula
| a, b | The two known sides |
| C | The angle between those sides |
| c | The side opposite angle C |
Practical tips
- With a = 5, b = 7 and C = 60°, c is about 6.24 and the area is about 15.16.
- Angle C must be between sides a and b. If the angle is opposite one of them, use the law of sines.
- Check your calculator is in degrees if you do this by hand. Radians are a common source of errors.
Frequently asked questions
When do I use cosines rather than sines?
Use cosines when you know two sides and the included angle, or all three sides. Use sines when you know a side and its opposite angle.
Can I find an angle with this?
Yes, rearrange it: cos(C) = (a² + b² − c²) ÷ 2ab. This calculator solves for side c only.
What if the angle is over 90°?
It still works. The cosine turns negative, which makes side c longer.