The dot product
Vectors can be added and multiplied by numbers. There is also a way to "multiply" two vectors that gives a number. It is called the dot product. It tells us the angle between two vectors, whether they are perpendicular, and how much work a force does.
The definition
For ${\mathbf{u}=\langle a_1,b_1\rangle}$ and ${\mathbf{v}=\langle a_2,b_2\rangle}$, multiply matching components and add:
${\mathbf{u}\cdot\mathbf{v}=a_1a_2+b_1b_2}$
The result is a scalar (a number), not a vector.
Example 1: Find each dot product.
(a) $\langle 2,3\rangle\cdot\langle 4,-1\rangle$
(b) $(3\mathbf{i}-2\mathbf{j})\cdot(\mathbf{i}+4\mathbf{j})$
Solution:
(a) ${2(4)+3(-1)=8-3=5}$
(b) The components are ${\langle 3,-2\rangle}$ and ${\langle 1,4\rangle}$, so the dot product is ${3(1)+(-2)(4)=-5}$.
The dot product follows familiar rules:
$\mathbf{u}\cdot\mathbf{v}=\mathbf{v}\cdot\mathbf{u}$
$\begin{align*}&\mathbf{u}\cdot(\mathbf{v}+\mathbf{w})\\&=\mathbf{u}\cdot\mathbf{v}+\mathbf{u}\cdot\mathbf{w}\end{align*}$
Also, a vector dotted with itself gives its length squared:
$\mathbf{v}\cdot\mathbf{v}=a^2+b^2=|\mathbf{v}|^2$
The angle between two vectors
Draw ${\mathbf{u}}$ and ${\mathbf{v}}$ from the same point. The angle between them is the angle ${\theta}$ from ${0}$ to ${\pi}$ (that is, ${0^\circ}$ to ${180^\circ}$) at that point.
The dot product and this angle are linked:
$\mathbf{u}\cdot\mathbf{v}=|\mathbf{u}|\,|\mathbf{v}|\cos\theta$
so$\cos\theta=\dfrac{\mathbf{u}\cdot\mathbf{v}}{|\mathbf{u}|\,|\mathbf{v}|}$
Why it is true. The vectors ${\mathbf{u}}$, ${\mathbf{v}}$, and ${\mathbf{u}-\mathbf{v}}$ form a triangle, with angle ${\theta}$ between the first two. By the law of cosines,
$\begin{align*}&|\mathbf{u}-\mathbf{v}|^2\\&=|\mathbf{u}|^2+|\mathbf{v}|^2-2|\mathbf{u}|\,|\mathbf{v}|\cos\theta\end{align*}$
But by the rules above,
$\begin{align*}&|\mathbf{u}-\mathbf{v}|^2\\&=(\mathbf{u}-\mathbf{v})\cdot(\mathbf{u}-\mathbf{v})\\&=|\mathbf{u}|^2-2\,\mathbf{u}\cdot\mathbf{v}+|\mathbf{v}|^2\end{align*}$
Setting the two equal and cancelling gives the formula.
Example 2: Find the angle between ${\mathbf{u}=\langle 2,3\rangle}$ and ${\mathbf{v}=\langle 4,-1\rangle}$.
Solution:
From Example 1, ${\mathbf{u}\cdot\mathbf{v}=5}$. The lengths are ${|\mathbf{u}|=\sqrt{13}}$ and ${|\mathbf{v}|=\sqrt{17}}$. So
$\begin{align*}\cos\theta&=\dfrac{5}{\sqrt{13}\sqrt{17}}\\&=\dfrac{5}{\sqrt{221}}\approx 0.3363\end{align*}$
$\theta=\cos^{-1}(0.3363)\approx 70.35^\circ$
Perpendicular vectors
Two vectors are perpendicular (also called orthogonal) if the angle between them is ${90^\circ}$. Since ${\cos 90^\circ=0}$, this happens exactly when the dot product is zero:
${\mathbf{u}}$ and ${\mathbf{v}}$ are perpendicular when ${\mathbf{u}\cdot\mathbf{v}=0}$
The sign of the dot product tells even more: positive means the angle is acute, and negative means it is obtuse.
Example 3:
(a) Are ${\langle 3,-6\rangle}$ and ${\langle 4,2\rangle}$ perpendicular?
(b) Find ${k}$ so that ${\langle k,3\rangle}$ is perpendicular to ${\langle 2,-4\rangle}$.
Solution:
(a) ${3(4)+(-6)(2)=12-12=0}$. Yes, they are perpendicular.
(b) Set the dot product equal to ${0}$: ${2k+3(-4)=0}$, so ${2k=12}$ and ${k=6}$.
Projections
Shine a light straight down onto the line of ${\mathbf{v}}$. The shadow of ${\mathbf{u}}$ on that line is the projection of ${\mathbf{u}}$ onto ${\mathbf{v}}$, written ${\text{proj}_{\mathbf{v}}\mathbf{u}}$. It is the part of ${\mathbf{u}}$ that points along ${\mathbf{v}}$.
$\text{proj}_{\mathbf{v}}\mathbf{u}=\left(\dfrac{\mathbf{u}\cdot\mathbf{v}}{|\mathbf{v}|^2}\right)\mathbf{v}$
The number $\dfrac{\mathbf{u}\cdot\mathbf{v}}{|\mathbf{v}|}$ is the signed length of the shadow. It is called the component of ${\mathbf{u}}$ along ${\mathbf{v}}$.
Example 4: Find the projection of ${\mathbf{u}=\langle 3,5\rangle}$ onto ${\mathbf{v}=\langle 4,1\rangle}$.
Solution:
${\mathbf{u}\cdot\mathbf{v}=12+5=17}$, and ${|\mathbf{v}|^2=16+1=17}$. So
$\text{proj}_{\mathbf{v}}\mathbf{u}=\dfrac{17}{17}\langle 4,1\rangle=\langle 4,1\rangle$
Check: The rest of ${\mathbf{u}}$ is
$\langle 3,5\rangle-\langle 4,1\rangle=\langle -1,4\rangle$
It should be perpendicular to ${\mathbf{v}}$. Indeed,
$\langle -1,4\rangle\cdot\langle 4,1\rangle=-4+4=0$
Work
In physics, a force does work when it moves an object. If a constant force ${\mathbf{F}}$ moves an object along a vector ${\mathbf{D}}$, the work is
$W=\mathbf{F}\cdot\mathbf{D}=|\mathbf{F}|\,|\mathbf{D}|\cos\theta$
where ${\theta}$ is the angle between the force and the motion. Only the part of the force along the motion counts. With force in newtons and distance in meters, work is in joules (J).
Example 5: A child pulls a wagon ${20}$ m along level ground. The handle pulls with a force of ${50}$ N at an angle of ${30^\circ}$ above the ground. How much work is done?
Solution:
$W=50\cdot 20\cdot\cos 30^\circ\approx 866$ J
If the child pulled straight along the ground, the work would be ${50\cdot 20=1000}$ J. Pulling at an angle wastes part of the force lifting up.
Summary
- The dot product of ${\langle a_1,b_1\rangle}$ and ${\langle a_2,b_2\rangle}$ is the number ${a_1a_2+b_1b_2}$.
- Angle between vectors: ${\cos\theta=\dfrac{\mathbf{u}\cdot\mathbf{v}}{|\mathbf{u}|\,|\mathbf{v}|}}$.
- Perpendicular exactly when ${\mathbf{u}\cdot\mathbf{v}=0}$.
- Projection: ${\text{proj}_{\mathbf{v}}\mathbf{u}=\left(\dfrac{\mathbf{u}\cdot\mathbf{v}}{|\mathbf{v}|^2}\right)\mathbf{v}}$.
- Work: ${W=\mathbf{F}\cdot\mathbf{D}}$.