Skip to main content
Mathematics LibreTexts

9.3: Dot Product

  • Page ID
    107856
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Motivating Questions
    • 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.

    Preview Activity \(\PageIndex{1}\)

    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?

    fig_9_3_preview_1.svg

    Figure \(\PageIndex{1}\). For part (d)

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

    fig_9_3_preview_1.svg

    Figure \(\PageIndex{2}\). For part (e)

    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}\)?

    fig_9_3_preview_2.svg

    Figure \(\PageIndex{3}\). For part (f)

    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{.}\)

    Definition \(\PageIndex{4}\)

    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

    \[ \langle 3, 0, 1 \rangle\cdot\langle -2, 1, 4\rangle = 3\cdot(-2) + 0\cdot1 + 1\cdot4 = -6 + 0 + 4 = -2. \nonumber \]

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

    Activity \(\PageIndex{2}\)

    Determine each of the following.

    1. \(\langle 1, 2, -3 \rangle \cdot \langle 4, -2, 0 \rangle\text{.}\)
    2. \(\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.

    Properties of the dot product

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

    1. \(\mathbf{u} \cdot \mathbf{v} = \mathbf{v} \cdot \mathbf{u}\) (the dot product is commutative), and
    2. \((\mathbf{u} + \mathbf{v}) \cdot \mathbf{w} = (\mathbf{u} \cdot \mathbf{w}) + (\mathbf{v} \cdot \mathbf{w})\text{.}\)
    3. 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:

    \[ \mathbf{u} \cdot \mathbf{u} = \langle u_1,u_2,\ldots,u_n \rangle \cdot \langle u_1,u_2,\ldots,u_n \rangle = u_1^2 + u_2^2 + \ldots + u_n^2 = |\mathbf{u}|^2. \nonumber \]

    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{.}\)

    fig_9_3_angle_1.svg fig_9_3_angle_2.svg

    Figure \(\PageIndex{4}\). Left: The angle between \(\mathbf{u}\) and \(\mathbf{v}\text{.}\) Right: The triangle formed by \(\mathbf{u} \text{,}\) \(\mathbf{v} \text{,}\) and \(\mathbf{u} - \mathbf{v} \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:

    \begin{align*} |\mathbf{u}-\mathbf{v}|^2 =\mathstrut & |\mathbf{u}|^2 + |\mathbf{v}|^2 - 2|\mathbf{u}||\mathbf{v}|\cos(\theta)\\[4pt] (\mathbf{u}-\mathbf{v})\cdot(\mathbf{u}-\mathbf{v}) =\mathstrut & \mathbf{u} \cdot \mathbf{u} + \mathbf{v} \cdot \mathbf{v} - 2|\mathbf{u}||\mathbf{v}|\cos(\theta)\\[4pt] \mathbf{u} \cdot (\mathbf{u}-\mathbf{v}) - \mathbf{v}\cdot(\mathbf{u}-\mathbf{v})=\mathstrut & \mathbf{u}\cdot\mathbf{u} + \mathbf{v} \cdot \mathbf{v} - 2|\mathbf{u}| |\mathbf{v}|\cos(\theta)\\[4pt] \mathbf{u} \cdot \mathbf{u} - 2\mathbf{u} \cdot \mathbf{v} + \mathbf{v} \cdot \mathbf{v} =\mathstrut & \mathbf{u} \cdot \mathbf{u} + \mathbf{v} \cdot \mathbf{v} - 2|\mathbf{u}||\mathbf{v}|\cos(\theta)\\[4pt] -2\mathbf{u} \cdot \mathbf{v} =\mathstrut & -2|\mathbf{u}||\mathbf{v}|\cos(\theta)\\[4pt] \mathbf{u} \cdot \mathbf{v} =\mathstrut & |\mathbf{u}||\mathbf{v}|\cos(\theta). \end{align*}

    To summarize, we have the important relationship

    \[ \mathbf{u} \cdot \mathbf{v} = u_1v_1+u_2v_2 + \ldots + u_nv_n = |\mathbf{u}||\mathbf{v}|\cos(\theta).\label{E_9_3_dot_angle}\tag{\(\PageIndex{1}\)} \]

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

    \[ \theta = \cos^{-1}\left(\frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{u}||\mathbf{v}|}\right). \nonumber \]

    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.

    Activity \(\PageIndex{3}\)

    Determine each of the following.

    1. The length of the vector \(\mathbf{u}=\langle 1,2,-3\rangle\) using the dot product.
    2. 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.
    3. 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.
    4. 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?
    5. 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?
    6. 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.

    The dot product and orthogonality

    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

    \begin{align*} \cos(\theta) \gt 0 \mathstrut & \ \ \ \text{ if } \theta \text{ is an acute angle,}\\[4pt] \cos(\theta) = 0 \mathstrut & \ \ \ \text{ if } \theta \text{ is a right angle, and}\\[4pt] \cos(\theta) \lt 0 \mathstrut & \ \ \ \text{ if } \theta \text{ is an obtuse angle,} \end{align*}

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

    \begin{align*} \mathbf{u} \cdot \mathbf{v} \gt 0 \mathstrut & \ \ \ \text{ if } \theta \text{ is an acute angle,}\\[4pt] \mathbf{u} \cdot \mathbf{v} = 0 \mathstrut & \ \ \ \text{ if } \theta \text{ is a right angle, and}\\[4pt] \mathbf{u} \cdot \mathbf{v} \lt 0 \mathstrut & \ \ \ \text{ if } \theta \text{ is an obtuse angle.} \end{align*}

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

    fig_9_3_orientations.svg

    Figure \(\PageIndex{5}\). The orientation of vectors

    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{.}\)

    fig_9_3_work_1.svg

    Figure \(\PageIndex{6}\). A force \(\mathbf{F}\) displacing an object.

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

    \[ W = \mathbf{F}\cdot\overrightarrow{AB} = |\mathbf{F}||\overrightarrow{AB}|\cos(\theta). \nonumber \]

    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.

    Activity \(\PageIndex{4}\)

    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

    fig_9_3_projection_1.svgfig_9_3_projection_2.svg 

    Figure \(\PageIndex{7}\). Left: \(proj_{\mathbf{v}} \mathbf{u} \text{.}\) Right: \(proj_{\mathbf{v}} \mathbf{u}\) when \(\theta > \frac\pi2\text{.}\)

    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

    \[ \mathbf{u} = proj_{\mathbf{v}}\mathbf{u} + proj_{\perp \mathbf{v}}\mathbf{u},\label{E_9_3_proj}\tag{\(\PageIndex{2}\)} \]

    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

    \begin{align*} \mathbf{u} \cdot \mathbf{v} =\mathstrut & (proj_{\mathbf{v}}\mathbf{u} + proj_{\perp \mathbf{v}}\mathbf{u})\cdot \mathbf{v}\\[4pt] =\mathstrut & (proj_{\mathbf{v}}\mathbf{u})\cdot \mathbf{v} + (proj_{\perp \mathbf{v}} \mathbf{u})\cdot \mathbf{v}\\[4pt] =\mathstrut & (proj_{\mathbf{v}}\mathbf{u})\cdot\mathbf{v}. \end{align*}

    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

    \[ \mathbf{u} \cdot \mathbf{v} =(proj_{\mathbf{v}}\mathbf{u})\cdot \mathbf{v} = s \mathbf{v} \cdot \mathbf{v}, \nonumber \]

    which means that

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

    and hence

    \[ proj_{\mathbf{v}}\mathbf{u} = \frac{\mathbf{u} \cdot \mathbf{v}}{\mathbf{v} \cdot \mathbf{v}}\mathbf{v} = \frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{v}|^2}\mathbf{v} \nonumber \]

    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

    \[ proj_{\mathbf{v}}\mathbf{u} = \frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{v}|^2} \mathbf{v} = \frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{v}|} \frac{\mathbf{v}}{|\mathbf{v}|}= comp_{\mathbf{v}}\mathbf{u} \frac{\mathbf{v}}{|\mathbf{v}|}, \nonumber \]

    so that

    \[ comp_{\mathbf{v}}\mathbf{u} = \frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{v}|}. \nonumber \]
    The dot product and projections

    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

    \[ comp_{\mathbf{v}} \mathbf{u} = \frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{v}|}, \nonumber \]

    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

    \[ \mathbf{u} = proj_{\mathbf{v}} \mathbf{u} + proj_{\perp \mathbf{v}} \mathbf{u}, \nonumber \]

    it follows that

    \[ proj_{\perp \mathbf{v}} \mathbf{u} = \mathbf{u} - proj_{\mathbf{v}} \mathbf{u}. \nonumber \]

    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.

    Activity \(\PageIndex{5}\)

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

    1. 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{.}\)
    2. 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).)
    3. 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 \]

    This page titled 9.3: Dot Product is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Matthew Boelkins, David Austin & Steven Schlicker (ScholarWorks @Grand Valley State University) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?