Solving a triangle
A triangle has three sides and three angles, and in most cases three of these six values are enough to find the others. This calculator handles the two most common situations: two sides and the angle between them (SAS), solved with the law of cosines, and two angles and the side between them (ASA), solved with the law of sines. If you know all three sides, use the triangle calculator; for a right triangle, the Pythagorean theorem is quicker.
The laws
- Law of cosines: c² = a² + b² − 2ab cos C
- Law of sines: a ÷ sin A = b ÷ sin B = c ÷ sin C
- Angle sum: A + B + C = 180°
- Area: ½ × a × b × sin C
- Circumradius: R = c ÷ (2 sin C)
The law of cosines generalizes the Pythagorean theorem: when C = 90°, cos C = 0 and it becomes c² = a² + b².
Worked example: two sides and the angle between them
Sides a = 5 and b = 7, with an angle C = 60° between them.
- c² = 25 + 49 − 2 × 5 × 7 × 0.5 = 39, so c = 6.245.
- cos A = (b² + c² − a²) ÷ (2bc) = 63 ÷ 87.43, so A = 43.90°.
- B = 180° − 60° − 43.90° = 76.10°.
- Area = ½ × 5 × 7 × sin 60° = 15.155; perimeter = 18.245.
Worked example: two angles and the side between them
Angles A = 40° and B = 60°, with side c = 10 between them.
- C = 180° − 40° − 60° = 80°.
- a = 10 × sin 40° ÷ sin 80° = 6.527.
- b = 10 × sin 60° ÷ sin 80° = 8.794.
- Area = ½ × a × b × sin C = 28.26.
Which method for which data
| You know | Name | Method |
|---|---|---|
| Two sides and the angle between them | SAS | law of cosines, then angle sum |
| Two angles and the side between them | ASA | angle sum, then law of sines |
| Two angles and another side | AAS | angle sum, then law of sines |
| Three sides | SSS | law of cosines for each angle |
| Two sides and another angle | SSA | ambiguous: zero, one or two triangles |
Where it is used
Surveyors measure a baseline and two angles to locate a distant point, a technique called triangulation. Carpenters and roofers use the law of cosines to find rafter lengths for non-right angles, and navigators use it to combine courses and distances. The calculator works with any unit of length, as long as all sides use the same one; angles are in degrees.
Checking the result
The largest angle is always opposite the longest side, and the angles must add up to 180°. If two angles you enter add up to 180° or more, the calculator flags that no triangle exists.