Skip to main content
ponderloop

Triangle Calculator

A triangle is solved from three known parts, at least one of them a side, with the law of cosines and the law of sines. For sides 7, 8, 9 the result is: Acute scalene triangle, area 26.8328, with angles 48.1897°, 58.4119°, 73.3985° and perimeter 24. Two sides and an angle opposite one of them (SSA) can fit two triangles: a = 7, b = 8 and A = 40° give B = 47.2746° or 132.725°, and the calculator shows both, or says that none fits. Choose SSS, SAS, ASA, AAS, SSA or a right triangle, type the three known parts, and get every side and angle, the area, the three heights and the triangle type, with the working written out and a drawing scaled to the answer.

Updated Runs in your browser: nothing you enter is uploadedHow this tool works

Enter all three sides: a, b and c.

Angles are in degrees. Sides can be in any one unit. Need a slope or a stair run instead? Try the slope calculatoror the stair calculator.

Acute scalene triangle, area 26.8328

a = 7, b = 8, c = 9; A = 48.1897°, B = 58.4119°, C = 73.3985°.

The triangle

ABCabc
Side a
7
Side b
8
Side c
9
Angle A
48.1897°
Angle B
58.4119°
Angle C
73.3985°
Perimeter
24
Area
26.8328
Height onto side a
7.66652
Height onto side b
6.7082
Height onto side c
5.96285
Inscribed circle radius
2.23607
Circumscribed circle radius
4.69574
Triangle type
Acute scalene

The working

  1. Check the sides. The longest side, c = 9, is shorter than the other two added together (15), so the sides can close into a triangle.
  2. Angle A. Law of cosines: cos A = (b² + c² − a²) / (2bc) = (8² + 9² − 7²) / (2 × 8 × 9) = 0.666667, so A = 48.1897°.
  3. Angle B. cos B = (a² + c² − b²) / (2ac) = (7² + 9² − 8²) / (2 × 7 × 9) = 0.52381, so B = 58.4119°.
  4. Angle C. cos C = (a² + b² − c²) / (2ab) = (7² + 8² − 9²) / (2 × 7 × 8) = 0.285714, so C = 73.3985°. The three angles add up to 180°.
  5. Perimeter. P = a + b + c = 7 + 8 + 9 = 24.
  6. Area. Area = ½ × a × b × sin C = ½ × 7 × 8 × sin 73.3985° = 26.8328. Heron’s formula, √(s(s − a)(s − b)(s − c)) with s = 12, gives the same area.
  7. Heights. The height onto a side is twice the area divided by that side: h_a = 2 × 26.8328 / 7 = 7.66652, h_b = 2 × 26.8328 / 8 = 6.7082, h_c = 2 × 26.8328 / 9 = 5.96285.
  8. Type. Acute scalene: all three sides differ, and the largest angle is 73.3985°, which makes it acute.

Worked examples

Each row is solved by the calculator above. Sides are a, b, c and angles A, B, C; the unit is left out, so the sides can be in any one unit and the area is in that unit squared.
Known partsSides a, b, cAngles A, B, CArea
SSS: a = 7, b = 8, c = 97, 8, 948.1897°, 58.4119°, 73.3985°26.8328
SAS: a = 7, b = 8, C = 80°7, 8, 9.672245.4574°, 54.5426°, 80°27.5746
ASA: A = 40°, B = 60°, c = 95.87433, 7.91447, 940°, 60°, 80°22.8929
AAS: A = 40°, B = 60°, a = 77, 9.43107, 10.724640°, 60°, 80°32.5073
SSA: a = 7, b = 8, A = 40° (solution 1)7, 8, 10.877740°, 47.2746°, 92.7254°27.9683
SSA: a = 7, b = 8, A = 40° (solution 2)7, 8, 1.3789640°, 132.725°, 7.27464°3.54552
Right: legs a = 3, b = 43, 4, 536.8699°, 53.1301°, 90°6
Right: leg a = 7, hypotenuse c = 97, 5.65685, 951.0576°, 38.9424°, 90°19.799

SSA: how many triangles fit

