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.
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.
Show steps
- 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.
- c² = a² + b² − 2ab·cos C = 5² + 7² − 2 × 5 × 7 × cos(60°) = 39, so c = 6.24.
- 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°.
- Angles add to 180°: B = 180° − 60° − 43.9° = 76.1°.
- Area = ½ab·sin C = ½ × 5 × 7 × sin(60°) = 15.16 square units. Perimeter = a + b + c = 18.24.
- 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.
How to use the law of sines and cosines calculator
- 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).
- 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.
- 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.
- 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.
With SSS there is no side paired with its opposite angle, so the law of sines cannot start. The law of cosines can.
c² = 8² + 11² − 2·8·11·cos 50° ≈ 71.87, so c ≈ 8.48. Forgetting the square root leaves 71.87.
Law of sines: b = a·sin B/sin A = 10 × sin 70°/sin 40° ≈ 14.6. Flipping the ratio gives 6.8.
h = b·sin A = 10 × sin 30° = 5. Since 5 < 7 < 10, side a can meet the base in two places.
h = 10 × sin 30° = 5, and a = 4 is shorter than h, so side a cannot reach the base.
Area = ½ab·sin C = ½ × 6 × 9 × sin 30° = 13.5. Forgetting the ½ gives 27.
The largest angle is across from 9: cos C = (49 + 64 − 81)/(2·7·8) = 2/7, so C ≈ 73.4°.
cos 90° = 0, so the −2ab·cos C term disappears and you get the Pythagorean theorem.
Three angles fix the shape but not the size, so infinitely many similar triangles fit.
The second angle with the same sine is 180° − 58.99° = 121.01°, and 40° + 121.01° is still less than 180°.
Quiz complete
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
- Triangle calculator
- Heron's formula calculator
- Pythagorean theorem calculator
- Inverse trig calculator
- Trigonometry calculator
More geometry & trig calculators
Related to This Article
More math articles
- Ring Size Calculator: Finger Circumference to US and EU Size
- Roman Numeral Converter
- SAT Math Score Plateau: Diagnose Errors and Improve Practice
- 3rd Grade PARCC Math Practice Test Questions
- Administrative Discretion and Rulemaking: Limits and Examples
- Acceleration Calculator
- Area and Perimeter
- The Butterfly Effect in Mathematics: Small Changes, Big Impact
- Decoding the Dynamics: How to Understanding Input/Output Tables
- Congressional elections








What people say about "Law of Sines and Cosines Calculator: Solve Any Triangle"?
No one replied yet.