Triangle Calculator (Law of Sines and Cosines)

  • Free
  • No sign-up
  • Works on phones
  • Shows the working
Algebra & Trig#33

Triangle Solver (Law of Sines & Cosines)

Enter any three of the six parts (at least one side) and leave the rest blank. Handles SSS, SAS, ASA, AAS and the ambiguous SSA case.

This triangle calculator solves any triangle from three known parts. Enter at least one side plus any two other sides or angles, leave the rest blank, and it finds the missing sides and angles, the area and the perimeter. It works as a law of sines calculator and a law of cosines calculator, choosing the right law for SSS, SAS, ASA, AAS and SSA inputs.

In the ambiguous SSA case it shows both possible triangles, or tells you that no triangle exists. It’s free and needs no sign-up.

Triangle Calculator (Law of Sines and Cosines): The law of sines and law of cosines link the sides a, b, c of any triangle…
The law of sines and law of cosines link the sides a, b, c of any triangle to the opposite angles A, B, C, so three known parts give the rest.

How to use the triangle calculator

  1. Label your triangle so that side a is opposite angle A, side b opposite angle B, and side c opposite angle C.
  2. Enter the three parts you know. Angles are in degrees. Leave the unknown boxes empty.
  3. Press Solve triangle.
  4. Read the table of sides and angles, then the area and perimeter. The note under the table tells you which case and law were used.

Formulas

Law of sines (use it when you know a side and its opposite angle):

$$\frac{a}{\sin A} = \frac{b}{\sin B} = \frac{c}{\sin C}$$

Law of cosines (use it for SSS and SAS):

$$c^2 = a^2 + b^2 - 2ab\cos C$$

The angles always add up to \( 180^\circ \), and the area is \( \tfrac12 ab\sin C \).

You knowCaseMethod
Three sidesSSSLaw of cosines for each angle
Two sides and the angle betweenSASLaw of cosines, then the angles
Two angles and a sideASA / AASAngle sum, then law of sines
Two sides and a non-included angleSSALaw of sines; 0, 1 or 2 triangles

Worked example: SAS

Sides \( a = 7 \), \( b = 9 \) and the included angle \( C = 60^\circ \), as loaded above.

A bronze statue of a man using a compass for geometry.

Third side. \( c^2 = 49 + 81 - 2(7)(9)\cos 60^\circ = 130 - 63 = 67 \), so \( c = \sqrt{67} \approx 8.185 \).

Angles. \( \cos A = \frac{b^2 + c^2 - a^2}{2bc} = \frac{81 + 67 - 49}{2(9)(8.185)} \approx 0.672 \), so \( A \approx 47.78^\circ \). Then \( B = 180^\circ - 60^\circ - 47.78^\circ \approx 72.22^\circ \).

Area. \( \tfrac12(7)(9)\sin 60^\circ \approx 27.28 \).

Worked example: ASA

\( A = 30^\circ \), \( B = 45^\circ \), \( a = 10 \). First \( C = 180^\circ - 30^\circ - 45^\circ = 105^\circ \). Then the law of sines gives

A compass on a map, suggesting navigation and direction.

$$b = \frac{10\sin 45^\circ}{\sin 30^\circ} = 10\sqrt2 \approx 14.142, \qquad c = \frac{10\sin 105^\circ}{\sin 30^\circ} \approx 19.319$$

Worked example: the ambiguous case

\( a = 6 \), \( b = 8 \), \( A = 30^\circ \). The law of sines gives \( \sin B = \frac{8\sin 30^\circ}{6} = \frac23 \). Two angles have that sine: \( B \approx 41.81^\circ \) and \( B \approx 138.19^\circ \). Both leave room for a positive angle C, so two triangles fit:

  • Triangle 1: \( B \approx 41.81^\circ \), \( C \approx 108.19^\circ \), \( c \approx 11.400 \).
  • Triangle 2: \( B \approx 138.19^\circ \), \( C \approx 11.81^\circ \), \( c \approx 2.456 \).

If instead \( a = 2 \), \( b = 8 \), \( A = 60^\circ \), then \( \sin B \approx 3.46 > 1 \), and no triangle exists.

Tips and common mistakes

  • Mislabeling. Each side’s letter must match the angle opposite it.
  • Calculator in radians. Angles here are degrees. If you compute by hand, set your calculator to degrees too.
  • Missing the second SSA triangle. \( \arcsin \) only returns the acute angle; check whether \( 180^\circ \) minus it also works.
  • Rounding early. Keep full precision for the third side before computing angles from it.

Area of any triangle

When you know two sides and the angle between them:

$$A = \frac{1}{2}ab\sin C$$

With \( a = 8 \), \( b = 11 \) and \( C = 40° \): \( A = \frac{1}{2} \times 8 \times 11 \times \sin 40° \approx 28.28 \). When you know all three sides, use Heron’s formula (see the area calculator).

Worked example: distance across a river

