Cosine Triangle Calculator
This calculator solves any triangle using the Law of Cosines, letting you find a missing side or all three angles depending on what information you already have. Choose SAS mode when you know two sides and the angle between them, entering side a, side b, and the included angle C in degrees; the calculator applies c² = a² + b² − 2ab·cos(C) to find the missing side c, then works out angles A and B. Choose SSS mode when you know all three side lengths and want every angle; enter sides a, b and c and the calculator rearranges the Law of Cosines with arccos to solve for angles A, B and C, checking they sum to exactly 180 degrees. Either way you get back the missing side or angle, the two remaining angles, the triangle's area, its perimeter, and a classification by both angle type (acute, right or obtuse) and side type (equilateral, isosceles or scalene). A worked example below the results shows the arithmetic step by step so you can follow how each figure was reached. This is useful for geometry homework, surveying, construction layout, navigation and any situation where you need to work out a triangle's dimensions from partial measurements. If your three side lengths cannot form a valid triangle, the calculator will flag it rather than return a misleading answer.
1. Solve Mode
2. Active Formula
In SAS mode, sides a and b are the two known sides and C is the angle between them. Side c is the unknown. In SSS mode, all sides are known and the formula is rearranged to find each angle using arccos.
Triangle Sides
Triangle Properties
The Law of Cosines Explained
The Law of Cosines is a fundamental trigonometric rule that relates the three sides of any triangle to one of its angles. It is most commonly written as:
where a, b, and c are side lengths and C is the angle opposite side c. The formula works for any triangle, not just right-angled ones. It is a direct generalisation of Pythagoras's theorem: when C equals 90 degrees, cos(C) = 0 and the formula reduces to c² = a² + b².
You can apply the same formula cyclically to find each angle or side:
- a² = b² + c² − 2bc·cos(A)
- b² = a² + c² − 2ac·cos(B)
- c² = a² + b² − 2ab·cos(C)
To find an angle from three known sides, rearrange to isolate the cosine term:
Then apply the inverse cosine function (arccos) to get the angle in degrees.
When to Use the Law of Cosines
| Known information | Configuration | Method |
|---|---|---|
| Two sides and the included angle | SAS | Law of Cosines: find the third side, then use Law of Sines or Cosines for remaining angles |
| All three sides | SSS | Law of Cosines rearranged: find each angle using arccos |
| Two angles and one side | AAS or ASA | Law of Sines is simpler |
| Two sides and a non-included angle | SSA | Law of Sines (note: may have two solutions) |
How the Calculator Works
In SAS mode, you enter sides a and b and the angle C between them. The calculator uses c² = a² + b² − 2ab·cos(C) to find side c, then finds angle A using cos(A) = (b² + c² − a²) / (2bc). Angle B follows from B = 180 − A − C.
In SSS mode, you enter all three sides. The calculator finds angle C = arccos((a² + b² − c²) / (2ab)), then angle A = arccos((b² + c² − a²) / (2bc)), and B = 180 − A − C. The three angles are always verified to sum to 180 degrees.
Area is calculated using the formula Area = (1/2)·a·b·sin(C), which requires only two sides and the included angle.
Triangle Classification
Once all three angles are known, the triangle is classified by its angles and by its sides:
- By angles: Acute (all angles under 90°), Right (one angle exactly 90°), or Obtuse (one angle over 90°).
- By sides: Equilateral (all three sides equal), Isosceles (two sides equal), or Scalene (no sides equal).
Worked Example
Suppose a = 5, b = 7, and C = 60°. Using the Law of Cosines:
- c² = 5² + 7² − 2(5)(7)cos(60°) = 25 + 49 − 70 × 0.5 = 74 − 35 = 39
- c = √39 ≈ 6.245 units
- cos(A) = (7² + 6.245² − 5²) / (2 × 7 × 6.245) = (49 + 39 − 25) / 87.43 = 63 / 87.43 ≈ 0.7206
- A = arccos(0.7206) ≈ 43.9°
- B = 180 − 60 − 43.9 = 76.1°
- Area = (1/2)(5)(7)sin(60°) = 17.5 × 0.866 ≈ 15.156 square units
Related Calculators
- Maths and Stats Calculators
- SOHCAHTOA Solver: right-triangle trigonometry using sine, cosine, and tangent ratios.
- Triangle Calculator (general): solve triangles using any combination of sides and angles.
- Area of a Triangle (Heron's Formula): find triangle area from three side lengths.
- Pythagorean Theorem Calculator: right-triangle sides using a² + b² = c².
Sources and method: Law of Cosines: standard trigonometric identity derived from the dot product of vectors. Area formula: (1/2)ab sin(C). Triangle classification follows standard geometric definitions. All calculations use exact floating-point arithmetic via JavaScript Math.cos, Math.acos, and Math.sqrt.
Results are computed to four decimal places. For very large or very small side lengths, floating-point rounding may affect the last digit. Always verify critical engineering calculations independently.