How do I solve my triangle?
Pick what you know about the triangle and type those three values. The triangle calculator finds every other side and angle, including both triangles in the ambiguous case.
- Area
- 14.696938
A triangle with sides 5, 6, and 7 has angles 44.415309°, 57.12165°, and 78.463041°, and an area of 14.696938.
- Side a
- 5
- Side b
- 6
- Side c
- 7
- Angle A
- 44.415309°
- Angle B
- 57.12165°
- Angle C
- 78.463041°
- Perimeter
- 18
- Height to side a
- 5.878775
- Height to side b
- 4.898979
- Height to side c
- 4.199125
- Median to side a
- 6.020797
- Median to side b
- 5.291503
- Median to side c
- 4.272002
- Inradius
- 1.632993
- Circumradius
- 3.572173
- Type of triangle
- Acute scalene
Area: 14.696938. A triangle with sides 5, 6, and 7 has angles 44.415309°, 57.12165°, and 78.463041°, and an area of 14.696938.
What does the triangle look like?
How to calculate
Solves any triangle from three of its sides and angles (SSS, SAS, ASA, AAS, or SSA with both triangles): the other sides and angles, area, perimeter, heights, medians, and radii.
Example with the default inputs (What do you know? Sides a, b, c (SSS), Side a 5, Side b 6, Side c 7): A triangle with sides 5, 6, and 7 has angles 44.415309°, 57.12165°, and 78.463041°, and an area of 14.696938.
Method: Law of cosines a² = b² + c² − 2bc cos A and law of sines a ÷ sin A = b ÷ sin B = c ÷ sin C, with A + B + C = 180°.
- Exactly three of the six values are typed, and at least one is a side.
- Sides are positive numbers in any one unit; angles are more than 0° and less than 180°, in degrees or radians.
- Two sides and an angle not between them can fit two triangles (the ambiguous case): values that differ show as a pair.
- Angles and areas come from the typed values in stable forms (Kahan), so needle-like triangles keep their accuracy.
Worked examples
Each example is checked against the calculator on every build.
- What do you know? Sides a, b, c (SSS), Side a 5, Side b 6, Side c 7 gives Angle A 44.415309°, Angle B 57.12165°, Angle C 78.463041°, Area 14.696938, Perimeter 18, Inradius 1.632993, Circumradius 3.572173, Height to side c 4.199125, Median to side c 4.272002, Type of triangle Acute scalene.
- What do you know? Sides a, b, angle C (SAS), Side a 3, Side b 4, Angle C 90° gives Side c 5, Angle A 36.869898°, Area 6, Circumradius 2.5, Type of triangle Right scalene.
- What do you know? Angles A, B, side c (ASA), Angle A 30°, Angle B 45°, Side c 10 gives Angle C 105°, Side a 5.176381, Side b 7.320508, Area 18.30127, Type of triangle Obtuse scalene.
- What do you know? Angles A, B, side a (AAS), Angle A 30°, Angle B 45°, Side a 10 gives Side b 14.142136, Side c 19.318517, Angle C 105°.
- What do you know? Sides a, b, angle A (SSA), Side a 6, Side b 8, Angle A 30° gives Side c 11.400339.Source: SSA, c² − 8√3 c + 28 = 0, so c = 4√3 ± √20 = 11.400339 or 2.456067
- What do you know? Sides a, b, c (SSS), Side a 10, Side b 10, Side c 10 gives Angle A 60°, Area 43.30127, Type of triangle Acute equilateral.
- What do you know? Sides a, b, c (SSS), Side a 100,000, Side b 99,999.99999, Side c 0.00002 gives Angle C 0.00000000992392°, Area 0.866025.Source: Needle triangle (Kahan 2014): mpmath at 100 digits on the float inputs, C from the law of cosines, area by Heron (progress log)
How it works
Side a is opposite angle A, side b opposite B, and side c opposite C, so angle C is between sides a and b. Pick what you know, and type those three values:
| What you know | You type |
|---|---|
| Three sides (SSS) | a, b, c |
| Two sides and the angle between them (SAS) | a, b, C |
| Two angles and the side between them (ASA) | A, B, c |
| Two angles and a side not between them (AAS) | A, B, a |
| Two sides and an angle not between them (SSA) | a, b, A |
If your triangle is labelled another way, rename its corners to match: any triangle can be labelled so.
- SSS: each angle by the law of cosines, cos A = (b² + c² − a²) ÷ 2bc, and likewise for B and C.
- SAS: the third side by the law of cosines, c² = a² + b² − 2ab cos C; then the other two angles.
- ASA and AAS: the third angle is 180° minus the other two; each other side by the law of sines, a ÷ sin A = b ÷ sin B = c ÷ sin C.
- SSA: with the angle A opposite side a, the third side c solves c² − 2b cos A · c + (b² − a²) = 0, so c = b cos A ± √(a² − b² sin² A). Every positive root is a triangle: none, one, or two.
Then, for each triangle:
- Area: Heron’s formula √(s(s − a)(s − b)(s − c)) with s = (a + b + c) ÷ 2 for three sides; ½ × side × side × sin(angle between them) otherwise.
- Perimeter: a + b + c.
- Heights: h_a = 2 × area ÷ a, and likewise h_b and h_c.
- Medians: m_a = ½√(2b² + 2c² − a²), and likewise m_b and m_c.
- Inradius: r = area ÷ s. Circumradius: R = a ÷ (2 sin A), which is the same for every side and its opposite angle.
- Type: by the largest angle, right when it is within 10⁻¹² radians of 90°, else acute (less) or obtuse (more); by the sides, equilateral when all three are equal, isosceles when two are, and scalene otherwise, where two sides count as equal when they differ by at most one part in 10¹² of the longer one. The type is written as, for example, "Acute scalene", "Right isosceles", "Obtuse scalene", or "Acute equilateral".
Accuracy in thin triangles
Before solving, the typed sides are divided by a power of two near the geometric mean of the longest and shortest typed side (an exact step), and the answers are multiplied back. So a triangle is solved whenever its values fit a 64-bit float, however large or small its sides: 3, 4, 5 × 10⁻¹⁵⁰ and × 10¹⁵⁰ both work.
The calculator computes in forms that give the same values but keep their accuracy when a triangle is needle-thin (Kahan, 2014). Each angle from three sides uses Kahan's half-angle formula; with two sides and an angle, the other angles come from atan2 of their sine and cosine parts; the third of two angles is found with π to more digits than a 64-bit float; Heron's area uses Kahan's ordering of the sides. No angle is found as 180° minus a rounded sum. They give the exact values of the textbook formulas for the numbers typed, with less rounding.
Rules and messages
- Three sides where one is as long as the other two together, or longer: "The three sides cannot make a triangle: each side must be shorter than the other two together."
- Two angles that add up to 180° or more, or to within one part in 10¹² of 180°: "These two angles add up to 180° or more, so they cannot be in one triangle."
- SSA with a less than b sin A: "No triangle fits: side a is too short to reach the third side." With A of 90° or more and a no longer than b: "No triangle fits: the side opposite an angle of 90° or more must be the longest side."
- A triangle where a value would be beyond what a 64-bit float can hold (above about 1.8 × 10³⁰⁸), or whose area would be below 2.2250738585072014 × 10⁻³⁰⁸, gives no answer: "This triangle is too large or too small to work out."
- SSA with a within one part in 10¹² of b sin A counts as the single right triangle c = b cos A, with the right angle at B (so a = 5, b = 10, A = 30° typed in degrees gives one triangle, not two nearly equal ones). That needs A under 90° by more than one part in 10¹²; otherwise (for example a = b and A = 90°) no triangle fits: "No triangle fits: the side opposite an angle of 90° or more must be the longest side."
The ambiguous case on the page
When two triangles fit, each value that differs between them (by more than one part in 10¹² of the larger) shows as a pair ("11.400339 or 2.456067"), the larger third side first. The three typed values, the circumradius R = a ÷ (2 sin A), and the height to side c (b sin A) are the same for both and show once. The drawing shows the first triangle.
Assumptions
- Sides are positive numbers in any one unit; the area is in that unit squared.
- Angles are more than 0° and less than 180°, typed in degrees or radians (radians = degrees × π ÷ 180). Solved angles show in degrees.
- Answers show at most 6 decimals, or 6 significant figures below 0.0001, rounded half up on the decimal value.
Worked examples by hand
Sides 5, 6, 7 (SSS). cos A = (36 + 49 − 25) ÷ 84 = 5/7, so A = 44.415° (0.775193 rad). cos B = (25 + 49 − 36) ÷ 70 = 19/35, so B = 57.122°. C = 78.463°. With s = 9, the area is √(9 × 4 × 3 × 2) = 6√6 = 14.696938. Perimeter 18, inradius 14.696938 ÷ 9 = 1.632993, circumradius 7 ÷ (2 sin C) = 3.572173, height to c = 2 × 14.696938 ÷ 7 = 4.199125, median to c = ½√(50 + 72 − 49) = ½√73 = 4.272002. Acute scalene.
a = 3, b = 4, C = 90° (SAS). c² = 9 + 16 − 24 cos 90° = 25, so c = 5. A = arctan(3/4) = 36.87°. Area = ½ × 3 × 4 × sin 90° = 6; circumradius 5 ÷ (2 sin 90°) = 2.5. Right scalene.
A = 30°, B = 45°, a = 10 (AAS). C = 105°. b = 10 × sin 45° ÷ sin 30° = 10√2 = 14.142136; c = 10 × sin 105° ÷ sin 30° = 19.318517.
A = 30°, B = 45°, c = 10 (ASA). C = 180° − 30° − 45° = 105°. a = 10 × sin 30° ÷ sin 105° = 5.176381; b = 10 × sin 45° ÷ sin 105° = 7.320508. Area = ½ × 5.176381 × 7.320508 × sin 105° = 18.30127. Obtuse scalene.
a = 6, b = 8, A = 30° (SSA). c² − 2 × 8 × cos 30° × c + (64 − 36) = 0, that is c² − 8√3 c + 28 = 0, so c = 4√3 ± √20 = 11.400339 or 2.456067. Both are positive, so two triangles fit.
Sides 10, 10, 10. Every angle is 60°, and the area is √3 ÷ 4 × 10² = 43.30127. Acute equilateral.
A needle: sides 100,000, 99,999.99999, and 0.00002. The smallest angle is about 1.732 × 10⁻¹⁰ radians and the area about 0.866025. A plain law-of-cosines formula loses most digits here; the stable forms keep them.
Other questions people ask
How do I solve a triangle from three sides?
Use the law of cosines for each angle: cos A = (b² + c² − a²) ÷ 2bc. For sides 5, 6, and 7, cos A = (36 + 49 − 25) ÷ 84 = 0.7143, so A = 44.42°. The area comes from Heron’s formula: with s = 9, √(9 × 4 × 3 × 2) = 14.70.
How do I find the angles of a triangle?
With three sides, use the law of cosines as above. With two angles, the third is 180° minus the other two. With two sides and an angle, use the law of cosines or the law of sines for the next angle. Pick what you know on the calculator, and it uses the right method.
What is the ambiguous case (SSA)?
Two sides and an angle that is not between them can fit two different triangles, one, or none. With a = 6, b = 8, and A = 30°, side c can be 11.40 or 2.46: both triangles are real. The calculator shows both, as a pair of values for each part that differs.
Why do I need at least one side?
Three angles fix the shape of a triangle but not its size: a triangle with angles 30°, 60°, 90° can be any size. One length sets the scale.
Which three sides can make a triangle?
Each side must be shorter than the other two added together (the triangle inequality). 3, 4, and 5 work; 3, 4, and 8 do not, because 3 + 4 is less than 8; and 3, 4, and 7 would lie flat.
What is the difference between a height and a median?
A height (altitude) drops from a corner to the opposite side at a right angle. A median runs from a corner to the middle of the opposite side. They are the same line only when the two sides next to that corner are equal.
What are the inradius and circumradius?
The inradius is the radius of the largest circle that fits inside the triangle, r = area ÷ s (s is half the perimeter). The circumradius is the radius of the circle through all three corners, R = a ÷ (2 sin A).