Law of Sines and Law of Cosines: Formulas and Examples
Solver AI TeamPublished Updated 13 min read
Master the Law of Sines and Law of Cosines. Learn when to use each, the ambiguous SSA case, and how to solve any triangle — not just right triangles — step by step.
Frequently asked questions
When do you use the Law of Sines versus the Law of Cosines?
Use the Law of Sines when you know a side and its opposite angle (AAS, ASA, or SSA). Use the Law of Cosines when you know two sides and the angle between them (SAS) or all three sides (SSS). The Law of Cosines is the one to start with in those cases.
What is the Law of Cosines formula?
The Law of Cosines states c² = a² + b² − 2ab·cos C, where C is the angle opposite side c. It works for any triangle. When C = 90°, cos C = 0 and the formula becomes the Pythagorean theorem.
What is the ambiguous case (SSA) of the Law of Sines?
With two sides and a non-included angle, the data can fit no triangle, one triangle, or two triangles. Solving sin B gives an acute angle B, but 180° − B may also work. Check whether the second angle fits with the given angle in a total under 180°.
Can the Law of Cosines find an angle?
Yes. Rearrange it to cos C = (a² + b² − c²) / (2ab), then take the inverse cosine. This is how you find angles when all three sides are known. Because cosine is one-to-one on 0° to 180°, there is no ambiguity.
Why does the Law of Sines sometimes give two answers but the Law of Cosines never does?
Sine is positive in both the first and second quadrants, so an angle and its supplement have the same sine. Cosine has a different value for each angle between 0° and 180°, so the Law of Cosines gives exactly one answer.
Basic right-triangle trigonometry (SOH CAH TOA) only works when one angle is exactly 90°. But most triangles in the real world — in surveying, navigation, engineering, and physics — are oblique, meaning they have no right angle. To solve these, we need two more powerful tools: the Law of Sines and the Law of Cosines.
Together, they let you find unknown sides or angles in any triangle as long as you know enough information to determine it.
The five classic cases
Case
What you know
Which law
ASA
two angles and the included side
Law of Sines
AAS
two angles and a non-included side
Law of Sines
SSA
two sides and a non-included angle — the ambiguous case
Law of Sines
SAS
two sides and the included angle
Law of Cosines
SSS
three sides
Law of Cosines
A single problem often requires both — use one to find a first unknown, then the other to find the rest.
Definition — Standard Triangle Labeling
In triangle ABC, side a is opposite angle A, side b is opposite angle B, and side c is opposite angle C. The three angles always sum to 180°.
The Law of Sines
The Rule — Law of Sines
In any triangle, the ratio of the sine of each angle to the length of its opposite side is constant: sin(A)/a = sin(B)/b = sin(C)/c. Equivalently: a/sin(A) = b/sin(B) = c/sin(C).
Use this whenever you have a complete angle-side pair (one angle and its opposite side) plus one more piece of information.
Example — AAS case
In triangle ABC, A = 35°, B = 70°, a = 10. Find b and c.
First find C = 180° − 35° − 70° = 75°.
Now apply the Law of Sines: b = a · sin(B)/sin(A) = 10 · sin(70°)/sin(35°) ≈ 10 · 0.9397/0.5736 ≈ 16.38.
c = a · sin(C)/sin(A) = 10 · sin(75°)/sin(35°) ≈ 10 · 0.9659/0.5736 ≈ 16.84.
Answerb ≈ 16.38, c ≈ 16.84
Example — ASA case
A = 40°, B = 60°, c = 20.
C = 180° − 40° − 60° = 80°.
a = c · sin(A)/sin(C) = 20 · sin(40°)/sin(80°) ≈ 20 · 0.6428/0.9848 ≈ 13.06.
b = c · sin(B)/sin(C) = 20 · sin(60°)/sin(80°) ≈ 20 · 0.8660/0.9848 ≈ 17.59.
Answera ≈ 13.06, b ≈ 17.59
The Law of Sines is efficient for ASA and AAS, but SSA is trickier — see the next section.
The Ambiguous Case (SSA)
When you know two sides and a non-included angle (SSA), the Law of Sines can give zero, one, or two valid triangles. This is the ambiguous case, and it trips up many students.
Suppose you know a, b, and A, and want to find B. Apply sin(B) = b · sin(A)/a.
Three scenarios
Case
Condition
Result
Why
1
sin(B) > 1
No triangle
The given sides can't form a triangle with that angle.
2
sin(B) = 1, or a ≥ b
One triangle
Exactly one triangle (right triangle at B). Also one triangle if the side opposite the given angle is at least as long as the other given side.
3
sin(B) < 1 and a < b and A is acute
Two triangles
There are two possible values of B (one acute, one obtuse, since sin(180° − B) = sin(B)).
Example — SSA with two solutions
a = 7, b = 10, A = 30°.
sin(B) = 10 · sin(30°)/7 = 10 · 0.5/7 ≈ 0.7143.
So B ≈ 45.58° OR B ≈ 180° − 45.58° = 134.42°.
Check both: for B₁ = 45.58°: C = 180° − 30° − 45.58° = 104.42°, valid.
For B₂ = 134.42°: C = 180° − 30° − 134.42° = 15.58°, also valid.
AnswerBoth triangles exist
The Key Insight
This is why SSA is called 'the ambiguous case' — you must check whether both solutions are geometrically valid.
The Law of Cosines
The Rule — Law of Cosines
The Law of Cosines generalizes the Pythagorean theorem to any triangle. For any triangle with sides a, b, c and opposite angles A, B, C: a² = b² + c² − 2bc · cos(A), b² = a² + c² − 2ac · cos(B), c² = a² + b² − 2ab · cos(C).
The Key Insight
Notice that if A = 90°, cos(A) = 0 and the formula collapses to the Pythagorean theorem.
Use the Law of Cosines for SAS (given two sides and the included angle) to find the third side, or for SSS (given three sides) to find any angle.
C = 180° − 36.87° − 53.13° = 90°. (This is a 6-8-10 right triangle, a scaled 3-4-5.)
AnswerA ≈ 36.87°, B ≈ 53.13°, C = 90°
The Takeaway
The Law of Cosines never has an ambiguous case — it always gives a unique answer.
When to Use Which Law
Choosing between the two laws is based on what you're given:
The Rule — Law of Sines
Use when you have a complete angle-side pair (an angle and its opposite side). Works for AAS, ASA, and SSA (with care for the ambiguous case).
Corollary — Law of Cosines
Use when you don't have a complete angle-side pair. Works for SAS and SSS.
Quick decision table
Given
Start with
AAS
Law of Sines
ASA
Find third angle, then Law of Sines
SSA
Law of Sines (check ambiguous case)
SAS
Law of Cosines (find third side)
SSS
Law of Cosines (find any angle)
Common Mistake
Notice that AAA (only angles given) has no unique triangle — you need at least one side length to determine size.
Workflow tip
After using one law to find a first unknown, you usually have a complete angle-side pair, and can switch to Law of Sines for the rest (which is less computation than another Law of Cosines application).
Common Mistake
When solving for angles with Law of Cosines, always solve for the largest angle first (opposite the longest side) — this tells you immediately whether the triangle is acute or obtuse, and removes SSA-style ambiguity later.
Real-World Applications and Worked Example
The Laws of Sines and Cosines appear anywhere triangles do:
Field
How the laws are used
Surveying
Measuring distances across rivers or ravines where you can't reach both endpoints directly.
Navigation
Calculating course corrections when winds or currents push you off the direct path.
Astronomy
Parallax calculations rely on the Law of Sines to compute stellar distances from Earth's orbit geometry.
Engineering
Force-vector decomposition, truss analysis, and robotics all use oblique triangle math.
Worked example — surveyor's problem
A surveyor wants to measure the distance across a lake from point A to point B, but can't walk across. She picks point C on dry land, measures AC = 450 m, BC = 520 m, and angle ACB = 78°. Find AB.
This is SAS. Using Law of Cosines with C = 78° and opposite side c = AB: c² = 450² + 520² − 2 · 450 · 520 · cos(78°).
If you want to verify any triangle computation, scan the problem with Solver AI — it identifies the case, picks the correct law, and shows all the computation steps.