The Cosine Rule relates the lengths of a triangle's sides to the cosine of one of its angles and provides a geometric interpretation of the dot product. **Statement of the Cosine Rule:** For a triangle with sides $a,b,c$ and angle $\theta$ opposite to side $c$, then.. $c^2=a^2+b^2-2ab \cos(\theta)$ **Vector Form of the Cosine Rule:** Using [[Vector Operations|Vectors]], the cosine rule can be written in terms of the difference between two vectors $r$ and $s$, with $c=\vert r−s \vert$. ![[cosine-rule.png|center|300]] By substituting $r$ and $s$ for $a,b,c$ we get: $ \begin{align} \lvert r-s\rvert^2 &=\lvert r \rvert^2 + \lvert s\rvert^2- 2\lvert r \rvert \lvert s \rvert * \cos(\theta) \tag{1}\\[6pt] (r-s) \cdot(r-s) &= \lvert r \rvert^2 + \lvert s\rvert^2- 2\lvert r \rvert \lvert s \rvert * \cos(\theta)\tag{2}\\[6pt] r \cdot r - s \cdot r - s \cdot r + s \cdot s &=\lvert r \rvert^2 + \lvert s\rvert^2- 2\lvert r \rvert \lvert s \rvert * \cos(\theta) \tag{3}\\[6pt] \lvert r \rvert ^2 + \lvert s \rvert ^2 - 2 * r \cdot s &=\lvert r \rvert^2 + \lvert s\rvert^2- 2\lvert r \rvert \lvert s \rvert * \cos(\theta) \tag{4}\\[6pt] r\cdot s&=\lvert r \rvert \lvert s \rvert * \cos(\theta) \tag{5} \end{align} $ where: - (1) We can express the vector $c$ by starting at its origin (the tip of $s$), then going in the negative direction of $s$ and then in the direction of $r$. Hence $c=r-s$. - (2) The squared [[Vector Length]] is the same as the [[Dot Product#^8ea6e9|vector dotted with itself]] (e.g. $\vert x \vert^2= x \cdot x$). - (3) Since dot product is [[Dot Product#^065b11|distributive over addition]] we can expand it. - (4) Since dot product is [[Dot Product#^d17756|commutative]] we can unite $(r \cdot s)$ and $(s \cdot r)$. **Special Values of Cosine:** The cosine has interesting values of at the following points.. $ \cos(\theta) = \begin{cases} 1 & \text{if } \theta=0^\circ \\ 0 & \text{if } \theta=90^\circ \\ -1 & \text{if } \theta=180^\circ \end{cases} $ where: - $\theta=0^\circ$: Vectors are parallel and point in the same direction; $r⋅s>0$. - $\theta = 90^\circ$: Vectors are orthogonal (perpendicular); $r \cdot s=0$. - $\theta = 180^\circ$ Vectors are antiparallel, pointing in opposite directions; $r \cdot s < 0$. Interpretation of the dot product: - *Orthogonality:* The dot product is zero when vectors are orthogonal. - *Alignment:* A positive dot product indicates that vectors point in roughly the same direction. - *Opposition:* A negative dot product indicates that vectors point in roughly opposite directions.