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.

Calculate.co.nz is proud to be partnered with Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
Standard formula  Law of Cosines: c² = a² + b² − 2ab·cos(C). Exact trigonometric identities.

1. Solve Mode

Please check your inputs. Ensure all values are positive numbers and the sides can form a valid triangle.

2. Active Formula

c² = a² + b² − 2ab·cos(C)

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.

Results

Side c
6.245
Opposite angle C
Angle A
43.9°
Opposite side a
Angle B
76.1°
Opposite side b
Angle C
60°
Opposite side c

Triangle Sides

Side a5
Side b7
Side c6.245
Perimeter18.245

Triangle Properties

Angle A43.9°
Angle B76.1°
Angle C60°
Area15.1554 sq units
Triangle typeAcute, Scalene
Worked example: With sides a = 5, b = 7 and included angle C = 60°, the Law of Cosines gives c² = 25 + 49 − 2(5)(7)cos(60°) = 74 − 35 = 39, so c = 6.245 units.

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:

c² = a² + b² − 2ab·cos(C)

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:

To find an angle from three known sides, rearrange to isolate the cosine term:

cos(C) = (a² + b² − c²) / (2ab)

Then apply the inverse cosine function (arccos) to get the angle in degrees.

When to Use the Law of Cosines

Known informationConfigurationMethod
Two sides and the included angleSASLaw of Cosines: find the third side, then use Law of Sines or Cosines for remaining angles
All three sidesSSSLaw of Cosines rearranged: find each angle using arccos
Two angles and one sideAAS or ASALaw of Sines is simpler
Two sides and a non-included angleSSALaw 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:

Worked Example

Suppose a = 5, b = 7, and C = 60°. Using the Law of Cosines:

Related Calculators

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.