Linear Algebra, Law of Sines and Cosines

Law of Sines and Cosines

In the previous section we defined the angle between two vectors u and v as acos((u.v)/(|u|×|v|)). But that was strictly algebra. Does it coincide with the traditional, geometric definition of angle? It does, and we'll demonstrate this by proving the law of cosines algebraically and geometrically.

If two vectors, u and v, meet at an angle of θ, and the lengths of u and v are a and b, and the length of the third side is c, the law of cosines states,

c2 = a2 + b2 - 2ab×cos(θ).

Replace θ with its algebraic definition above, remembering that cosine and arccosine are inverse functions. The denominator |u|×|v| is the same as ab, and the equation simplifies to this.

c2 = a2 + b2 - 2(u.v)

(u-v).(u-v) = u.u + v.v - 2(u.v)

Expand all the dot products in the last equation. The left and right sides are algebraically equivalent. Thus the law of cosines, a generalization of the Pythagorean theorem, is valid when angles are defined as above. Let's see if the same holds in plane geometry.

Given a triangle with lengths a, b, and c, drop a perpendicular from the apex, splitting b into lengths x and y. Thus x+y = b. Note that x or y could be negative, if the apex leans off to the left or right of the base. Use the Pythagorean theorem twice to get:

a2 - x2 = c2 - y2

Replace y with b-x, and x with a×cos(θ), and derive the law of cosines. Thus the algebraic definition of angle matches the geometric definition; both produce the same cosine.

Given the law of cosines, prove the law of sines by expanding sin(θ)2/c2. Replace sin2 with 1-cos2, and by the law of cosines, cos(θ) becomes a2 + b2 -c2 over 2ab. If you do all the algebra, the expression becomes:

2a2b2 + 2a2c2 + 2b2c2 - a4 - b4 - c4 over 4a2b2c2

Notice that this expression is symmetric with respect to all three variables. The exact value depends on the shape of the triangle, but for any triangle, the sine of an angle divided by the length of the opposite side is a fixed ratio.