Two sides and an angle opposite one of them. Let h = b sin A be the height from vertex C to the base. Side a is opposite angle A.
Angle ASide a compared with the othersTrianglesExample
Acutea < hNonea = 4, b = 8, A = 40°: No triangle fits these numbers
Acutea = hOne (a right triangle, B = 90°)a = 5, b = 10, A = 30°: B = 90°, c = 8.66025
Acuteh < a < bTwo (B acute or obtuse)a = 7, b = 8, A = 40°: B = 47.2746° or 132.725°
Acutea ≥ bOne (B acute)a = 10, b = 8, A = 40°: B = 30.946°
Right or obtusea ≤ bNonea = 7, b = 8, A = 120°: No triangle fits these numbers
Right or obtusea > bOne (B acute)a = 10, b = 8, A = 120°: B = 43.8538°

Triangle types

Named by its sides and by its largest angle. The examples are solved from three sides.
TypeRuleExample sidesCalculator says
EquilateralAll three sides equal; every angle is 60°5, 5, 5Equilateral (and acute)
IsoscelesTwo sides equal; the angles opposite them are equal5, 5, 6Acute isosceles
ScaleneNo two sides equal7, 8, 9Acute scalene
RightOne angle is 90°; a² + b² = c²3, 4, 5Right scalene
ObtuseOne angle is more than 90°4, 5, 8Obtuse scalene

How to solve a triangle

  1. Pick what you know. Choose the combination that matches your three known parts: Three sides (SSS), Two sides and the angle between them (SAS), Two angles and the side between them (ASA), Two angles and a side not between them (AAS), Two sides and an angle not between them (SSA) or a right triangle. Side a is opposite angle A, side b opposite B and side c opposite C.
  2. Enter the three values. Type the sides in any one unit (pick it from the list, or leave it as plain numbers) and the angles in degrees. Only the fields that the chosen combination needs are shown.
  3. Read the sides and angles. For sides 7, 8, 9 the calculator gives angles 48.1897°, 58.4119°, 73.3985°. If your three parts allow two triangles, both are shown; if none fits, the working says why.
  4. Use the area, heights and type. The same result lists the perimeter (24), the area (26.8328), the height onto each side (7.66652, 6.7082, 5.96285) and the type (Acute scalene).
  5. Check the working. Each step is written out with your numbers, for example: Law of cosines: cos A = (b² + c² − a²) / (2bc) = (8² + 9² − 7²) / (2 × 8 × 9) = 0.666667, so A = 48.1897°.

Frequently asked questions

