11b.1. The dot product, angles, perpendicular vectors

Definition of the dot product

Given two vectors, we define the dot product (also called the scalar product or inner product) to be $$ \begin{pmatrix} a_1 \\ a_2 \\ a_3 \end{pmatrix} \cdot \begin{pmatrix} b_1 \\ b_2 \\ b_3 \end{pmatrix} = a_1 b_1 + a_2 b_2 + a_3 b_3.$$ Note that the final result is a scalar (i.e. a "number") and not a vector. For example, $$ \begin{pmatrix} 1 \\ 2 \\ -3 \end{pmatrix} \cdot \begin{pmatrix} -1 \\ 4 \\ 0 \end{pmatrix} = 1(-1) + 2(4) + (-3)(0) = 7.$$ Once again, we emphasize that the final result is a scalar $7$ and IS NOT a vector such as $\begin{pmatrix} -1 \\ 8 \\ 0 \end{pmatrix}$.

The main reason we define the dot product this way is that it is simple to compute, and leads to the very useful formula

where $\theta$ is the angle between vectors $\mathbf{a}$ and $\mathbf{b}$.

Derivation of the formula

We will use the cosine rule and the following formulas (their validity can be easily checked by algebraic manipulations and definitions). These formulas are also used for more abstract questions like those in section 11b.5:

  1. $\mathbf{a} \cdot \mathbf{a} = | \mathbf{a} |^2$
  2. $\mathbf{a} \cdot \mathbf{b} = \mathbf{b} \cdot \mathbf{a}$
  3. Expansion: $(\mathbf{a}+\mathbf{b}) \cdot (\mathbf{c} + \mathbf{d}) = \mathbf{a} \cdot \mathbf{c} + \mathbf{a} \cdot \mathbf{d} + \mathbf{b} \cdot \mathbf{c} + \mathbf{b} \cdot \mathbf{d}$

Consider a triangle $OAB$ with $\mathbf{a}, \mathbf{b}$ the position vectors of points $A$ and $B$. Let $\theta$ be the angle $AOB$. By the cosine rule, $AB^2 = OA^2 + OB^2 - 2 \, OA \cdot OB \cos \theta$.
$\begin{gather} | \mathbf{b}-\mathbf{a} |^2 = |\mathbf{a}|^2 + |\mathbf{b}|^2 - 2 |\mathbf{a}| \, |\mathbf{b}| \cos \theta \tag{4} \end{gather}$ By using formula 1, $|\mathbf{b}-\mathbf{a}|^2 = (\mathbf{b}-\mathbf{a}) \cdot (\mathbf{b}-\mathbf{a})$.
Expanding using formula 3 gives us $\mathbf{b} \cdot \mathbf{b} - \mathbf{a} \cdot \mathbf{b} - \mathbf{b} \cdot \mathbf{a} + \mathbf{a} \cdot \mathbf{a}$.
The use of formulas 1 and 2 simplifies the expression to $|\mathbf{b}|^2 - 2 \mathbf{a}\cdot\mathbf{b} + |\mathbf{a}|^2$.
Plugging this into equation 4 gives us $|\mathbf{a}|^2 + |\mathbf{b}|^2 - 2 \mathbf{a} \cdot \mathbf{b} = |\mathbf{a}|^2 + |\mathbf{b}|^2 - 2 |\mathbf{a}| \, |\mathbf{b}| \cos \theta $
$-2\mathbf{a} \cdot \mathbf{b} = -2 |\mathbf{a}| \, |\mathbf{b} | \cos \theta$.
$\mathbf{a}\cdot \mathbf{b} = |\mathbf{a}| \, |\mathbf{b} | \cos \theta $

Angles and perpendicular vectors

The dot product formula is especially handy in two situations. The first is in the computation of angles. Given two vectors $\mathbf{a}$ and $\mathbf{b}$, the values of $\mathbf{a} \cdot \mathbf{b}$, $|\mathbf{a}|$ and $|\mathbf{b}|$ are all relatively simple to compute. Substituting them into our formula allows us to calculate the angle between them.

The second situation is when vectors are perpendicular . If $\mathbf{a}$ and $\mathbf{b}$ are perpendicular, then $\theta=90^\circ$, $\cos \theta = 0$ and $\mathbf{a} \cdot \mathbf{b} = 0$. Conversely, if $\mathbf{a}\cdot \mathbf{b}=0$, then either $\theta=90^\circ$, $\mathbf{a}=\mathbf{0}$ or $\mathbf{b}=\mathbf{0}$.

Solution to examples:

1. It is given that vectors $\mathbf{a} = \begin{pmatrix} 1 \\ 2 \\ -3 \end{pmatrix}, \mathbf{b} = \begin{pmatrix} 5 \\ 0 \\ 1 \end{pmatrix}.$
Find the angle between $\mathbf{a}$ and $\mathbf{b}$.

$\mathbf{a}\cdot \mathbf{b} = |\mathbf{a}| \, |\mathbf{b} | \cos \theta$
$\begin{pmatrix} 1 \\ 2 \\ -3 \end{pmatrix} \cdot \begin{pmatrix} 5 \\ 0 \\ 1 \end{pmatrix} = \left | \begin{pmatrix} 1 \\ 2 \\ -3 \end{pmatrix} \right | \, \left | \begin{pmatrix} 5 \\ 0 \\ 1 \end{pmatrix} \right | \cos \theta$
$5+0-3 = \sqrt{14} \sqrt{26} \cos \theta$
$\theta = \cos^{-1} \left ( \frac{2}{\sqrt{14} \sqrt{26}} \right ) =$ $84.0^\circ$


2. Given further that $\mathbf{c} = \begin{pmatrix} -1 \\ 1 \\ z \end{pmatrix}$ and $\mathbf{a}$ is perpendicular to $\mathbf{c}$, find the constant $z$.

Since $\mathbf{a}$ is perpendicular to $\mathbf{c}$, $\mathbf{a} \cdot \mathbf{c} = 0$
$-1 + 2 - 3z = 0$
$z = \frac{1}{3}$


3. Given further that $\mathbf{d} = \begin{pmatrix} k+2 \\ k-1 \\ k \end{pmatrix}$, show that $\mathbf{a}$ is perpendicular to $\mathbf{d}$ for all $k \in \mathbb{R}$.

$\mathbf{a} \cdot \mathbf{d} = k+2 + 2(k-1) -3k = k+2+2k-2-3k = 0$.
Hence $\mathbf{a}$ is perpendicular to $\mathbf{d}$ for all $k \in \mathbb{R}$.