Law of cosines


The law of cosines relates the lengths of the sides of a triangle to the cosine of one of its angles. For a triangle with sides aa, bb and cc, opposite respective angles α\alpha, β\beta and γ\gamma, we have

c2=a2+b22abcosγa2=b2+c22bccosαb2=a2+c22accosβ\begin{align} c^{2} & =a^{2}+b^{2}-2ab\cos \gamma \\ a^{2} & =b^{2}+c^{2}-2bc\cos \alpha \\ b^{2} & =a^{2}+c^{2}-2ac\cos \beta \end{align}

For a right triangle, where γ=0\gamma=0, this reduces to the Pythagorean theorem: c2=a2+b2c^{2}=a^{2}+b^{2}.