## Section6.3The Dot Product

The goal of this section is to answer the following question. Given two vectors, what is the angle between them?

Since vectors have no position, we are free to place vectors wherever we like. If the two vectors are placed tail-to-tail, there is now a reasonable interpretation of the question: we seek the measure of the smallest angle between the two vectors, in the plane in which they lie. Figure 6.5 illustrates the situation.

Since the angle $\theta$ lies in a triangle, we can compute it using a bit of trigonometry, namely, the law of cosines. Remember that the law of cosines states $c^2 = a^2 + b^2 - 2ab \cos C\text{.}$

The lengths of the sides of the triangle in Figure 6.5 are $|\vect{v}|\text{,}$ $|\vect{w}|\text{,}$ and $|\vect{v}-\vect{w}|\text{.}$ Let $\vect{v}=\langle v_1,v_2,v_3\rangle$ and $\vect{w}=\langle w_1,w_2,w_3\rangle\text{;}$ then

\begin{align*} |\vect{v}-\vect{w}|^2\amp =|\vect{v}|^2+|\vect{w}|^2-2|\vect{v}||\vect{w}|\cos\theta\\ 2|\vect{v}||\vect{w}|\cos\theta\amp =|\vect{v}|^2+|\vect{w}|^2-|\vect{v}-\vect{w}|^2\\ \amp =v_1^2+v_2^2+v_3^2+w_1^2+w_2^2+w_3^2-(v_1-w_1)^2-(v_2-w_2)^2-(v_3-w_3)^2\\ \amp =v_1^2+v_2^2+v_3^2+w_1^2+w_2^2+w_3^2\\ \amp \qquad-(v_1^2-2v_1w_1+w_1^2) -(v_2^2-2v_2w_2+w_2^2)-(v_3^2-2v_3w_3+w_3^2)\\ \amp =2v_1w_1+2v_2w_2+2v_3w_3\\ |\vect{v}||\vect{w}|\cos\theta\amp =v_1w_1+v_2w_2+v_3w_3\\ \cos\theta\amp =(v_1w_1+v_2w_2+v_3w_3)/(|\vect{v}||\vect{w}|) \end{align*}

A bit of simple arithmetic with the coordinates of $\vect{v}$ and $\vect{w}$ allows us to compute the cosine of the angle between them. If necessary we can use the arccosine to get $\theta\text{,}$ but in many problems $\cos\theta$ turns out to be all we really need.

The numerator of the fraction that gives us $\cos\theta$ turns up a lot, so we give it a name and more compact notation: we call it the dot product, and write it as

\begin{equation*} \vect{v}\cdot\vect{w} = v_1w_1+v_2w_2+v_3w_3 \end{equation*}

This is the same symbol we use for ordinary multiplication, but there should never be any confusion; you can tell from context whether we are “multiplying” vectors or numbers. (We might also use the dot for scalar multiplication: $a\cdot\vect{v}=a\vect{v}\text{;}$ again, it is clear what is meant from context.)

###### Example6.4.

Find the angle between the vectors $\vect{v}=\langle 1,2,1\rangle$ and $\vect{w}=\langle 3,1,-5\rangle\text{.}$

Solution

We know that $\cos\theta=\vect{v}\cdot\vect{w}/(|\vect{v}||\vect{w}|)= (1\cdot3 + 2\cdot1 + 1\cdot(-5))/(|\vect{v}||\vect{w}|)=0\text{,}$ so $\theta=\pi/2\text{,}$ that is, the vectors are perpendicular.

###### Example6.5.

Find the angle between the vectors $\vect{v}=\langle 3,3,0\rangle$ and $\vect{w}=\langle 1,0,0\rangle\text{.}$

Solution

We compute

\begin{align*} \cos\theta \amp = (3\cdot1 + 3\cdot0 + 0\cdot0)/(\sqrt{9+9+0}\sqrt{1+0+0})\\ \amp = 3/\sqrt{18} = 1/\sqrt2 \end{align*}

so $\theta=\pi/4\text{.}$

The following are some special cases worth looking at.

###### Example6.6.

Find the angles between:

1. $\vect{v}$ and $\vect{v}$

