» Law of Cosines

In trigonometry, the law of cosines (also known as the cosine formula, cosine rule, or al-Kashi's theorem) relates the lengths of the sides of a triangle to the cosine of one of its angles. The law of cosines states that:

$$a^{2}=b^{2}+c^{2}-2bc\times\cos\alpha$$ $$b^{2}=a^{2}+c^{2}-2ac\times\cos\beta$$ $$c^{2}=a^{2}+b^{2}-2ab\times\cos\gamma$$

where,

a, b, c — sides of a triangle;
α, β, γ — angles of a triangle.

The law of cosines can be seen as a generalization of the Pythagorean theorem, which holds only for right triangles. If the angle γ is a right angle (of measure 90 degrees, or π/2 radians), then cos γ = 0, and thus the law of cosines reduces to the Pythagorean theorem.

See also:

Frequently asked questions

What is the law of cosines used for?

The law of cosines is used to find unknown sides or angles in any triangle when side lengths and included angles are known.

How is the law of cosines related to the Pythagorean theorem?

It generalizes the Pythagorean theorem and becomes the same formula when the included angle is 90 degrees.

When should you use the law of cosines instead of the law of sines?

You typically use the law of cosines when you know two sides and the included angle, or all three sides of a triangle.