| 1 |
-------------- |
| 2 |
Law of cosines |
| 3 |
-------------- |
| 4 |
|
| 5 |
For any triangle with sides a, b, c opposite angles A, B, C (angles measured |
| 6 |
in radians for computation), one has |
| 7 |
|
| 8 |
c^2 = a^2 + b^2 − 2ab·cos(C) (and cyclic permutations for a and b). |
| 9 |
|
| 10 |
Thus, given two sides and the included angle you can solve the third side, e.g., |
| 11 |
|
| 12 |
c = √(a^2 + b^2 − 2ab·cos(C)) |
| 13 |
|
| 14 |
conversely, given all three sides you can recover the included angle, e.g., |
| 15 |
|
| 16 |
C = arccos((a^2 + b^2 − c^2)/(2ab)). |
| 17 |
|
| 18 |
When C = π/2 the cosine term vanishes and the formula reduces to the Pythagorean theorem |
| 19 |
|
| 20 |
a^2 + b^2 = c^2 |
| 21 |
|
| 22 |
validity requires the triangle inequalities and 0 < A, B, C < π, with equality cases |
| 23 |
corresponding to degenerate (collinear) triangles. |