law of cosines

Law of cosines

Triangle_with_notations_2.svg.png

The law of cosines state that for a triangle with sides \[a\], \[b\] and \[c\] and opposite respective angles \[\alpha\], \[\beta\] and \[\gamma\], \[c^{2}=a^{2}+b^{2}-2ab\cos\gamma\]. This is a generalisation of the Pythagorean theorem, as if \[\gamma=90^{\circ}\] then \[c^{2}=a^{2}+b^{2}\].

Proof

800px-CosineRuleCartesian.png
Let \[\triangle ABC\] be a triangle were the coordinates of \[C\] is \[(0,0)\] and \[B\] is \[(a,0)\]. Let \[A=(x,y)\].

Then, if we draw a circle centered around the origin with radius \[b\] (essentially a radius circle with \[A\] lying on its circumference), then \[\cos C=\frac{x}{b}\] and \[\sin C=\frac{y}{b}\]. It follows that \[A=(x,y)=\left( b\cos C, b\sin C \right)\].

Since we know the distance between any two points is \[\sqrt{\left( y_{2}-y_{1} \right)^{2}+\left( x_{2}-x_{1} \right)^{2}}\], then \[c=\sqrt{\left( b\sin C-0 \right)^{2}+\left( b\cos C-a \right)^{2}}\].

\begin{align*} c^{2}&=\left( b\sin C-0 \right)^{2}+\left( b\cos C-a \right)^{2}\\ &=b^{2}\sin^{2}C+b^{2}\cos^{2}C-2ab\cos C+a^{2}\\ &=a^{2}+b^{2}(\cos^{2}C+\sin^{2}C)-2ab\cos C\\ &=a^{2}+b^{2}-2ab\cos C\\ \end{align*}
index