2. $\vect{v}$ and $-\vect{v}$

3. $\vect{v}$ and $\vect{0}=\langle 0,0,0\rangle$

Solution
1. \begin{equation*} \begin{split} \cos\theta \amp= \vect{v}\cdot\vect{v}/(|\vect{v}||\vect{v}|) \\ \amp=(v_1^2+v_2^2+v_3^2)/ (\sqrt{v_1^2+v_2^2+v_3^2}\sqrt{v_1^2+v_2^2+v_3^2})=1, \end{split} \end{equation*}

so the angle between $\vect{v}$ and itself is zero, which of course is correct.

2. \begin{equation*} \begin{split} \cos\theta\amp=\vect{v}\cdot-\vect{v}/(|\vect{v}||-\vect{v}|)\\ \amp=(-v_1^2-v_2^2-v_3^2)/ (\sqrt{v_1^2+v_2^2+v_3^2}\sqrt{v_1^2+v_2^2+v_3^2})=-1,\end{split} \end{equation*}

so the angle is $\pi\text{,}$ that is, the vectors point in opposite directions, as of course we already knew.

3. \begin{equation*} \begin{split} \cos\theta\amp= \vect{v}\cdot\vect{0}/(|\vect{v}||\vect{0}|)\\ \amp=(0+0+0)/ (\sqrt{v_1^2+v_2^2+v_3^2}\sqrt{0^2+0^2+0^2}),\end{split} \end{equation*}

which is undefined. On the other hand, note that since $\vect{v}\cdot\vect{0}=0$ it looks at first as if $\cos\theta$ will be zero, which as we have seen means that vectors are perpendicular; only when we notice that the denominator is also zero do we run into trouble. One way to “fix” this is to adopt the convention that the zero vector $\vect{0}$ is perpendicular to all vectors; then we can say in general that if $\vect{v}\cdot\vect{w}=0\text{,}$ $\vect{v}$ and $\vect{w}$ are perpendicular.

Generalizing the examples, note the following useful facts:

• If $\vect{v}$ is parallel or anti-parallel to $\vect{w}$ then $\vect{v}\cdot\vect{w}/(|\vect{v}||\vect{w}|)=\pm1\text{,}$ and conversely, if $\vect{v}\cdot\vect{w}/(|\vect{v}||\vect{w}|)=1\text{,}$ $\vect{v}$ and $\vect{w}$ are parallel, while if $\vect{v}\cdot\vect{w}/(|\vect{v}||\vect{w}|)=-1\text{,}$ $\vect{v}$ and $\vect{w}$ are anti-parallel. (Vectors are parallel if they point in the same direction, anti-parallel if they point in opposite directions.)

• If $\vect{v}$ is perpendicular to $\vect{w}$ then $\vect{v}\cdot\vect{w}/(|\vect{v}||\vect{w}|)=0\text{,}$ and conversely if $\vect{v}\cdot\vect{w}/(|\vect{v}||\vect{w}|)=0$ then $\vect{v}$ and $\vect{w}$ are perpendicular.

Given two vectors, it is often useful to find the projection of one vector onto the other, because this turns out to have important meaning in many circumstances. More precisely, given $\vect{v}$ and $\vect{w}\text{,}$ we seek a vector parallel to $\vect{w}$ but with length determined by $\vect{v}$ in a natural way, as shown in Figure 6.6. $\vect{p}$ is chosen so that the triangle formed by $\vect{v}\text{,}$ $\vect{p}\text{,}$ and $\vect{v}-\vect{p}$ is a right triangle.

Using a little trigonometry, we see that

\begin{equation*} |\vect{p}|=|\vect{v}|\cos\theta= |\vect{v}|{\vect{v}\cdot\vect{w}\over|\vect{v}||\vect{w}|}= {\vect{v}\cdot\vect{w}\over|\vect{w}|}; \end{equation*}

this is sometimes called the scalar projection of $\vect{v}$ onto $\vect{w}$. To get $\vect{p}$ itself, we multiply this length by a vector of length one parallel to $\vect{w}\text{:}$

