Law of Sines and Cosines Calculator (Free Step-by-Step Triangle Solver)

Geometry & trigFreeNo sign-up

A law of sines and cosines calculator solves any triangle once you know three parts, including at least one side. With sides 5 and 7 and a 60° angle between them, the law of cosines gives c² = 25 + 49 − 70·cos 60° = 39. So c ≈ 6.24, the law of sines gives A ≈ 43.9° and B ≈ 76.1°, and the area is about 15.16.

Law of sines and cosines calculator: what do you know?
The angle must be the one between the two sides. Rename your triangle so the known sides are a and b and the angle between them is C.
Try:
SAS: law of cosines, then law of sines
c = 6.24A = 43.9°, B = 76.1°

The law of cosines gives c² = 39, so c = 6.24. Then A = 43.9° and B = 76.1° (rounded). The area is 15.16.

Side a5
Side b7
Side c6.24
Angle A43.9°
Angle B76.1°
Angle C60°
Area15.16
Perimeter18.24
Triangle typeacute scalene
Circumradius R3.61
Inradius r1.66
ACb = 7Ba = 5c = 6.2443.9°76.1°60°
Show steps
  1. Choose the law: you know sides a and b and the angle C between them, but no side together with its opposite angle. Use the law of cosines to find side c first.
  2. c² = a² + b² − 2ab·cos C = 5² + 7² − 2 × 5 × 7 × cos(60°) = 39, so c = 6.24.
  3. Now c and C are a pair, so use the law of sines for the angle across from the shorter side a (it cannot be obtuse): sin A = a·sin C/c = 5 × sin(60°)/6.24 = 0.6934, so A = 43.9°.
  4. Angles add to 180°: B = 180° − 60° − 43.9° = 76.1°.
  5. Area = ½ab·sin C = ½ × 5 × 7 × sin(60°) = 15.16 square units. Perimeter = a + b + c = 18.24.
  6. Circumradius R = c/(2 sin C) = 3.61; inradius r = Area/s = 1.66. This is a acute scalene triangle.

Using the angle across from the shorter side avoids the arcsin trap: arcsin never returns an obtuse angle.

Law of Sines and Cosines Calculator (Free Step-by-Step Triangle Solver)
Embed this calculator on your site

Free to use on class pages, blogs and course pages. Copy the code below and paste it into your page:

How to use the law of sines and cosines calculator

  1. Pick the case that matches what you know: SSS (three sides), SAS (two sides and the angle between them), ASA (two angles and the side between them), AAS (two angles and another side) or SSA (two sides and an angle that is not between them).
  2. Enter the three values. Lengths can be whole numbers, decimals or fractions. Angles are in degrees unless you switch to radians, where π/3 also works.
  3. Press Solve triangle or just keep typing. You get every side and angle, the area, perimeter, triangle type, circumradius and inradius, plus a scaled diagram.
  4. Open Show steps to see which law was used, why, and every substitution.

When do you use the law of sines vs. the law of cosines?

The deciding question is simple: do you know a side and the angle across from it? If yes, the law of sines can start. If no, start with the law of cosines.

You know Start with Then
SSS: three sides Law of cosines (largest angle first) Law of sines, then angle sum
SAS: two sides, included angle Law of cosines for the third side Law of sines, then angle sum
ASA: two angles, included side Angle sum for the third angle Law of sines for both sides
AAS: two angles, another side Angle sum for the third angle Law of sines for both sides
SSA: two sides, non-included angle Law of sines Check for 0, 1 or 2 triangles

Three angles alone (AAA) cannot be solved: similar triangles of every size share the same angles.

Law of sines

In any triangle, each side divided by the sine of its opposite angle gives the same number:

a/sin A = b/sin B = c/sin C

That common value equals 2R, the diameter of the circle through the three vertices. Use the law of sines when you know one side-angle pair and one more part.

Law of cosines

c² = a² + b² − 2ab·cos C, and in the same way a² = b² + c² − 2bc·cos A and b² = a² + c² − 2ac·cos B. Solved for the angle: cos C = (a² + b² − c²)/(2ab). Use it when you know all three sides, or two sides and the angle between them.

The ambiguous case (SSA)

When you know sides a and b and angle A, side a can swing like a gate hinged at C. Compare a with the height h = b·sin A:

  • A acute, a < h: a cannot reach the base. No triangle.
  • A acute, a = h: a touches the base once. One right triangle.
  • A acute, h < a < b: a meets the base in two places. Two triangles, with B and 180° − B.
  • A acute, a ≥ b: one triangle.
  • A right or obtuse: one triangle if a > b, otherwise none.

The calculator runs this test for you, draws the swing of side a and solves both triangles when two exist.

Worked examples

Example 1: SAS with the law of cosines

