# 9.3: Dot Product

- Page ID
- 107856

- How is the dot product of two vectors defined and what geometric information does it tell us?
- How can we tell if two vectors in \(\mathbb{R}^n\) are perpendicular?
- How do we find the projection of one vector onto another?

In the last section, we considered vector addition and scalar multiplication and found that each operation had a natural geometric interpretation. In this section, we will introduce a means of multiplying vectors.

For two-dimensional vectors \(\mathbf{u} =\langle u_1,u_2\rangle\) and \(\mathbf{v}=\langle v_1, v_2\rangle\text{,}\) the dot product is simply the scalar obtained by

\[ \mathbf{u} \cdot \mathbf{v} = u_1v_1 + u_2v_2. \nonumber \]

a. If \(\mathbf{u} =\langle 3, 4\rangle\) and \(\mathbf{v}=\langle -2, 1\rangle\text{,}\) find the dot product \(\mathbf{u} \cdot \mathbf{v}\text{.}\)

b. Find \(\mathbf{i} \cdot \mathbf{j}\) and \(\mathbf{i} \cdot \mathbf{j}\text{.}\)

c. If \(\mathbf{u}=\langle 3, 4\rangle\text{,}\) find \(\mathbf{u} \cdot \mathbf{u} \text{.}\) How is this related to \(|\mathbf{u}|\text{?}\)

d. On the axes in Figure \(\PageIndex{1}\), plot the vectors \(\mathbf{u}=\langle 1, 3\rangle\) and \(\mathbf{v}=\langle -3, 1\rangle\text{.}\) Then, find \(\mathbf{u} \cdot \mathbf{v}\text{.}\) What is the angle between these vectors?

e. On the axes in Figure \(\PageIndex{2}\), plot the vector \(\mathbf{u} =\langle 1, 3\rangle\text{.}\)

For each of the following vectors \(\mathbf{v}\text{,}\) plot the vector on Figure \(\PageIndex{2}\) and then compute the dot product \(\mathbf{u} \cdot \mathbf{v}\text{.}\)

- \(\mathbf{v}=\langle 3, 2 \rangle\text{.}\)
- \(\mathbf{v}=\langle 3, 0 \rangle\text{.}\)
- \(\mathbf{v}=\langle 3,-1 \rangle\text{.}\)
- \(\mathbf{v}=\langle 3,-2 \rangle\text{.}\)
- \(\mathbf{v}=\langle 3,-4 \rangle\text{.}\)

f. Based upon the previous part of this activity, what do you think is the sign of the dot product in the following three cases shown in Figure \(\PageIndex{3}\)?

## The Dot Product

The definition of the dot product for vectors in \(\mathbb{R}^2\) given in Preview Activity \(\PageIndex{1}\) can be extended to vectors in \(\mathbb{R}^n\text{.}\)

The dot product of vectors \(\mathbf{u}=\langle u_1, u_2,\ldots,u_n\rangle\) and \(\mathbf{v}=\langle v_1, v_2,\ldots,v_n\rangle\) in \(\mathbb{R}^n\) is the scalar

\[ \mathbf{u} \cdot \mathbf{v} = u_1v_1+u_2v_2 + \ldots + u_nv_n. \nonumber \]

(As we will see shortly, the dot product arises in physics to calculate the work done by a vector force in a given direction. It might be more natural to define the dot product in this context, but it is more convenient from a mathematical perspective to define the dot product algebraically and then view work as an application of this definition.)

For instance, we find that

Notice that the resulting quantity is a scalar. Our work in Preview Activity \(\PageIndex{1}\) examined dot products of two-dimensional vectors.

Determine each of the following.

- \(\langle 1, 2, -3 \rangle \cdot \langle 4, -2, 0 \rangle\text{.}\)
- \(\displaystyle \langle 0, 3, -2, 1 \rangle \cdot \langle 5, -6, 0, 4 \rangle\)

The dot product is a natural way to define a product of two vectors. In addition, it behaves in ways that are similar to the product of, say, real numbers.

Let \(\mathbf{u}\text{,}\) \(\mathbf{v}\text{,}\) and \(\mathbf{w}\) be vectors in \(\mathbb{R}^n\text{.}\) Then

- \(\mathbf{u} \cdot \mathbf{v} = \mathbf{v} \cdot \mathbf{u}\) (the dot product is
*commutative*), and - \((\mathbf{u} + \mathbf{v}) \cdot \mathbf{w} = (\mathbf{u} \cdot \mathbf{w}) + (\mathbf{v} \cdot \mathbf{w})\text{.}\)
- if \(c\) is a scalar, then \((c\mathbf{u}) \cdot \mathbf{w} = c(\mathbf{u} \cdot \mathbf{w})\text{.}\)

Moreover, the dot product gives us valuable geometric information about the vectors and their relative orientation. For instance, let's consider what happens when we dot a vector with itself:

In other words, the dot product of a vector with itself gives the square of the length of the vector: \(\mathbf{u} \cdot \mathbf{u}=|\mathbf{u}|^2\text{.}\)

## The angle between vectors

