How to solve any triangle: law of sines, law of cosines and the ambiguous case
A triangle has six measurements: three sides (a, b, c) and three angles (A, B, C), where each side is opposite the angle with the same letter. Knowing any three of them — as long as at least one is a side — usually determines the rest. The two tools you need are the law of cosines and the law of sines, plus the fact that the angles add up to 180°.
The solver identifies which case you have (SSS, SAS, ASA/AAS or SSA), picks the right law for each step, warns you about the ambiguous SSA case where two different triangles fit, and draws the result to scale.
Key formulas
A + B + C = 180°c² = a² + b² − 2ab cos Ca / sin A = b / sin B = c / sin C = 2RArea = ½ ab sin C · Heron: √(s(s−a)(s−b)(s−c)), s = (a+b+c)/2sin = opp/hyp, cos = adj/hyp, tan = opp/adjWorked examples
a = 8, c = 11, B = 37°.
- b² = 8² + 11² − 2·8·11·cos 37° ≈ 64 + 121 − 140.56 = 44.44, so b ≈ 6.666.
- Find A with the law of cosines: A ≈ 46.24°.
- C = 180° − 37° − 46.24° ≈ 96.76°.
a = 7, b = 9, c = 12.
- cos C = (49 + 81 − 144)/(2·7·9) = −14/126 ≈ −0.1111 → C ≈ 96.38° (obtuse).
- Similarly A ≈ 35.43° and B ≈ 48.19°.
a = 6, b = 8, A = 40°.
- sin B = 8 sin 40° / 6 ≈ 0.857, so B ≈ 58.99° or B ≈ 121.01°.
- Both leave a positive C: 81.01° or 18.99°.
a = 3, b = 4, c = 5.
- 3² + 4² = 25 = 5², so C = 90°.
- A = arctan(3/4) ≈ 36.87°, B ≈ 53.13°.
- Area = ½ · 3 · 4 = 6.
Which law for which case?
| Known values | Case | First step |
|---|---|---|
| Three sides | SSS | Law of cosines for an angle |
| Two sides + included angle | SAS | Law of cosines for the third side |
| Two angles + any side | ASA / AAS | Third angle, then law of sines |
| Two sides + non-included angle | SSA | Law of sines — check for 0, 1 or 2 triangles |
| Three angles | AAA | Shape only; size undetermined |
Understanding the ambiguous case
With two sides and an angle that is not between them, the side opposite the known angle can “swing” and touch the base in two places, one place, or not at all. Algebraically, sin B = k has two solutions between 0° and 180° (B and 180° − B). The solver keeps each solution that leaves a positive third angle, which is why it can report two triangles.
Common mistakes to avoid
- Using degree values while the calculator is in radian mode.
- Using the law of sines to find an obtuse angle (arcsin only returns angles up to 90°).
- Labelling sides inconsistently — side a must be opposite angle A.
- Forgetting the second solution in the SSA case.
Frequently asked questions
Can I solve a triangle from three angles?
Why does the solver sometimes return two triangles?
What units should I use?
Related tools and guides
Educational content. Results are computed in your browser with standard double-precision arithmetic; double-check anything with legal, financial, medical, or safety consequences. Spotted an error? Tell us and we will correct it.