# 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.