Law of cosines & dot product

Jaehoon Jang
Jan 30, 2023

Trigonometry

The law of cosines is a generalized theorem of the pythagorean theorem. It relates the lengths of the sides of a triangle to the cosine of one of its angle.

When given a triangle ABC, the law of cosines goes like this:

The law of cosines generalizes the pythagorean theorem because the pythagorean theorem holds only for right triangles. In this case,

cos(θ) becomes 0, since θ is 90°. The formula is abbreviated to:

pythagorean theorem

Using the cosine law, we can derive the dot product of vectors.

dot product of two vectors

Using the law of cosines,

The dot product has this property:

So,

It can be shown like this.

--

--

Jaehoon Jang

Masters in Artificial Intelligence, Korea University, South Korea