a = 5, b = 7, C = 60°. Then c² = 5² + 7² − 2 × 5 × 7 × cos 60° = 74 − 35 = 39, so c = √39 ≈ 6.24. Next use the law of sines for the angle across from the shorter side: sin A = 5 × sin 60°/√39 ≈ 0.6934, so A ≈ 43.9°. Finally B = 180° − 60° − 43.9° ≈ 76.1°. Area = ½ × 5 × 7 × sin 60° ≈ 15.16.

Example 2: SSA with two triangles

a = 6, b = 8, A = 40°. The height is h = 8 × sin 40° ≈ 5.14. Since 5.14 < 6 < 8, two triangles fit. sin B = 8 × sin 40°/6 ≈ 0.8571, so B ≈ 58.99° or B ≈ 121.01°. The first gives C ≈ 81.01° and c ≈ 9.22; the second gives C ≈ 18.99° and c ≈ 3.04.

Example 3: SSS with Heron’s formula

Sides 5, 6 and 7. Start with the largest angle, across from 7: cos C = (25 + 36 − 49)/(2 × 5 × 6) = 0.2, so C ≈ 78.46°. The law of sines then gives A ≈ 44.42° and B ≈ 57.12°. With s = 9, the area is √(9 × 4 × 3 × 2) = √216 ≈ 14.70.

Area of a triangle from sides and angles

  • Two sides and the included angle: Area = ½ab·sin C.
  • Three sides (Heron’s formula): Area = √(s(s − a)(s − b)(s − c)), where s = (a + b + c)/2.
  • Circumradius R = a/(2 sin A) and inradius r = Area/s.

Common mistakes to avoid

  • Mismatched pairs. In the law of sines each side must sit over the sine of the angle across from it, not next to it.
  • Using arcsin for an angle that might be obtuse. arcsin only returns 0° to 90°. Find the largest angle with the law of cosines, or use the law of sines on the angle across from the shorter side.
  • Forgetting the second SSA triangle. Always test 180° − B.
  • Calculator in radian mode. cos 60 in radian mode is about −0.95, not 0.5.
  • Rounding too early. Keep full precision until the end, or the angles may not add to 180°.

Real-life uses

Surveyors find a distance across a river from two measured angles and a baseline (ASA). Navigators find the distance between two ships from their distances to a port and the angle between them (SAS). Engineers find the angles in a roof truss from its three member lengths (SSS).

Law of Sines and Cosines practice quiz: 10 questions

Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.

Question 1 of 10
1. You know all three sides of a triangle. Which law do you use first?

Found a mistake? Let us know!

2. In triangle ABC, a = 8, b = 11 and C = 50°. To the nearest hundredth, what is c?

Found a mistake? Let us know!

3. A = 40°, B = 70° and a = 10. What is b, to the nearest tenth?

Found a mistake? Let us know!

4. SSA: b = 10, A = 30° and a = 7. How many triangles are possible?

Found a mistake? Let us know!

5. SSA: b = 10, A = 30° and a = 4. How many triangles are possible?

Found a mistake? Let us know!

6. What is the area of a triangle with sides 6 and 9 and an included angle of 30°?

Found a mistake? Let us know!

7. A triangle has sides 7, 8 and 9. To the nearest degree, what is the largest angle?

Found a mistake? Let us know!

8. What does the law of cosines become when C = 90°?

Found a mistake? Let us know!

9. Which given information can NOT be solved for a unique triangle?

Found a mistake? Let us know!

10. In SSA with b = 8, A = 40° and a = 6, one triangle has B ≈ 58.99°. What is B in the other triangle?

Found a mistake? Let us know!

Frequently asked questions

When do you use the law of sines vs the law of cosines?

Use the law of cosines for SSS and SAS, where no side is known together with its opposite angle. Use the law of sines for ASA, AAS and SSA, where such a pair is known. With SSA, check the ambiguous case.

What is the law of sines and cosines used for?

They solve triangles that are not right triangles, in surveying, navigation, physics and engineering. A surveyor who measures two distances from one point and the angle between them uses the law of cosines to find the third distance.

How do you solve a triangle with the law of cosines?

Substitute into c² = a² + b² − 2ab·cos C. For a = 5, b = 7 and C = 60°, c² = 39 and c ≈ 6.24. Then find another angle (law of sines or cosines) and the last one from the angle sum, and check that the angles add to 180°.

How do you put the law of sines into a calculator?

Set degree mode and use parentheses. For a = 10, A = 30° and B = 45°, type b = 10 × sin(45) ÷ sin(30), which gives b ≈ 14.14.

What are the law of sines and law of cosines formulas?

Law of sines: a/sin A = b/sin B = c/sin C. Law of cosines: c² = a² + b² − 2ab·cos C. When C = 90°, cos C = 0 and the law of cosines becomes the Pythagorean theorem, c² = a² + b².

Related calculators

More geometry & trig calculators

Browse all 458 calculators

Related to This Article

What people say about "Law of Sines and Cosines Calculator: Solve Any Triangle"?

No one replied yet.

Leave a Reply