How to Use the Law of Sines and Law of Cosines

SOH CAH TOA only works when there's a right angle. Here's the intuition behind the two tools that solve every other triangle, plus the sneaky case where the same clues describe two different triangles.

By Petrus Sheya

July 30, 2026 · 6 min read

You're standing at the base of a mountain you can't climb. You measure two angles from two spots on flat ground, and somehow that's enough to know the mountain's height, exactly, without ever touching it.

How does that work?

If the mountain, the ground, and your line of sight formed a right triangle, you'd already know the answer. SOH CAH TOA. Done. But real triangles almost never hand you a right angle for free.

So we need tools that work on any triangle. That's the Law of Sines and the Law of Cosines. Two rules, one job each, and together they can solve any triangle from almost any three clues you're given.


Right triangles are the easy case

Sine and cosine, the way you first learned them, are ratios inside a right triangle. Opposite over hypotenuse. Adjacent over hypotenuse. That definition is airtight, but it only makes sense when one angle is exactly 90°.

Most triangles you'll actually run into, in surveying, in navigation, in a physics problem about two ropes pulling on a sign, don't have a right angle anywhere. You can't just drop SOH CAH TOA on them and expect an answer.

But here's the thing. Every triangle, no matter how lopsided, still has a relationship between its sides and its angles. We just need a version of that relationship that doesn't require a right angle to exist first.


Every triangle has a hidden circle

Start with a strange fact: draw any triangle, then draw the one circle that passes through all three of its corners. That circle always exists, and it's called the circumcircle.

Now take one side of the triangle and divide it by the sine of the angle across from it. Try it with a different side and its opposite angle. You'll get the same number.

...and that number is always exactly the diameter of the circumcircle.

Drag the top corner anywhere. The triangle changes shape completely, but a / sin A always equals the diameter of the circle through all three corners.

BCA2R
a / sin A6.37
b / sin B6.37
c / sin C6.37
Circle diameter (2R)6.37

Drag the top corner anywhere you want. The triangle can go tall, flat, lopsided, whatever. The circle resizes with it, and a / sin A tracks the circle's diameter the entire time. That's not a coincidence you need to trust, it's something you can watch happen.

We write this relationship as the Law of Sines:

asinA=bsinB=csinC=2R\frac{a}{\sin A} = \frac{b}{\sin B} = \frac{c}{\sin C} = 2R

where aa, bb, cc are the side lengths and AA, BB, CC are the angles opposite them, and RR is the circumcircle's radius. Know any angle and its opposite side, plus one more piece of information, and you can solve for everything else.


Wait, couldn't two different triangles fit the same clues?

Here's a trap. Say someone gives you an angle, the side opposite it, and one more side, but not the angle between them. That's called SSA, and it's the one setup where the Law of Sines can genuinely mislead you.

Picture it like a door. One side of the triangle is fixed in place. The angle is fixed. The third side, though, is a door hinged at one end, free to swing until it hits the base line. Depending on how long that door is, it might miss the base entirely, land on it once, or land on it twice.

Angle A and side b are fixed. Side a is a door hinged at C, swinging down to the base. Drag its length and watch how many times it can land on the base line.

bB1B2AC2 triangles
Critical height (b sin A)3.44
side b6.0
Valid triangles2

Slide the door's length down and it stops reaching the base at all. Zero triangles. Nudge it up and it just barely touches. One triangle. Push it further and it crosses the base at two different points, both perfectly valid. Two different triangles, same original clues. That's the ambiguous case, and it's the reason you always double check an SSA answer.


When you know two sides and the angle between them

Now flip the setup. This time you know two sides and the angle squeezed between them, SAS. There's no ambiguity here, exactly one triangle fits, but the Law of Sines can't help you yet because you don't have any angle paired with its opposite side.

You need a different tool. And it starts from something you already trust: the Pythagorean theorem.

If the angle between your two sides were 90°, you'd just write c2=a2+b2c^2 = a^2 + b^2 and be done. The problem is your angle usually isn't 90°. So the real formula keeps the Pythagorean part and bolts on a correction term that accounts for how far the angle actually is from a right angle:

c2=a2+b22abcosCc^2 = a^2 + b^2 - 2ab\cos C

Two sides are fixed. Sweep the angle between them and watch c² split away from the Pythagorean guess a² + b² by exactly -2ab cos C.

70°baca² + b²gap = -9.6
a² + b²29.6
-2ab cos C-9.6
20.0
c4.47

Watch the two bars. When the angle sits at 90°, cos C is zero, the correction term vanishes, and c² lands exactly on a² + b², the plain old Pythagorean theorem. Push the angle past 90° and the correction turns positive, stretching c² above the Pythagorean guess, because an obtuse angle pries the far side further apart. Pull the angle below 90° and it's the opposite: the correction goes negative and c² shrinks below a² + b².

The Law of Cosines isn't a new idea. It's the Pythagorean theorem with a built-in adjustment for angles that aren't 90°.

Quick example: if a=7a = 7, b=9b = 9, and the angle between them is 40°40°, then c2=49+81126cos(40°)33.5c^2 = 49 + 81 - 126\cos(40°) \approx 33.5, so c5.79c \approx 5.79.


Which law do you actually reach for?

You don't need to guess. What you're given tells you which tool fits:

  • Know two angles and any side? Law of Sines. The third angle is just 180°180° minus the other two.
  • Know two sides and the included angle (SAS)? Law of Cosines first, to get the third side, then Law of Sines for the rest.
  • Know all three sides (SSS)? Law of Cosines, solved backward for each angle.
  • Know two sides and a non-included angle (SSA)? Law of Sines, but check for the ambiguous case before you commit to an answer.

Solving any triangle, for real this time

Put both laws in the same hands and you can fully solve any triangle from almost any starting clues. Sides tell you angles. Angles tell you sides. And the two laws never disagree with each other, because they're describing the same triangle from two different directions.

Drag any corner to build any triangle you like. Both laws hold at once, every time, for every shape.

ABC
Sides a, b, c6.26, 6.05, 6.23
Angles A+B+C180.0°
Law of sines ratio7.14
Cosines check (should be ~0)0.000

Drag any corner into any shape you want. The sides and angles update instantly, the angles always sum to 180°, the Law of Sines ratio stays constant across all three sides, and the Law of Cosines check lands on zero every single time. Two laws, one triangle, no exceptions.


The short version

SOH CAH TOA only works inside a right triangle. For everything else, you need the Law of Sines, which ties each side to the sine of its opposite angle through the triangle's circumcircle, and the Law of Cosines, which is the Pythagorean theorem with a correction term for angles that aren't 90°. Watch out for SSA, the one setup where the same clues can describe two valid triangles instead of one. Pick the law that matches what you're given, and any triangle, no matter how oddly shaped, comes apart in a few algebra steps.

All visualizations are interactive React components running entirely in your browser, built with plain SVG. No libraries beyond React.