Triangles: The Law of Sines, the Law of Cosines & Practical Trigonometry
Geometry & Trigonometry
Chapter 3 · Triangles: The Law of Sines, the Law of Cosines & Practical Trigonometry
Chapter 2 built the unit circle's vocabulary. This chapter puts it to work solving triangles from partial information — the real technique behind surveying, GPS-style triangulation, and any code that needs to turn a couple of measured angles and distances into a full picture of where something is.
The Law of Sines
For any triangle with sides a, b, c opposite angles A, B, C respectively: a/sin(A) = b/sin(B) = c/sin(C). Given one full side-angle pair and one more piece of information, every other side and angle can be recovered.
The Law of Cosines
A generalization of the Pythagorean theorem to any triangle, not just right triangles: c² = a² + b² − 2ab·cos(C). When C=90°, cos(C)=0 and this collapses back to the familiar c²=a²+b².
A Worked Triangulation Example
A surveyor wants the distance to a distant tower T, without being able to measure it directly. They walk a known baseline AB=100m, and measure the angle to the tower from each end: 60° at A, 70° at B.
C = 180° − 60° − 70° = 50°. Applying the Law of Sines, AT = AB·sin(B)/sin(T) = 100·sin(70°)/sin(50°) ≈ 122.67m, and BT = AB·sin(A)/sin(T) = 100·sin(60°)/sin(50°) ≈ 113.05m — the tower's distance from each end of the baseline, computed without ever measuring it directly.
AB = √(AT² + BT² − 2·AT·BT·cos(T)), recovers 100.00000000000001 — the original baseline, to floating-point precision. The two laws aren't independent facts to memorize separately; they're two consistent views of the same triangle, and cross-checking one against the other is a genuinely useful way to catch a measurement or calculation error before trusting the result.
Practical Trigonometry: The SSA "Ambiguous Case"
Not every combination of known sides and angles determines a triangle uniquely. Given two sides and a non-included angle (Side-Side-Angle, where the angle isn't between the two given sides), the Law of Sines can produce zero, one, or two valid triangles from the exact same input — a real, well-known source of bugs in code that assumes a single formula always gives "the" answer.
b=10 and angle A=40°, varying only side a:
Given side a | b·sin(A)/a | Verified outcome |
|---|---|---|
a=3 | 2.14 (>1) | No valid triangle — the required sin(B) would exceed 1, an impossible value |
a=7 | 0.918 | Two valid triangles: B≈66.67° (giving side c≈10.43) or B≈113.33° (giving side c≈4.89) — both satisfy the same given a, b, and A |
a=15 | 0.428 | Exactly one valid triangle: the second candidate angle would push the angle sum past 180°, so only B≈25.37° is geometrically possible |
B = asin(b*sin(A)/a) and stops there silently picks only one of the two mathematically valid answers whenever two exist (per the a=7 row above), and crashes on a domain error whenever none exist (per the a=3 row) without necessarily explaining why. A triangulation or navigation system relying on SSA-style measurements needs to explicitly check b·sin(A)/a against 1 first, and consider both asin(x) and π−asin(x) as candidates whenever a solution exists — exactly what the verified table above does.
Where This Connects
| This chapter's finding | What it sets up |
|---|---|
| The Law of Sines/Cosines cross-check recovering the exact baseline | The same consistency-checking instinct Chapter 9 applies to intersection tests — verify a geometric result against an independent second computation |
The SSA ambiguous case's asin/π−asin branch choice | Directly foreshadows Chapter 6's gimbal lock, where a similar loss of uniqueness (many different angle combinations producing the same orientation) causes real problems |
| Solving a triangle from partial angle/distance measurements | The same underlying technique used by Chapter 9's own ray-based intersection tests |
Hands-On Exercises
Using this chapter's own Law of Sines formula, a surveyor measures a baseline of 200m and angles of 50° and 65° at each end toward a landmark. Compute the distance from each end of the baseline to the landmark.
Using this chapter's own verified SSA table, explain in your own words why a=3 (with b=10, A=40°) produces no valid triangle at all, connecting your answer to what the value b·sin(A) geometrically represents.
A GPS-style positioning system uses SSA-style triangulation (two known distances and one measured angle) to compute a device's position, and always takes the first (asin) solution without checking for a second one. Using this chapter's own a=7 verified example, explain what could go wrong with this design, and under what circumstances the bug would actually manifest.
Chapter 3 Quick Reference
- Law of Sines:
a/sin(A) = b/sin(B) = c/sin(C) - Law of Cosines:
c² = a²+b²-2ab·cos(C)— generalizes the Pythagorean theorem to any triangle - Verified: a baseline-and-two-angles triangulation (surveying a tower) solved via the Law of Sines, then independently cross-checked via the Law of Cosines, recovering the original baseline to floating-point precision
- SSA "ambiguous case": given two sides and a non-included angle, verified all three real outcomes — zero valid triangles (
b·sin(A)/a > 1), two valid triangles (an "ambiguous" middle range), or exactly one - Code solving SSA-style problems must check
b·sin(A)/aagainst1first, and consider bothasin(x)andπ−asin(x)as candidate answers - Next chapter: Vectors and dot/cross products in geometric context — reusing Linear Algebra Fundamentals' own material, now applied to angles, projections, and surface normals