Law of Cosines

Consider a triangle with sides of length a, b, c, where $$\theta$$ is the measurement of the angle opposite the side of length c. We can place this triangle on the coordinate system by plotting $$A(b\cos \theta, b\sin \theta),\ B(a,0),$$ and $$\ C(0,0).$$ By the distance formula, we have $$c = \sqrt{(b\cos \theta - a)^2+(b\sin \theta - 0)^2}$$. Now, we just work with this equation:

$$c^2 = (b\cos \theta - a)^2+(b\sin \theta - 0)^2\,$$ $$c^2 = b^2 \cos ^2 \theta - 2ab\cos \theta + a^2 + b^2\sin ^2 \theta\,$$ $$c^2 = a^2 + b^2 (\sin ^2 \theta + \cos ^2 \theta ) - 2ab\cos \theta\,$$ $$c^2 = a^2 + b^2 - 2ab\cos \theta\,$$

MII