# How do I solve my triangle?

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.

- Page: https://www.acalculator.org/math/triangle-calculator
- JSON spec: https://www.acalculator.org/math/triangle-calculator.json
- Version: 1bf305e4838a

## Default answer

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.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| known | What do you know? | Which three parts of the triangle you know. |
| a | Side a | The length of side a, opposite angle A. |
| b | Side b | The length of side b, opposite angle B. |
| c | Side c | The length of side c, opposite angle C. |
| A | Angle A | The angle A, between sides b and c, opposite side a. |
| B | Angle B | The angle B, between sides a and c, opposite side b. |
| C | Angle C | The angle C, between sides a and b, opposite side c. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| sideA | Side a | The length of side a, opposite angle A. |
| sideB | Side b | The length of side b, opposite angle B. |
| sideC | Side c | The length of side c, opposite angle C. |
| angleA | Angle A | The angle opposite side a. |
| angleB | Angle B | The angle opposite side b. |
| angleC | Angle C | The angle opposite side c. |
| area | Area | The area inside the triangle, in square units. |
| perimeter | Perimeter | The sum of the three sides. |
| heightA | Height to side a | The distance from vertex A to the line through side a: 2 × area ÷ a. |
| heightB | Height to side b | The distance from vertex B to the line through side b: 2 × area ÷ b. |
| heightC | Height to side c | The distance from vertex C to the line through side c: 2 × area ÷ c. |
| medianA | Median to side a | The line from vertex A to the middle of side a. |
| medianB | Median to side b | The line from vertex B to the middle of side b. |
| medianC | Median to side c | The line from vertex C to the middle of side c. |
| inradius | Inradius | The radius of the largest circle inside the triangle: area ÷ half the perimeter. |
| circumradius | Circumradius | The radius of the circle through the three corners: a ÷ (2 sin A). |
| type | Type of triangle | Acute, right, or obtuse by its largest angle; equilateral, isosceles, or scalene by its sides. |

## 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°.

## Assumptions

- 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

1. known = sss, a = 5, b = 6, c = 7 gives angleA = 0.775193, angleB = 0.996961, angleC = 1.369438, area = 14.696938, perimeter = 18, inradius = 1.632993, circumradius = 3.572173, heightC = 4.199125, medianC = 4.272002, type = Acute scalene.
2. known = sas, a = 3, b = 4, C = 1.570796 gives sideC = 5, angleA = 0.643501, area = 6, circumradius = 2.5, type = Right scalene.
3. known = asa, A = 0.523599, B = 0.785398, c = 10 gives angleC = 1.832596, sideA = 5.176381, sideB = 7.320508, area = 18.30127, type = Obtuse scalene.
4. known = aas, A = 0.523599, B = 0.785398, a = 10 gives sideB = 14.142136, sideC = 19.318517, angleC = 1.832596.
5. known = ssa, a = 6, b = 8, A = 0.523599 gives sideC = 11.400339. Source: SSA, c² − 8√3 c + 28 = 0, so c = 4√3 ± √20 = 11.400339 or 2.456067.
6. known = sss, a = 10, b = 10, c = 10 gives angleA = 1.047198, area = 43.30127, type = Acute equilateral.
7. known = sss, a = 100,000, b = 99,999.99999, c = 0.00002 gives angleC = 0, 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).

## FAQ

### 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).

## Sources

- OpenStax, Algebra and Trigonometry 2e, §10.1 Non-right Triangles: Law of Sines and §10.2 Non-right Triangles: Law of Cosines (the ambiguous case, Heron’s formula). https://openstax.org/books/algebra-and-trigonometry-2e/pages/10-1-non-right-triangles-law-of-sines
- W. Kahan, "Miscalculating Area and Angles of a Needle-like Triangle" (2014), for the stable forms of the area and the angles. https://people.eecs.berkeley.edu/~wkahan/Triangle.pdf
- Weisstein, Eric W. "Triangle Median", MathWorld (m_a = ½√(2b² + 2c² − a²)). https://mathworld.wolfram.com/TriangleMedian.html
