Cosine Triangle Calculator
Calculate triangle angles, area, perimeter, heights, medians and radii from three sides using the Law of Cosines. Instant visual diagram.
About
Misidentifying a triangle's angles from its side lengths is a common source of error in surveying, structural engineering, and CNC machining. The Law of Cosines generalizes the Pythagorean theorem to non-right triangles: given three sides a, b, and c, each angle is recovered via γ = arccos(a2 + b2 − c22ab). This calculator applies that identity to all three vertices, then derives area via Heron's formula, altitudes, medians, circumradius R, and inradius r. Results assume Euclidean flat-plane geometry. For geodetic triangles on Earth's surface exceeding roughly 50 km per side, spherical excess introduces measurable deviation.
Formulas
The Law of Cosines relates each angle to the three side lengths. For a triangle with sides a, b, c opposite to angles α, β, γ respectively:
The area is computed via Heron's formula using the semi-perimeter s = a + b + c2:
Heights (altitudes) from the area relation:
Medians via the median length formula:
Circumscribed and inscribed circle radii:
Where: a, b, c = side lengths. α, β, γ = angles opposite the respective sides. s = semi-perimeter. A = area. R = circumradius. r = inradius. hx = altitude to side x. mx = median to side x.
Reference Data
| Property | Formula | Unit | Notes |
|---|---|---|---|
| Angle α | arccos((b2 + c2 − a2) ÷ 2bc) | ° | Opposite side a |
| Angle β | arccos((a2 + c2 − b2) ÷ 2ac) | ° | Opposite side b |
| Angle γ | arccos((a2 + b2 − c2) ÷ 2ab) | ° | Opposite side c |
| Semi-perimeter s | (a + b + c) ÷ 2 | units | Half of perimeter |
| Area A | √s(s−a)(s−b)(s−c) | units2 | Heron's formula |
| Perimeter P | a + b + c | units | Sum of sides |
| Height ha | 2A ÷ a | units | Altitude to side a |
| Height hb | 2A ÷ b | units | Altitude to side b |
| Height hc | 2A ÷ c | units | Altitude to side c |
| Median ma | 12√2b2 + 2c2 − a2 | units | To midpoint of a |
| Median mb | 12√2a2 + 2c2 − b2 | units | To midpoint of b |
| Median mc | 12√2a2 + 2b2 − c2 | units | To midpoint of c |
| Circumradius R | abc4A | units | Circumscribed circle radius |
| Inradius r | As | units | Inscribed circle radius |
| Triangle inequality | a + b > c | - | Must hold for all permutations |
| Angle sum | α + β + γ = 180° | ° | Euclidean constraint |
| Right triangle test | a2 + b2 = c2 | - | Pythagorean special case |
| Equilateral area | √34a2 | units2 | When a = b = c |
| Isosceles test | Two sides equal | - | Two angles also equal |
| Scalene definition | All sides different | - | All angles different |
| Obtuse test | c2 > a2 + b2 | - | Largest angle > 90° |