The dot product can help us understand the angle between two vectors. For instance, if we are given two vectors \(\mathbf{u}\) and \(\mathbf{v}\text{,}\) there are two angles that these vectors create, as depicted at left in Figure \(\PageIndex{4}\). We will call \(\theta\text{,}\) the smaller of these angles, the *angle between these vectors*. Notice that \(\theta\) lies between 0 and \(\pi\text{.}\)

To determine this angle, we may apply the Law of Cosines to the triangle shown at right in Figure \(\PageIndex{4}\).

Using the fact that the dot product of a vector with itself gives us the square of its length, together with the properties of the dot product, we find:

To summarize, we have the important relationship

It is sometimes useful to think of Equation (\(\PageIndex{1}\)) as giving us an expression for the angle between two vectors:

The real beauty of this expression is this: the dot product is a very simple algebraic operation to perform yet it provides us with important geometric information — namely the angle between the vectors — that would be difficult to determine otherwise.

Determine each of the following.

- The length of the vector \(\mathbf{u}=\langle 1,2,-3\rangle\) using the dot product.
- The angle between the vectors \(\mathbf{u} =\langle 1, 2 \rangle\) and \(\mathbf{v} = \langle 4, -1 \rangle\) to the nearest tenth of a degree.
- The angle between the vectors \(\mathbf{y} =\langle 1, 2, -3 \rangle\) and \(\mathbf{z} = \langle -2, 1, 1 \rangle\) to the nearest tenth of a degree.
- If the angle between the vectors \(\mathbf{u}\) and \(\mathbf{v}\) is a right angle, what does the expression \(\mathbf{u} \cdot \mathbf{v}=|\mathbf{u}||\mathbf{v}|\cos(\theta)\) say about their dot product?
- If the angle between the vectors \(\mathbf{u}\) and \(\mathbf{v}\) is acute—that is, less than \(\pi/2\)—what does the expression \(\mathbf{u}\cdot \mathbf{v} =|\mathbf{u}||\mathbf{v}|\cos(\theta)\) say about their dot product?
- If the angle between the vectors \(\mathbf{u}\) and \(\mathbf{v}\) is obtuse—that is, greater than \(\pi/2\)—what does the expression \(\mathbf{u} \cdot \mathbf{v}=|\mathbf{u}||\mathbf{v}|\cos(\theta)\) say about their dot product?

## The Dot Product and Orthogonality

When the angle between two vectors is a right angle, it is frequently the case that something important is happening. In this case, we say the vectors are *orthogonal*. For instance, orthogonality often plays a role in optimization problems; to determine the shortest path from a point in \(\mathbb{R}^3\) to a given plane, we move along a line orthogonal to the plane.

As Activity \(\PageIndex{3}\) indicates, the dot product provides a simple means to determine whether two vectors are orthogonal to one another. In this case, \(\mathbf{u} \cdot \mathbf{v} =|\mathbf{u}||\mathbf{v}|\cos(\pi/2) = 0\text{,}\) so we make the following important observation.

Two vectors \(\mathbf{u}\) and \(\mathbf{v}\) in \(\mathbb{R}^n\) are orthogonal to each other if \(\mathbf{u} \cdot \mathbf{v} = 0\text{.}\)

More generally, the sign of the dot product gives us useful information about the relative orientation of the vectors. If we remember that

we see that for nonzero vectors \(\mathbf{u}\) and \(\mathbf{v} \text{,}\)

This is illustrated in Figure \(\PageIndex{5}\).

## Work, Force, and Displacement

In physics, work is a measure of the energy required to apply a force to an object through a displacement. For instance, Figure \(\PageIndex{6}\) shows a force \(\mathbf{F}\) displacing an object from point \(A\) to point \(B\text{.}\) The displacement is then represented by the vector \(\overrightarrow{AB}\text{.}\)

It turns out that the work required to displace the object is

This means that the work is determined only by the magnitude of the force applied parallel to the displacement. Consequently, if we are given two vectors \(\mathbf{u}\) and \(\mathbf{v}\text{,}\) we would like to write \(\mathbf{u}\) as a sum of two vectors, one of which is parallel to \(\mathbf{v}\) and one of which is orthogonal to \(\mathbf{v} \text{.}\) We take up this task after the next activity.

Determine the work done by a 25 pound force acting at a \(30^{\circ}\) angle to the direction of the object's motion, if the object is pulled 10 feet. In addition, is more work or less work done if the angle to the direction of the object's motion is \(60^\circ\text{?}\)

## Projections

Suppose we are given two vectors \(\mathbf{u}\) and \(\mathbf{v}\) as shown at left in Figure \(\PageIndex{7}\). Motivated by our discussion of work, we would like to write \(\mathbf{u}\) as a sum of two vectors, one of which is parallel to \(\mathbf{v}\) and one of which is orthogonal. That is, we would like to write