\begin{equation*} \vect{p}= {\vect{v}\cdot\vect{w}\over|\vect{w}|}{\vect{w}\over|\vect{w}|}= {\vect{v}\cdot\vect{w}\over|\vect{w}|^2}\vect{w}\text{.} \end{equation*}

Be sure that you understand why $\vect{w}/|\vect{w}|$ is a vector of length one (also called a unit vector ) parallel to $\vect{w}\text{.}$

The discussion so far implicitly assumed that $0\le\theta\le\pi/2\text{.}$ If $\pi/2\lt \theta\le\pi\text{,}$ the picture is like Figure 6.7. In this case $\vect{v}\cdot \vect{w}$ is negative, so the vector

\begin{equation*} {\vect{v}\cdot\vect{w}\over|\vect{w}|^2}\vect{w} \end{equation*}

is anti-parallel to $\vect{w}\text{,}$ and its length is

\begin{equation*} \left|{\vect{v}\cdot\vect{w}\over|\vect{w}|}\right|\text{.} \end{equation*}

In general, the scalar projection of $\vect{v}$ onto $\vect{w}$ may be positive or negative. If it is negative, it means that the projection vector is anti-parallel to $\vect{w}$ and that the length of the projection vector is the absolute value of the scalar projection. Of course, you can also compute the length of the projection vector as usual, by applying the distance formula to the vector.

Note that the phrase “projection onto $\vect{w}$” is a bit misleading if taken literally; all that $\vect{w}$ provides is a direction; the length of $\vect{w}$ has no impact on the final vector. In Figure 6.8, for example, $\vect{w}$ is shorter than the projection vector, but this is perfectly acceptable.

Physical force is a vector quantity. It is often necessary to compute the “component” of a force acting in a different direction than the force is being applied.

###### Example6.7. Components of Force Vector.

Suppose a ten pound weight is resting on an inclined plane—a pitched roof, for example. Gravity exerts a force of ten pounds on the object, directed straight down. It is useful to think of the component of this force directed down and parallel to the roof, and the component down and directly into the roof. These forces are the projections of the force vector onto vectors parallel and perpendicular to the roof. Suppose the roof is tilted at a $30^\circ$ angle, as in Figure 6.9. Compute the component of the force directed down the roof and the component of the force directed into the roof.

Solution

A vector parallel to the roof is $\langle-\sqrt3,-1\rangle\text{,}$ and a vector perpendicular to the roof is $\langle 1,-\sqrt3\rangle\text{.}$ The force vector is $\vect{F}=\langle 0,-10\rangle\text{.}$ The component of the force directed down the roof is then

\begin{align*} \vect{F}_1\amp ={\vect{F}\cdot \langle-\sqrt3,-1\rangle\over|\langle-\sqrt3,-1\rangle|^2} \langle-\sqrt3,-1\rangle ={10\over 2}{\langle-\sqrt3,-1\rangle\over2}= \langle -5\sqrt3/2,-5/2\rangle \end{align*}

with length 5. The component of the force directed into the roof is

\begin{align*} \vect{F}_2\amp ={\vect{F}\cdot \langle1,-\sqrt3\rangle\over|\langle1,-\sqrt3\rangle|^2} \langle1,-\sqrt3\rangle ={10\sqrt3\over 2}{\langle1,-\sqrt3\rangle\over2}= \langle 5\sqrt3/2,-15/2\rangle \end{align*}

with length $5\sqrt3\text{.}$ Thus, a force of 5 pounds is pulling the object down the roof, while a force of $5\sqrt3$ pounds is pulling the object into the roof.

The dot product has some familiar-looking properties that will be useful later, so we list them here. These may be proved by writing the vectors in coordinate form and then performing the indicated calculations; subsequently it can be easier to use the properties instead of calculating with coordinates.

##### Exercises for Section 6.3.

Find $\langle 1,1,1\rangle\cdot\langle 2,-3,4\rangle\text{.}$

$3$

Find $\langle 1,2,0\rangle\cdot\langle 0,0,57\rangle\text{.}$

$0$

Find $\langle 3,2,1\rangle\cdot\langle 0,1,0\rangle\text{.}$

$2$

Find $\langle -1,-2,5\rangle\cdot\langle 1,0,-1 \rangle\text{.}$

