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.

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.

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

$$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.

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