NapkinCalc

Trigonometry B — Waves & the Triangle Laws

Any triangle: the law of cosines

continues from lesson 1 — values defined earlier in the course stay live here

ELI5: the law of cosines is Pythagoras with a correction for when the angle isn't 90°. Two sides and the angle between them give the third: c² = a² + b² − 2ab·cos(γ). (When γ = 90°, cos γ = 0 and it collapses back to a² + b².)

sidep=7side_{p} = 7 first side
sideq=5side_{q} = 5 second side
γ:=49deg\gamma := 49 deg = 49 deg the angle between them
sider=sidep2+sideq22sidepsideqcos(γ)side_{r} = \sqrt{side_{p}^{2} + side_{q}^{2} - 2 \cdot side_{p} \cdot side_{q} \cdot \mathrm{cos}\left(\gamma\right)} = 5.29875.2987 the side opposite γ

triangle(side_p, side_q, side_r)

5.2997585.59°A45.41°B49°C

the triangle, drawn to scale

Real-world hook: the law of cosines finds the straight-line distance across a bent path — a plane's two-leg flight, the gap between two runners who set off at an angle, the diagonal of a non-rectangular plot of land.

Try it yourself: a triangle has sides 8 and 6 with a 60° angle between them. How long is the third side?

ryou:=sqrt(82+62286cos(60deg))r_{you} := sqrt(8^2 + 6^2 - 2*8*6*cos(60 deg)) = 7.21117.2111 ✏️ Your turn: find the third side via the law of cosines. The check verifies r² = 8² + 6² − 2·8·6·cos 60° — without revealing r.
✓ pass abs(ryou2(82+62286cos(60deg)))<1e6abs(r_{you}^2 - (8^2 + 6^2 - 2*8*6*cos(60 deg))) < 1e-6 green when your side satisfies the law of cosines