$-6$

Find $\langle 3,4,6\rangle\cdot\langle 2,3,4\rangle\text{.}$

$42$

Find the cosine of the angle between $\langle 1,2,3\rangle$ and $\langle 1,1,1\rangle\text{;}$ use a calculator if necessary to find the angle.

$\sqrt6/\sqrt7\text{,}$ $\approx 0.39$

Find the cosine of the angle between $\langle -1, -2,-3\rangle$ and $\langle 5,0,2\rangle\text{;}$ use a calculator if necessary to find the angle.

$-11\sqrt{14}\sqrt{29}/406\text{,}$ $\approx 2.15$

Find the cosine of the angle between $\langle 47,100,0\rangle$ and $\langle 0,0,5\rangle\text{;}$ use a calculator if necessary to find the angle.

$0\text{,}$ $\pi/2$

Find the cosine of the angle between $\langle 1,0,1 \rangle$ and $\langle 0,1,1\rangle\text{;}$ use a calculator if necessary to find the angle.

$1/2\text{,}$ $\pi/3$

Find the cosine of the angle between $\langle 2,0,0\rangle$ and $\langle -1,1,-1\rangle\text{;}$ use a calculator if necessary to find the angle.

$-1/\sqrt3\text{,}$ $\approx 2.19$

Find the angle between the diagonal of a cube and one of the edges adjacent to the diagonal.

$\arccos(1/\sqrt3)\approx 0.96$

Find the scalar and vector projections of $\langle 1,2,3\rangle$ onto $\langle 1,2,0\rangle\text{.}$

$\sqrt{5}\text{,}$ $\langle 1,2,0\rangle\text{.}$

Find the scalar and vector projections of $\langle 1,1,1\rangle$ onto $\langle 3,2,1\rangle\text{.}$

$3\sqrt{14}/7\text{,}$ $\langle 9/7,6/7,3/7\rangle\text{.}$

A force of 10 pounds is applied to a wagon, directed at an angle of $30^\circ\text{.}$ Find the component of this force pulling the wagon straight up, and the component pulling it horizontally along the ground.

$\langle 0,5\rangle\text{,}$ $\langle 5\sqrt3,0\rangle$

A force of 15 pounds is applied to a wagon, directed at an angle of $45^\circ\text{.}$ Find the component of this force pulling the wagon straight up, and the component pulling it horizontally along the ground.

$\langle 0,15\sqrt2/2\rangle\text{,}$$\langle 15\sqrt2/2,0\rangle$

Use the dot product to find a non-zero vector $\vect{w}$ perpendicular to both $\vect{u}=\langle 1,2,-3\rangle$ and $\vect{v}=\langle 2,0,1\rangle\text{.}$

Any vector of the form $\langle a, -7a/2, -2a\rangle$

Let $\vect{x}=\langle 1,1,0 \rangle$ and $\vect{y}=\langle 2,4,2 \rangle\text{.}$ Find a unit vector that is perpendicular to both $\vect{x}$ and $\vect{y}\text{.}$

$\langle 1/\sqrt3,-1/\sqrt3,1/\sqrt3\rangle$

Do the three points $(1,2,0)\text{,}$ $(-2,1,1)\text{,}$ and $(0,3,-1)$ form a right triangle?

No.

Do the three points $(1,1,1)\text{,}$ $(2,3,2)\text{,}$ and $(5,0,-1)$ form a right triangle?

Show that $|\vect{v}\cdot\vect{w}|\le|\vect{v}||\vect{w}|$
Let $\vect{x}$ and $\vect{y}$ be perpendicular vectors. Use Theorem 6.8 to prove that $|\vect{x}|^2+|\vect{y}|^2=|\vect{x}+\vect{y}|^2\text{.}$ What is this result better known as?
Suppose that $\vect{z}=|\vect{x}| \vect{y} + |\vect{y}| \vect{x}$ where $\vect{x}\text{,}$ $\vect{y}\text{,}$ and $\vect{z}$ are all nonzero vectors. Prove that $\vect{z}$ bisects the angle between $\vect{x}$ and $\vect{y}\text{.}$