This article is about the trigonometric identity. For the cosine law of optics, see Lambert's cosine law.
Fig. 1 – A triangle. The angles α (or A), β (or B), and γ (or C) are respectively opposite the sides a, b, and c.
In trigonometry, the law of cosines (also known as the cosine formula or cosine rule) relates the lengths of the sides of a triangle to the cosine of one of its angles. For a triangle with sides , , and , opposite respective angles , , and (see Fig. 1), the law of cosines states: