Mathematics
Cosine rule: side or angle
Use the cosine rule to find the third side from two sides and the included angle, or all angles from three sides, plus area, perimeter and radii.
The example values can be changed. Press Calculate to update the result; you can download it as TXT or CSV and collect scenarios in this tab. JSON, HTML and TXT downloads keep your inputs and all result rows, with exact values where available. Automatic recalculation after editing is off unless you switch it on. Nothing is saved, imported or sent automatically.
Result
Formula / calculation:
Lengths use one common unit chosen by you; area uses its square. Angles are degrees. Positive sides at most 1e9; degenerate or numerically unresolved triangles are refused. Floating-point answers do not establish measurement accuracy or structural safety. Nonzero input magnitudes below 1e-30 or above 1e9 are refused.
Decimal results are approximate. Inputs stay in this browser tab.
How it works
Explicit geometry and ideal-model arithmetic; angles in degrees, entered dimensions and rates, or SI motion units. Lengths use one common unit chosen by you; area uses its square. Angles are degrees. Positive sides at most 1e9; degenerate or numerically unresolved triangles are refused. Floating-point answers do not establish measurement accuracy or structural safety. Nonzero input magnitudes below 1e-30 or above 1e9 are refused.
Worked example
With these example values the calculator gives the result below. You can change any value in the form above.
Inputs
- Known quantities
- a, b and included gamma
- Side a
- 3
- Side b
- 4
- Included gamma (degrees)
- 90
Result
- Side a
- 3
- Side b
- 4
- Side c
- 5
- Alpha (degrees)
- 36.8698976458
- Beta (degrees)
- 53.1301023542
- Gamma (degrees)
- 90
- Area (square chosen length unit)
- 6
- Perimeter (chosen length unit)
- 12
- Altitude to a
- 4
- Altitude to b
- 3
- Altitude to c
- 2.4
- Incircle radius
- 1
Frequently asked questions
What is the cosine rule formula?
The cosine rule is c² = a² + b² − 2ab·cos(gamma), where gamma is the included angle between sides a and b, and side c lies opposite it.
How do I find the third side of a triangle with the cosine rule?
Enter two sides and their included angle. For a = 3, b = 4 and gamma = 90 degrees, side c is 5, with angles of about 36.87 and 53.13 degrees.
Can I find the angles from three sides?
Yes. The cosine rule calculator also solves from all three sides, after checking the triangle inequality.
What else does the cosine rule calculator show?
It also shows area, perimeter, altitudes and the incircle and circumcircle radii. In the 3, 4, 5 example the area is 6 and the perimeter 12.
Which units and limits apply?
Lengths use one common unit you choose and area uses its square; angles are in degrees. Sides must be positive and at most 1e9, and degenerate triangles are refused.