Given two vectors $\boldsymbol{\mathrm{a} }$ and $\boldsymbol{\mathrm{b} }$ separated by an angle $\theta$, the dot product is defined to be
\[\boldsymbol{\mathrm{a} }\cdot\boldsymbol{\mathrm{b} }=\lvert\boldsymbol{\mathrm{a} }\rvert\lvert\boldsymbol{\mathrm{b} }\rvert\cos{\theta}.\]
Given two vectors $\boldsymbol{\mathrm{a} }=(a_1,a_2,a_3)$ and $\boldsymbol{\mathrm{b} }=(b_1,b_2,b_3)$, the dot product is defined to be:
\[\boldsymbol{\mathrm{a} }\cdot\boldsymbol{\mathrm{b} }=a_1b_1+a_2b_2+a_3b_3.\]
Or more generally, given vectors $\boldsymbol{\mathrm{a} }=(a_1,a_2,\ldots,a_n)$ and $\boldsymbol{\mathrm{b} }=(b_1,b_2,\ldots,b_n)$ the dot product is defined by:
\[\boldsymbol{\mathrm{a} }\cdot\boldsymbol{\mathrm{b} }=\sum_{i=1}^n{a_ib_i}=a_1b_1 +a_2b_2+\ldots+a_nb_n.\]
Note: The dot product is a scalar quantity: it is a real number, unlike the cross product which is a vector.
The dot product is commutative - the order of the vectors does not matter.
The dot product is distributive over addition.
Two vectors $\boldsymbol{\mathrm{a} }$ and $\boldsymbol{\mathrm{b} }$ are perpendicular to each other, i.e. the angle between them is $\frac{\pi}{2}$ radians, if and only if $\boldsymbol{\mathrm{a} }\cdot\boldsymbol{\mathrm{b} }=0$.
\begin{align} \boldsymbol{\mathrm{a} }\cdot\boldsymbol{\mathrm{b} } &= \lvert\boldsymbol{\mathrm{a} }\rvert\lvert\boldsymbol{\mathrm{b} }\rvert\cos{\theta} \\ &=\lvert\boldsymbol{\mathrm{a} }\rvert\lvert\boldsymbol{\mathrm{b} }\rvert\cos\left(\frac{\pi}{2} \right) \\ &=0 \end{align}
Find the angle in radians between vectors $\boldsymbol{\mathrm{a} }=(8,\,-2,\,16)$ and $\boldsymbol{\mathrm{b} }=(-9,\,8,\,12)$
Recall the formula for the dot product:
\begin{align} \boldsymbol{\mathrm{a} }\cdot\boldsymbol{\mathrm{b} } &= a_1b_1+a_2b_2+a_3b_3 \\ &= 8 \times (-9) + (-2) \times 8+16 \times 12 \\ &= -72 - 16 + 192 \\ &= 104. \end{align}
To find the angle between $\boldsymbol{\mathrm{a} }$ and $\boldsymbol{\mathrm{b} }$, recall this formula for the dot product:
\[\boldsymbol{\mathrm{a} }\cdot\boldsymbol{\mathrm{b} }=\lvert\boldsymbol{\mathrm{a} }\rvert\lvert\boldsymbol{\mathrm{b} }\rvert\cos{\theta}.\]
This can be rearranged to make $\theta$ the subject of the equation:
\[\cos{\theta}=\dfrac{\boldsymbol{\mathrm{a} }\cdot\boldsymbol{\mathrm{b} } }{\lvert\boldsymbol{\mathrm{a} }\rvert\lvert\boldsymbol{\mathrm{b} }\rvert}.\]
To use this formula, we need to know the lengths of vectors $\boldsymbol{\mathrm{a} }$ and $\boldsymbol{\mathrm{b} }$.
\begin{align} \lvert\boldsymbol{\mathrm{a} }\rvert &= \sqrt{a_1^2+a_2^2+a_3^2} \\ &=\sqrt{8^2+(-2)^2+16^2} \\ &=\sqrt{\strut{64+4+256} } \\ &=\sqrt{\strut{324} } \\ &=18, \end{align}
\begin{align} \lvert\boldsymbol{\mathrm{b} }\rvert &= \sqrt{b_1^2+b_2^2+b_3^2} \\ &= \sqrt{(-9)^2+8^2+12^2} \\ &= \sqrt{\strut{81+64+144} } \\ &= \sqrt{289 } \\ &= 17. \end{align}
Substitute the values for $\boldsymbol{\mathrm{a} }\cdot\boldsymbol{\mathrm{b} }$, $\lvert\boldsymbol{\mathrm{a} }\rvert$ and $\lvert\boldsymbol{\mathrm{b} }\rvert$ into the formula for $\cos{\theta}$:
\begin{align} \cos{\theta} &= \dfrac{\boldsymbol{\mathrm{a} }\cdot\boldsymbol{\mathrm{b} } }{\lvert\boldsymbol{\mathrm{a} }\rvert\lvert\boldsymbol{\mathrm{b} }\rvert} \\ \\ &= \dfrac{104}{18\cdot17} \\ \\ &= \dfrac{104}{306}. \\ \\ \theta &= \arccos \left( \dfrac{104}{306} \right) \\ &= 1.22 \:(\text{to 3 significant figures}). \end{align}
The angle between vectors $\boldsymbol{\mathrm{a} }=(8,\,-1,\,16)$ and $\boldsymbol{\mathrm{b} }=(-9,\,8,\,12)$ is $1.22$ radians, to 3 significant figures.
This workbook produced by HELM is a good revision aid, containing key points for revision and many worked examples.
Test yourself: Numbas test on vectors including dot and cross product