Calculators guide
How to Solve Any Triangle: Which Rule to Use and When
Pick the right rule for what you know — law of cosines, law of sines or Pythagoras — with worked examples, the SSA ambiguous case and quick answer checks.
By M2Toolkit Editorial TeamPublished 8 min read
Quick answer
Match the rule to what you know. Three sides, or two sides with the angle between them: use the law of cosines. Two angles and any side: subtract from 180° for the third angle, then use the law of sines. A right angle: Pythagoras and SOH-CAH-TOA.
The only tricky case is two sides and an angle that isn't between them (SSA), which can give two different triangles. The Triangle Calculator handles all of these and draws the result to scale.
“Solving” a triangle means finding all three sides and all three angles from the three you're given. The method depends entirely on which three you have, and most wrong answers come from picking the wrong rule or labelling the sides inconsistently. Here's how to choose, with worked numbers.
First, label it consistently
Call the angles A, B and C, and name each side after the angle opposite it: side a faces angle A, side b faces B, side c faces C. Every formula below assumes this. If your textbook diagram labels sides differently, relabel before you start — it's the single most common source of errors.
Which rule to use
| You know | Name | Start with | Then |
|---|---|---|---|
| 3 sides | SSS | Law of cosines for one angle | Law of cosines again (or 180° rule) |
| 2 sides + angle between them | SAS | Law of cosines for the third side | Law of cosines for a second angle |
| 2 angles + side between them | ASA | Third angle = 180° − the other two | Law of sines for both sides |
| 2 angles + a side not between them | AAS | Third angle = 180° − the other two | Law of sines |
| 2 sides + angle not between them | SSA | Law of sines | Check for a second solution |
| Right triangle, any 2 values | — | Pythagoras or sin/cos/tan | 90° − the known acute angle |
| 3 angles | AAA | Not solvable | Shape is fixed, size isn't — you need a side |
The two rules you need
The law of cosines is Pythagoras with a correction term: when C = 90°, cos C = 0 and it becomes c² = a² + b². Rearranged, it gives an angle from three sides: cos C = (a² + b² − c²) ÷ 2ab. The law of sines links each side to the angle opposite it, so you need at least one matching side–angle pair to use it.
Prefer the law of cosines when finding an angle if you can. An inverse cosine gives a unique angle between 0° and 180°, while an inverse sine only returns angles up to 90° — the root of the ambiguous case below.
Worked example: two sides and the angle between them
A triangular garden bed has sides of 5 m and 7 m meeting at 49°. How long is the third side, and what are the other angles?
- 1Third side: c² = 5² + 7² − 2 × 5 × 7 × cos 49° = 25 + 49 − 70 × 0.6561 = 28.07, so c ≈ 5.30 m.
- 2Angle A (opposite the 5 m side): cos A = (7² + 5.30² − 5²) ÷ (2 × 7 × 5.30) → A ≈ 45.41°.
- 3Angle B = 180° − 49° − 45.41° ≈ 85.59°.
- 4Area = ½ × 5 × 7 × sin 49° ≈ 13.21 m² — handy for working out soil or mulch.
The ambiguous case (SSA): zero, one or two triangles
Suppose you know side a, side b and angle A, where A is not between them. Picture side b fixed with angle A at one end, and side a hanging from the other end like a swinging arm. Depending on its length, it reaches the base line not at all, once, or in two places. Compare a with the height h = b·sin A:
| If angle A is acute and… | Number of triangles |
|---|---|
| a < h | None — side a is too short to reach |
| a = h | One, with a right angle at B |
| h < a < b | Two — B and 180° − B both work |
| a ≥ b | One |
With a = 7, b = 10 and A = 40°: h = 10 × sin 40° ≈ 6.43, which is less than 7, which is less than 10 — so there are two triangles. The sine rule gives sin B = 10 × sin 40° ÷ 7 ≈ 0.918, so B ≈ 66.67° or 113.33°. The first gives C ≈ 73.33° and c ≈ 10.43; the second gives C ≈ 26.67° and c ≈ 4.89. Both are valid; an exam usually wants both, and a real-world problem needs extra information to choose.
If angle A is 90° or more, there is one triangle when a > b and none otherwise.
Three ways to find the area
Heron's formula is the one to reach for when you've measured three sides and no angles — the usual situation when surveying a plot with a tape. For sides 7, 8 and 9: s = 12 and the area is √(12 × 5 × 4 × 3) = √720 ≈ 26.83. If you only need area, perimeter or a right-angled triangle, the Area Calculator and Pythagorean Theorem Calculator are quicker.
A practical one: roof rafters
A roof spans 7.2 m with a 35° pitch, so each half is a right triangle with a horizontal run of 3.6 m. The rise is 3.6 × tan 35° ≈ 2.52 m, and the rafter length (before overhang) is 3.6 ÷ cos 35° ≈ 4.39 m. In the calculator, choose Right, enter b = 3.6 and A = 35°.
How to check your answer
- Angles add up to 180° (allow for rounding).
- The longest side is opposite the largest angle, and the shortest opposite the smallest.
- Any two sides add up to more than the third.
- Plug your results into the law of sines: a ÷ sin A, b ÷ sin B and c ÷ sin C should all be equal.
- Your calculator is in degrees, not radians — sin 40 in radian mode is about 0.745 instead of 0.643.
Frequently asked questions
Can you solve a triangle with only two values?
Only a right triangle, because the right angle counts as the third value. Any other triangle needs three measurements including at least one side.
When do I use the law of sines instead of the law of cosines?
Use the law of sines when you know a side and the angle opposite it (ASA, AAS, SSA). Use the law of cosines when you know all three sides, or two sides and the angle between them.
Why does my calculator give a different angle from the textbook?
Usually it's set to radians, or you're in the ambiguous case and the book wants the obtuse answer (180° minus what sin⁻¹ returns).