Skip to content
Omnikalc

Law of sines and cosines calculator: solve any triangle

Solve a triangle from two sides and the angle between them, or from two angles and the side between them, with every side, angle and the area.

Updated on
Your inputs
I know

Value out of range

Value out of range

°

Value out of range

°

Value out of range

°

Value out of range

Value out of range

Results

Side c

6.245

Angle A

43.90 °

Angle B

76.10 °

Side a
5
Side b
7
Angle C
60.00 °
Area
15.1554
Perimeter
18.245
Circumradius (circle through the 3 vertices)
3.60555

Other angles C for the same sides a and b

Side cArea
30° current3.657638.75
45° current4.9512.3744
60° current6.24515.1554
90° current8.6023317.5
120° current10.440315.1554
150° current11.60278.75

Solving a triangle

A triangle has three sides and three angles, and in most cases three of these six values are enough to find the others. This calculator handles the two most common situations: two sides and the angle between them (SAS), solved with the law of cosines, and two angles and the side between them (ASA), solved with the law of sines. If you know all three sides, use the triangle calculator; for a right triangle, the Pythagorean theorem is quicker.

The laws

  • Law of cosines: c² = a² + b² − 2ab cos C
  • Law of sines: a ÷ sin A = b ÷ sin B = c ÷ sin C
  • Angle sum: A + B + C = 180°
  • Area: ½ × a × b × sin C
  • Circumradius: R = c ÷ (2 sin C)

The law of cosines generalizes the Pythagorean theorem: when C = 90°, cos C = 0 and it becomes c² = a² + b².

Worked example: two sides and the angle between them

Sides a = 5 and b = 7, with an angle C = 60° between them.

  1. c² = 25 + 49 − 2 × 5 × 7 × 0.5 = 39, so c = 6.245.
  2. cos A = (b² + c² − a²) ÷ (2bc) = 63 ÷ 87.43, so A = 43.90°.
  3. B = 180° − 60° − 43.90° = 76.10°.
  4. Area = ½ × 5 × 7 × sin 60° = 15.155; perimeter = 18.245.

Worked example: two angles and the side between them

Angles A = 40° and B = 60°, with side c = 10 between them.

  1. C = 180° − 40° − 60° = 80°.
  2. a = 10 × sin 40° ÷ sin 80° = 6.527.
  3. b = 10 × sin 60° ÷ sin 80° = 8.794.
  4. Area = ½ × a × b × sin C = 28.26.

Which method for which data

You know Name Method
Two sides and the angle between them SAS law of cosines, then angle sum
Two angles and the side between them ASA angle sum, then law of sines
Two angles and another side AAS angle sum, then law of sines
Three sides SSS law of cosines for each angle
Two sides and another angle SSA ambiguous: zero, one or two triangles

Where it is used

Surveyors measure a baseline and two angles to locate a distant point, a technique called triangulation. Carpenters and roofers use the law of cosines to find rafter lengths for non-right angles, and navigators use it to combine courses and distances. The calculator works with any unit of length, as long as all sides use the same one; angles are in degrees.

Checking the result

The largest angle is always opposite the longest side, and the angles must add up to 180°. If two angles you enter add up to 180° or more, the calculator flags that no triangle exists.

Frequently asked questions

When do I use the law of cosines?

When you know two sides and the angle between them (SAS), or all three sides. c² = a² + b² − 2ab cos C gives the third side; with a = 5, b = 7 and C = 60°, c = 6.245.

When do I use the law of sines?

When you know two angles and one side (ASA or AAS). a ÷ sin A = b ÷ sin B = c ÷ sin C, so each missing side is the known side times the ratio of sines.

Why can two angles not add up to 180° or more?

Because the three angles of a triangle always add up to exactly 180°. If two angles already reach 180°, there is no room for a third one.

What is the ambiguous case of the law of sines?

With two sides and an angle that is not between them (SSA), there can be zero, one or two triangles. That is why this calculator asks for the angle between the two sides.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.