Skip to main content
\(\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}}\)
Mathematics LibreTexts

8.5: Dot Product

  • Page ID
    13879
  • \( \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}}\)

    Now that we can add, subtract, and scale vectors, you might be wondering whether we can multiply vectors. It turns out there are two different ways to multiply vectors, one which results in a number, and one which results in a vector. In this section, we'll focus on the first, called the dot product or scalar product, since it produces a single numeric value (a scalar). We'll begin with some motivation.

    In physics, we often want to know how much of a force is acting in the direction of motion. To determine this, we need to know the angle between direction of force and the direction of motion. Likewise, in computer graphics, the lighting system determines how bright a triangle on the object should be based on the angle between object and the direction of the light. In both applications, we're interested in the angle between the vectors, so let's start there.

    Suppose we have two vectors,

    \[\vec{a} = \langle a_1, a_2 \rangle\quad \text{and} \quad \vec{b} = \langle b_1, b_2 \rangle.\nonumber\]

    Using our polar coordinate conversions, we could write

    \[\vec{a} = \langle |\vec{a}|\cos(\alpha), |\vec{a}|\sin(\alpha) \rangle\nonumber\]

    and

    \[\vec{b} = \langle |\vec{b}|\cos(\beta), |\vec{b}|\sin(\beta) \rangle\nonumber\]

    Now, if we knew the angle \(\alpha\) and \(\beta\), we wouldn't have much work to do = the angle between the vectors would be \(\theta = \alpha = \beta\).

    屏幕快照 2019-07-22 下午1.50.29.png

    While we certainly could use some inverse tangents to find the two angles, it would be great if we could find a way to determine the angle between the vector just from the vector components.

    To help us manipulate \(\theta = \alpha - \beta\), we might try introducing a trigonometric function:

    \[\cos(\theta) = \cos(\alpha - \beta)\nonumber\]

    Now we can apply the difference of angles identity

    \[\cos(\theta) = \cos(\alpha) \cos(\beta) + \sin(\alpha) \sin(\beta)\nonumber\]

    Now \(a_1 = |\vec{a}|\cos(\alpha)\), so \(\cos(\alpha) = \dfrac{a_1}{|\vec{a}|}\), and likewise for the other three components.

    Making those substitutions,

    \[\cos(\theta) = \dfrac{a_1}{|\vec{a}|} \dfrac{b_1}{|\vec{b}|} + \dfrac{a_2}{|\vec{a}|} \dfrac{b_2}{|\vec{b}|} = \dfrac{a_1 b_1 + a_2 b_2}{|\vec{a}| |\vec{b}|}\nonumber\]
    \[|\vec{a}||\vec{b}| \cos(\theta) = a_1 b_1 + a_2 b_2\nonumber\]

    Notice the expression on the right is a very simple calculation based on the components of the vectors. It comes up so frequently we define it to be the dot product of the two vectors, notated by a dot. This gives us two definitions of the dot product.

    DefinitionS OF THE DOT PRODUCT

    \[\vec{a} \cdot \vec{b} = a_1 b_1 + a_2 b_2\quad\text{ Component definition}\]

    \[\vec{a} \cdot \vec{b} = |\vec{a}| |\vec{b}| \cos(\theta)\quad\text{ Geometric definition}\]

    The first definition, \(\vec{a} \cdot \vec{b} = a_1 b_1 + a_2 b_2\), gives us a simple way to calculate the dot product from components. The second definition, \(\vec{a} \cdot \vec{b} = |\vec{a}| |\vec{b}| \cos(\theta)\), gives us a geometric interpretation of the dot product, and gives us a way to find the angle between two vectors, as we desired.

    Example \(\PageIndex{1}\)

    Find the dot product \(\langle 3, -2 \rangle \cdot \langle 5, 1 \rangle\).

    Solution

    Using the first definition, we can calculate the dot product by multiplying the \(x\) components and adding that to the product of the \(y\) components.

    \[\langle 3, -2 \rangle \cdot \langle 5, 1 \rangle = (3)(5) + (-2) (1) = 15 - 2 = 13\nonumber\]

    Example \(\PageIndex{2}\)

    find the dot product of the two vectors shown.

    Solution

    We can immediately see that the magnitudes of the two vectors are 7 and 6, We quickly calc屏幕快照 2019-07-22 下午2.08.01.pngulate that the angle between the vectors is \(150^{\circ}\). Using the geometric definition of the dot product,

    \[\vec{a} \cdot \vec{b} = |\vec{a}| |\vec{b}| \cos(\theta) = (6)(7) \cos(150^{\circ}) = 42 \cdot \dfrac{\sqrt{3}}{2} = 21\sqrt{3}\nonumber\]

    Exercise \(\PageIndex{1}\)

    Calculate the dot product \(\langle -7, 3 \rangle \cdot \langle -2, -6 \rangle \)

    Answer

    \[\langle -7, 3 \rangle \cdot \langle -2, -6 \rangle = (-7)(-2) + (3) (-6) = 14 - 18 = -4\nonumber\]

    Now we can return to our goal of finding the angle between vectors.

    Example \(\PageIndex{3}\)

    屏幕快照 2019-07-22 下午2.09.17.pngAn object is being pulled up a ramp in the direction \(\langle 5,1 \rangle\) by a rope pulling in the direction \(\langle 4,2 \rangle\). What is the angle between the rope and the ramp?

    Solution

    Using the component form, we can easily calculate the dot product.

    \[\vec{a} \cdot \vec{b} = \langle 5, 1 \rangle \cdot \langle 4, 2 \rangle = (5)(4) + (1)(2) = 20 + 2 = 22\nonumber\]

    We can also calculate the magnitude of each vector.

    \[|\vec{a}| = \sqrt{5^2 + 1^2} = \sqrt{26}\quad |\vec{b}| = \sqrt{4^2 + 2^2} = \sqrt{20}\nonumber\]

    Substituting these values into the geometric definition, we can solve for the angle between the vectors.

    \[\vec{a} \cdot \vec{b} = |\vec{a}| |\vec{b}| \cos(\theta)\nonumber\]
    \[22 = \sqrt{26}{20} \cos (\theta)\nonumber\]
    \[\theta = \cos^{-1} (\dfrac{22}{\sqrt{26} \sqrt{20}}) \approx 15. 255^{\circ}\nonumber\]

    Example \(\PageIndex{4}\)

    Calculate the angle between the vectors \(\langle 6, 4 \rangle\) and \(\langle -2, 3 \rangle\).

    Solution

    Calculating the dot product, \(\langle 6, 4 \rangle \cdot \langle -2, 3 \rangle = (6)(-2) + (4)(3) = -12 + 12 = 0\)

    We don't even need to calculate the magnitudes in this case since the dot product is 0.

    \[\vec{a} \cdot \vec{b} = |\vec{a}| |\vec{b}| \cos(\theta)\nonumber\]
    \[0 = |\vec{a}| |\vec{b}| \cos(\theta)\nonumber\]
    \[\theta = \cos^{-1} (\dfrac{0}{|\vec{a}||\vec{b}|}) = \cos^{-1} (0) = 90^{\circ}\nonumber\]

    With the dot product equaling zero, as in the last example, the angle between the vectors will always be \(90^{\circ}\), indicating that the vectors are orthogonal, a more general way of saying perpendicular. This gives us a quick way to check if vectors are orthogonal. Also, if the dot product is positive, then the inside of the inverse cosine will be positive, giving an angle less than \(90^{\circ}\). A negative dot product will then lead to an angle larger than \(90^{\circ}\).

    SIGN OF THE DOT PRODUCT

    If the dot product is:

    Zero The vectors are orthogonal (perpendicular).

    Positive The angle between the vectors is less than \(90^{\circ}\)

    Negative The angle between the vectors is greater than \(90^{\circ}\)

    Exercise \(\PageIndex{2}\)

    Are the vectors \(\langle -7, 3 \rangle\) and \(\langle -2, -6 \rangle \) orthogonal? If not, find the angle between them.

    Answer

    In the previous Exercise, we found the dot product was -4, so the vectors are not orthogonal. The magnitudes of the vectors are \(\sqrt{(-7)^2 + 3^2} = \sqrt{58}\) and \(\sqrt{(-2)^2 + 6^2} = \sqrt{40}\). The angle between the vectors will be \(\theta = \cos^{-1} (\dfrac{-4}{\sqrt{58}\sqrt{40}}) \approx 94.764^{\circ}\)

    Projections

    In addition to finding the angle between vectors, sometimes we want to know how much one vector points in the di屏幕快照 2019-07-22 下午2.21.04.pngrection of another. For example, when pulling an object up a ramp, we might want to know how much of the force is exerted in the direction of motion. To determine this we can use the idea of a projection.

    屏幕快照 2019-07-22 下午2.21.37.png

    In the picture above, \(\vec{u}\) is a projection of \(\vec{a}\) onto \(\vec{b}\). In other words, it is the portion of \(\vec{a}\) that points in the same direction as \(\vec{b}\).

    To find the length of \(\vec{u}\), we could notice that it is one side of a right triangle. If we define \(\theta\) to be the angle between \(\vec{a}\) and \(\vec{u}\), then \(\cos(\theta) = \dfrac{|\vec{u}|}{|\vec{a}|}\), so \(|\vec{a}|\cos (\theta)= |\vec{u}|\).

    While we could find the angle between the vectors to determine this magnitude, we could skip some steps by using the dot product directly. Since \(\vec{a} \cdot \vec{b} = |\vec{a}| |\vec{b}| \cos(\theta)\), \(|\vec{a}| \cos(\theta) = \dfrac{\vec{a} \cdot \vec{b}}{|vec{b}|}\). Using this, we can rewrtie \(|\vec{u}| = |\vec{a}| \cos(\theta)\) as \(|\vec{u}| = \dfrac{\vec{a} \cdot \vec{b}}{|\vec{b}|}\). This gives us the length of the projection, sometimes denoted as \(comp_{\vec{b}}\vec{a} = |\vec{u}| = \dfrac{\vec{a} \cdot \vec{b}}{|\vec{b}|}\).

    To find the vector \(\vec{u}\) itself, we could first scale \(\vec{b}\) to a unit vector with length 1: \(\dfrac{\vec{b}}{|\vec{b}|}\).

    Multiplying this by the length of the projection will give a vector in the direction of \(\vec{b}\) but with the correct length.

    \[proj_{\vec{b}} \vec{a} = |\vec{u}| \dfrac{\vec{b}}{|\vec{b}|} = (\dfrac{\vec{a} \cdot \vec{b}}{|\vec{b}|}) \dfrac{\vec{b}}{|\vec{b}|} = (\dfrac{\vec{a} \cdot \vec{b}}{|\vec{b}|^2}) \vec{b}\nonumber\]

    PROJECTION VECTOR

    The projection of vector \(\vec{a}\) onto \(\vec{b}\) is \[proj_{\vec{b}} \vec{a} = (\dfrac{\vec{a} \cdot \vec{b}}{|\vec{b}|^2}) \vec{b}\]

    The magnitude of the projection is \[comp_{\vec{b}} \vec{a} = \dfrac{\vec{a} \cdot \vec{b}}{|vec{b}|}\]

    Example \(\PageIndex{5}\)

    Find the projection of the vector \(\langle 3, -2 \rangle\) onto the vector \(\langle 8, 6 \rangle\).

    Solution

    We will need to know the dot product of the vectors and the magnitude of the vector we are projecting onto.屏幕快照 2019-07-22 下午2.37.43.png

    \[\langle 3, -2 \rangle \cdot \langle 8, 6 \rangle = (3)(8) + (-2)(6) = 24 - 12 = 12\nonumber\]
    \[|\langle 8, 6 \rangle| = \sqrt{8^2 + 6^2} = \sqrt{64 + 36} = \sqrt{100} = 10\nonumber\]

    The magnitude of the projection will be \(\dfrac{\langle 3, -2 \rangle \cdot \langle 8, 6 \rangle}{|\langle 8, 6 \rangle|} = \dfrac{12}{10} = \dfrac{6}{5}\).

    To find the projection vector itself, we would multiply that magnitude by \(\langle 8,6 \rangle\) scaled to a unit vector.

    \[\dfrac{6}{5} \dfrac{\langle 8, 6 \rangle}{|\langle 8, 6 \rangle|} = \dfrac{6}{5} \dfrac{\langle 8, 6 \rangle}{10} = \dfrac{6}{50} \langle 8, 6 \rangle = \langle \dfrac{48}{50}, \dfrac{36}{50} \rangle = \langle \dfrac{24}{25}, \dfrac{18}{25} \rangle\nonumber\]

    Based on the sketch above, this answer seems reasonable.

    Exercise \(\PageIndex{3}\)

    Find the component of the vector \(\langle -4, 4 \rangle \) that is \(orthogonal\) to the vector \(\langle -8, 4\rangle\)

    Answer

    We want to find the component of \(\langle -3, 4 \rangle\) that is \(orthogonal\) to the vector \(\langle -8, 4 \rangle\). In the屏幕快照 2019-07-22 下午3.35.16.png picture to the right, that component is vector \(\vec{v}\). Notice that \(\vec{u} + \vec{v} = \vec{a}\), so if we can find the projection vector, we can find \(\vec{v}\).

    \[\vec{u} = proj_{\vec{b}} \vec{a} = (\dfrac{\vec{a} \cdot \vec{b}}{|\vec{b}|^2}) \vec{b} = (\dfrac{\langle -3, 4 \rangle \cdot \langle -8, 4 \rangle}{(\sqrt{(-8)^2 + 4^2})^2}) \langle -8, 4 \rangle = \dfrac{}{} \langle -8, 4 \rangle = \langle -4, 2 \rangle\nonumber\]

    Now we can solve \(\vec{u} + \vec{v} = \vec{a}\) for \(\vec{v}\).

    \[\vec{v} = \vec{a} - \vec{u} = \langle -3, 4 \rangle - \langle -4, 2 \rangle = \langle 1, 2 \rangle\nonumber\]

    Work

    In physics, when a constant force causes an object to move, the mechanical work done by that force is the product of the force and the distance the object is moved. However, we only consider the portion of force that is acting in the direction of motion.

    This is simply the magnitude of the projection of the force vector onto the distance vector, \(\dfrac{\vec{F} \cdot \vec{d}}{|\vec{d}|}\). Th屏幕快照 2019-07-22 下午2.51.27.pnge work done is the product of that component of force times the distance moved, the magnitude of the distance vector.

    \(Work = (\dfrac{\vec{F} \cdot \vec{d}}{|\vec{d}|})|\vec{d}| = \vec{F} \cdot \vec{d}\)

    It turns out that work is simply the dot product of the force vector and the distance vector.

    WORK

    When a force \(\vec{F}\) causes an object to move some distance \(\vec{d}\), the work done is \(Work = \vec{F} \cdot \vec{d}\)

    Example \(\PageIndex{6}\)

    A cart is pulled 20 feet by applying a force of 30 pounds on a rope held at a 30 degree angle. How much work is done?

    屏幕快照 2019-07-22 下午3.28.52.png

    Solution

    Since work is simply the dot product, we can take advantage of the geometric definition of the dot product in this case.

    \[Work = \vec{F} \cdot \vec{d} = |\vec{F}| \cdot |\vec{d}| \cos (\theta) = (30) (20) \cos (30^{\circ}) \approx 519.615\text{ ft-lbs}\nonumber\]

    Exercise \(\PageIndex{4}\)

    Find the work down moving an object from the point (1, 5) to (9, 14) by the force vector \(\vec{F} = \langle 3, 2 \rangle\).

    Answer

    The distance vector is \(\langle 9 - 1, 14 -5 \rangle = \langle 8, 9 \rangle\).

    The work is the dot product: \[Work = \vec{F} \cdot \vec{d} = \langle 3, 2 \rangle \cdot \langle 8, 9 \rangle = 24 + 18 = 42\nonumber\]

    Important Topics of This Section

    • Calculate Dot Product
      Using component definition
      Using geometric definition
    • Find the angle between two vectors
    • Sign of the dot product
    • Projections
    • Work