where \(proj_{\mathbf{v}}\mathbf{u}\) is parallel to \(\mathbf{v}\) and \(proj_{\perp \mathbf{v}}\mathbf{u} \) is orthogonal to \(\mathbf{v} \text{.}\) We call the vector \(proj_{\mathbf{v}}\mathbf{u}\) the *projection* of \(\mathbf{u}\) onto \(\mathbf{v}\). Note that, as the diagram at right in Figure \(\PageIndex{8}\) illustrates, it is also possible to create a projection even if the angle between the vectors \(\mathbf{u}\) and \(\mathbf{v}\) exceeds \(\frac\pi2\text{.}\)

To find the vector \(proj_{\mathbf{v}} \mathbf{u}\text{,}\) we will dot both sides of Equation (\(\PageIndex{2}\)) with the vector \(\mathbf{v}\text{,}\) to find that

Notice that \((proj_{\perp\mathbf{v}}\mathbf{u})\cdot \mathbf{v} = 0\) since \(proj_{\perp\mathbf{v}}\mathbf{u}\) is orthogonal to \(\mathbf{v}\text{.}\) Also, \(proj_{\mathbf{v}}\mathbf{u}\) must be a scalar multiple of \(\mathbf{v}\) since it is parallel to \(\mathbf{v}\text{,}\) so we will write \(proj_{\mathbf{v}}\mathbf{u} = s \mathbf{v} \text{.}\) It follows that

which means that

and hence

It is sometimes useful to write \(proj_{\mathbf{v}}\mathbf{u}\) as a scalar times a unit vector in the direction of \(\mathbf{v}\text{.}\) We call this scalar the *component of *\(\mathbf{u}\) *along *\(\mathbf{v}\) and denote it as \(comp_{\mathbf{v}}\mathbf{u} \text{.}\) We therefore have

so that

Let \(\mathbf{u}\) and \(\mathbf{v}\) be vectors in \(\mathbb{R}^n\text{.}\) The component of \(\mathbf{u}\) in the direction of \(\mathbf{v}\) is the scalar

and the projection of \(\mathbf{u}\) onto \(\mathbf{v}\) is the vector

\[ proj_{\mathbf{v}} \mathbf{u} = \frac{\mathbf{u} \cdot \mathbf{v}}{\mathbf{v}\cdot\mathbf{v}} \mathbf{v}. \nonumber \]

Moreover, since

it follows that

This shows that once we have computed \(proj_{\mathbf{v}} \mathbf{u} \text{,}\) we can find \(proj_{\perp \mathbf{v}} \mathbf{u}\) simply by calculating the difference of two known vectors.

Let \(\mathbf{u} = \langle 2, 6 \rangle\text{.}\)

- Let \(\mathbf{v} = \langle 4, -8 \rangle\text{.}\) Find \(comp_{\mathbf{v}} \mathbf{u} \text{,}\) \(proj_{\mathbf{v}} \mathbf{u}\) and \(proj_{\perp \mathbf{v}} \mathbf{u} \text{,}\) and draw a picture to illustrate. Finally, express \(\mathbf{u}\) as the sum of two vectors where one is parallel to \(\mathbf{v}\) and the other is perpendicular to \(\mathbf{v}\text{.}\)
- Now let \(\mathbf{v} = \langle -2,4 \rangle \text{.}\) Without doing any calculations, find \(proj_{\mathbf{v}} \mathbf{u} \text{.}\) Explain your reasoning. (Hint: Refer to the picture you drew in part (a).)
- Find a vector \(\mathbf{w}\) not parallel to \(\mathbf{z} = \langle 3,4 \rangle \) such that \(proj_{\mathbf{z}} \mathbf{w}\) has length \(10\text{.}\) Note that there are infinitely many different answers.

## Summary

- The dot product of two vectors in \(\mathbb{R}^n\text{,}\) \(\mathbf{u} = \langle u_1, u_2, \ldots, u_n \rangle\) and \(\mathbf{v} = \langle v_1, v_2, \ldots, v_n \rangle\text{,}\) is the scalar
\[ \mathbf{u} \cdot \mathbf{v} = u_1v_1 + u_2v_2 + \cdots + u_nv_n. \nonumber \]
- The dot product is related to the length of a vector since \(\mathbf{u} \cdot \mathbf{u} = |\mathbf{u}|^2\text{.}\)
- The dot product provides us with information about the angle between the vectors since
\[ \mathbf{u} \cdot \mathbf{v} = |\mathbf{u}| \ |\mathbf{v}|\cos(\theta), \nonumber \]
where \(\theta\) is the angle between \(\mathbf{u}\) and \(\mathbf{v} \text{.}\)

- Two vectors are orthogonal if the angle between them is \(\pi/2\text{.}\) In terms of the dot product, the vectors \(\mathbf{u}\) and \(\mathbf{v}\) are orthogonal if and only if \(\mathbf{u} \cdot \mathbf{v} = 0\text{.}\)
- The projection of a vector \(\mathbf{u}\) in \(\mathbb{R}^n\) onto a vector \(\mathbf{v}\) in \(\mathbb{R}^n\) is the vector
\[ proj_{\mathbf{v}} \mathbf{u} = \frac{\mathbf{u} \cdot \mathbf{v}}{\mathbf{v}\cdot\mathbf{v}} \mathbf{v}. \nonumber \]