Law of Sines and Law of Cosines: Solving Any Triangle With Worked Examples
October 29, 2026
Right-triangle trigonometry handles only triangles with a 90° angle. For any triangle, two laws relate sides and angles. The law of sines says a ÷ sin A = b ÷ sin B = c ÷ sin C, where each side is opposite its angle. The law of cosines says c² = a² + b² − 2ab cos C, which generalizes the Pythagorean theorem (for C = 90°, cos C = 0).
Use the law of cosines when you know two sides and the included angle (SAS) or all three sides (SSS). Use the law of sines when you know two angles and a side (AAS or ASA) or two sides and a non-included angle (SSA, with caution).
Skip the math and get your answer instantly:
Open the Scientific Calculator →Example 1: Law of Cosines (SAS)
Two survey stakes are 7 meters and 9 meters from a point, and the angle between the lines is 50°. How far apart are the stakes? c² = 7² + 9² − 2 × 7 × 9 × cos 50° = 49 + 81 − 126 × 0.6428 = 130 − 80.99 = 49.01. So c = 7.0 meters. Then use the law of sines to find the other angles: sin A = 7 × sin 50° ÷ 7.0 = 0.766, so A = 50.0°, and B = 180° − 50° − 50° = 80.0°. The triangle happens to be isosceles with two 50° angles.
Always compute the longest side or largest angle with care: the law of cosines resolves ambiguity because cosine is unique for angles from 0 to 180 degrees.
| Known | Use | Formula |
|---|---|---|
| Two sides and included angle (SAS) | Law of cosines | c² = a² + b² − 2ab cos C |
| Three sides (SSS) | Law of cosines | cos C = (a² + b² − c²) ÷ 2ab |
| Two angles and any side (AAS, ASA) | Law of sines | a ÷ sin A = b ÷ sin B |
| Two sides and a non-included angle (SSA) | Law of sines (check ambiguity) | sin B = b sin A ÷ a |
Example 2: Law of Sines (AAS)
A triangle has angle A = 40°, angle B = 65°, and side a = 12 (opposite A). First, C = 180° − 40° − 65° = 75°. Then b = a × sin B ÷ sin A = 12 × sin 65° ÷ sin 40° = 12 × 0.9063 ÷ 0.6428 = 16.92. And c = 12 × sin 75° ÷ sin 40° = 18.03. The side opposite the largest angle (75°) is the longest side (18.03), as expected.
The Ambiguous Case
When you know two sides and an angle that is not between them (SSA), there can be zero, one, or two triangles. Suppose a = 10, b = 14, and A = 30°. Then sin B = b sin A ÷ a = 14 × 0.5 ÷ 10 = 0.7, so B = 44.4° or B = 135.6°. Both give valid triangles: with B = 44.4°, C = 105.6° and c = 19.3; with B = 135.6°, C = 14.4° and c = 5.0. If the computed sine exceeds 1, there is no triangle. Draw a sketch to see which cases apply.
Applications
Surveying and navigation use these laws to find distances that cannot be measured directly, such as the width of a river or the distance to a ship from two bearings. Engineers use them to resolve forces: two forces of 7 and 9 newtons at 50° to each other have a resultant given by the law of cosines (with the angle supplement). Roof framing, truss design, and astronomy also rely on them. With a calculator, check the mode (degrees or radians) before computing.
Frequently Asked Questions
When do I use the law of cosines?
When you know two sides and the included angle, or all three sides.
When do I use the law of sines?
When you know two angles and a side, or two sides and a non-included angle.
What is the ambiguous case?
SSA information can describe zero, one, or two different triangles.
How is the law of cosines related to the Pythagorean theorem?
It reduces to it when the included angle is 90°.
Do the angles of a triangle always sum to 180°?
Yes, in flat (Euclidean) geometry.