Two surveyors stand 100 m apart on one bank. Each measures the angle to a tree on the far bank: 50° and 60°. The third angle is \( 180° - 50° - 60° = 70° \). By the law of sines, the distance from the first surveyor to the tree is

$$\frac{100 \sin 60°}{\sin 70°} \approx 92.16 \text{ m}$$

This is how distances were measured long before lasers.

Choosing the right law

You knowUse
Two angles and any side (AAS, ASA)Law of sines
Two sides and the angle between them (SAS)Law of cosines for the third side
Three sides (SSS)Law of cosines for an angle
Two sides and an angle not between them (SSA)Law of sines; check the ambiguous case

Facts every triangle obeys

  • The angles add up to 180°.
  • The longest side is opposite the largest angle.
  • Any two sides together are longer than the third (triangle inequality): sides 3, 4 and 8 cannot form a triangle.
  • An exterior angle equals the sum of the two opposite interior angles.

Common mistakes

  • Using the law of sines with two sides and the included angle (SAS): it needs the law of cosines first.
  • Missing the second solution in the ambiguous SSA case.
  • Calculator in radian mode when angles are in degrees.
  • Rounding intermediate results too early, which can push the angle sum away from 180°.

Worked example: SSS

Sides 7, 8 and 9. The largest angle is opposite the 9: \( \cos C = \frac{49 + 64 - 81}{2 \cdot 7 \cdot 8} = \frac{32}{112} \approx 0.2857 \), so \( C \approx 73.40° \).

Practice problems

  1. Sides 7 and 9 with a 60° angle between them: find the third side.
  2. Angles 35° and 85° with the side between them 12: find the third angle.
  3. Can sides 5, 6 and 12 form a triangle?

Answers: 1. \( \sqrt{49 + 81 - 2 \cdot 7 \cdot 9 \cdot 0.5} = \sqrt{67} \approx 8.19 \). 2. 60°. 3. No: \( 5 + 6 < 12 \).

Verifying Calculator Results

After using the triangle calculator, it is wise to quickly check the results. First, confirm the sum of the three angles is exactly 180 degrees. Any slight deviation suggests a rounding error or an input mistake.

Next, compare the sides and their opposite angles. The longest side must always be opposite the largest angle. Similarly, the shortest side will be opposite the smallest angle.

Finally, apply the triangle inequality. The sum of any two sides must be greater than the third side. For instance, if sides are a, b, and c, then a + b > c, a + c > b, and b + c > a must all be true. These checks help ensure the triangle is valid.

Practical Tips for Using a Triangle Calculator

Always double-check your input values before pressing solve. A common error is mixing up angle and side measurements, or entering values into the wrong boxes.

When dealing with angles, ensure your calculator is set to degrees, not radians. Most triangle problems use degrees. Radians will produce incorrect results.

If you are using the triangle calculator for a real-world problem, draw a sketch first. This helps you correctly label sides and angles. It also provides a visual estimate of what the answers should be.

Detailed Example: Verifying an ASA Solution

Consider a triangle with angle A = 30 degrees, angle B = 45 degrees, and side a = 10. The triangle calculator will first find angle C.

Angle C = 180 – 30 – 45 = 105 degrees. Next, it calculates side b and side c using the Law of Sines.

Side b = (a * sin B) / sin A = (10 * sin 45) / sin 30 = 14.142. Side c = (a * sin C) / sin A = (10 * sin 105) / sin 30 = 19.319.

To verify, sum the angles: 30 + 45 + 105 = 180 degrees. This confirms the angle sum. Next, check the largest angle (105 degrees) is opposite the longest side (19.319). The smallest angle (30 degrees) is opposite the shortest side (10).

Finally, apply the triangle inequality: 10 + 14.142 > 19.319 (24.142 > 19.319, true). Also, 10 + 19.319 > 14.142 (29.319 > 14.142, true). And 14.142 + 19.319 > 10 (33.461 > 10, true). All checks pass.

Related guides

Further reading

FAQ

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

Use the law of sines when you know a side and its opposite angle (ASA, AAS, SSA). Use the law of cosines when you know three sides (SSS) or two sides and the angle between them (SAS).

Why can SSA give two triangles?

Because two angles between \( 0^\circ \) and \( 180^\circ \) share each sine value. If both choices leave a positive third angle, both triangles are valid.

How is the area calculated?

With \( \tfrac12 ab\sin C \), using any two sides and the angle between them.

Does it work for right triangles?

Yes. Enter a \( 90^\circ \) angle or three sides like 3, 4, 5. For quick right-triangle shortcuts see special right triangles.

Embed this calculator on your website

Teachers, tutors and bloggers are welcome to use this calculator for free. Copy the code below and paste it into any page (in WordPress, use a "Custom HTML" block). The small script makes the calculator grow to fit its answer; if your site removes scripts, it still works at a fixed height. Please keep the credit link.

More calculators

See all calculators