How do you solve a triangle?
Use the three known parts to find the rest. With three sides, the law of cosines gives each angle: cos A = (b² + c² − a²) / (2bc). With two sides and the angle between them, the law of cosines gives the third side, then the law of sines gives another angle. With two angles and any side, the third angle is 180° minus the other two and the law of sines gives the other sides. For sides 7, 8, 9 that yields 48.1897°, 58.4119°, 73.3985°.
Which three known parts are enough?
Three parts that include at least one side: SSS, SAS, ASA, AAS, or SSA (which can be ambiguous). Three angles (AAA) are not enough, because a triangle can be scaled up or down without changing its angles: they fix the shape but not the size. In a right triangle the 90° angle counts as one known part, so two more are enough, such as two legs: sides 3 and 4 give the hypotenuse 5 and angles 36.8699°, 53.1301°, 90°.
What is the ambiguous case (SSA)?
Given sides a and b and angle A opposite a, side a may swing to meet the base at two different points. For a = 7, b = 8 and A = 40° both B = 47.2746° (then C = 92.7254°, c = 10.8777) and B = 132.725° (then C = 7.27464°, c = 1.37896) are valid, because sin B has the same value for an angle and its supplement. The calculator shows both.
How many triangles can SSA give?
Zero, one or two. With an acute angle A and h = b sin A: none if a < h (no triangle fits these numbers for a = 4, b = 8, A = 40°), exactly one right triangle if a = h, two if h < a < b, and one if a ≥ b. With a right or obtuse angle A there is one triangle if a > b and none otherwise (a = 7, b = 8, A = 120° has none).
When do I use the law of cosines and when the law of sines?
Use the law of cosines (c² = a² + b² − 2ab cos C) when you know three sides, or two sides and the angle between them. Use the law of sines (a / sin A = b / sin B = c / sin C) when you know a side and the angle opposite it plus one more angle or side. The calculator picks the right one and writes it out. For the first angle after an SAS step it finds the angle opposite the shorter side, which must be acute, so the law of sines has only one answer.
How is the area of a triangle found?
The area is ½ × a × b × sin C, or from the three sides by Heron’s formula, √(s(s − a)(s − b)(s − c)) with s = (a + b + c) / 2. For sides 7, 8, 9, s = 12 and the area is 26.8328. The tool computes it with a rearranged Heron’s formula by William Kahan that stays accurate for very thin triangles.
How do I find the height of a triangle?
The height onto a side is twice the area divided by that side. For sides 7, 8, 9 and area 26.8328, the height onto side a is 7.66652, onto side b 6.7082 and onto side c 5.96285. The three heights are the altitudes, drawn from each vertex at a right angle to the opposite side.
Why does the calculator say my sides do not make a triangle?
Each side must be shorter than the other two added together (the triangle inequality). Sides 1, 2 and 3 fail because 1 + 2 = 3, which leaves no height: Side c (3) must be shorter than the other two added together (3), or the sides cannot meet to close a triangle. In the same way, angles A and B must add up to less than 180°.
How do I solve a right triangle?
Enter any two of: the legs a and b, the hypotenuse c, and one of the other two angles. The Pythagorean theorem a² + b² = c² links the sides, and the angles come from sine, cosine and tangent. A leg a = 7 and hypotenuse c = 9 give the other leg 5.65685 and angles 51.0576° and 38.9424°.
How is the type of a triangle decided?
By its sides: equilateral if all three are equal, isosceles if two are, scalene if none are. By its largest angle: acute if it is under 90°, right if it is 90°, obtuse if it is over 90°. Sides 7, 8, 9 make an acute scalene triangle; 5, 5, 5 is equilateral (and acute), and 4, 5, 8 is obtuse scalene.
What units does it use, and how is the answer rounded?
Angles are in degrees. Sides can be in any one unit: pick it from the list to label the results, or leave it as plain numbers. The area is in that unit squared. Results are shown to six significant digits; the calculation itself keeps full double precision, so nothing is rounded between steps.
Where would I use this in building?
Anywhere a length or an angle is hard to measure directly: the length of a diagonal brace, the angle of a rafter cut, the height of a gable from its span and slope, or a corner that is not square. Put the dimensions in as a right triangle for squareness checks and as SAS or ASA for an irregular corner.

How it works

The three known parts are read as numbers (sides from 0.000001 to 1,000,000,000, angles above 0 and below 180 degrees) and the matching method is run. SSS: the angles come from the half-angle form of the law of cosines, tan(A/2) = √((s − b)(s − c) / (s(s − a))) with s the half-perimeter, which is the law of cosines rewritten to stay accurate for thin triangles. SAS: the third side is c² = a² + b² − 2ab cos C, computed as (a − b)² + 4ab sin²(C/2); the angle opposite the shorter known side is found next (it is always acute, so the law of sines has one answer) and the last angle is 180° minus the other two. ASA and AAS: the third angle is 180° − A − B and the law of sines gives the sides. SSA: with h = b sin A, a = h gives one right triangle, h < a < b gives two (B = arcsin(b sin A / a) and its supplement), a ≥ b with an acute A gives one, an obtuse or right A needs a > b, and otherwise no triangle fits. A right triangle uses the Pythagorean theorem and sine, cosine and tangent, with C = 90°. The area is Kahan’s rearrangement of Heron’s formula, the height onto a side is twice the area divided by the side, the inscribed circle radius is area / half-perimeter and the circumscribed circle radius is a / (2 sin A). The type compares sides and angles with a tolerance of one part in a billion. The drawing places side c along the bottom and scales the triangle to fit. Everything runs in your browser and nothing you type is sent anywhere.

Sources

More: Geometry and measurementAll math & numbersAll toolsHome & DIY calculators