Skip to main content
Mathematics LibreTexts

2.4: The Dot Product of Two Vectors, the Length of a Vector, and the Angle Between Two Vectors

  • Page ID
    125031

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

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    The Dot Product of Two Vectors

    The length of a vector or the angle between two vectors \(\vec{u}\boldsymbol{=}\left\langle u_x,\left.u_y\right\rangle \right.\) and \(\vec{v}\boldsymbol{=}\left\langle v_x,\left.v_y\right\rangle \right.\) can be found using the dot product.

    Definition: Dot Product of Vectors

    The dot product of vectors \(\vec{u}=\left\langle u_x, u_y\right\rangle\) and \(\vec{v}=\left\langle v_x, v_y\right\rangle\) is a scalar (real number) and is defined to be \[\vec{u} \cdot \vec{v}=u_x v_x+u_y v_y \nonumber \]

    Since \(u_x,\ u_y,\ v_x\) and \(v_y\) are real numbers, you can see that the dot product is itself a real number and not a vector.

    Example \(\PageIndex{1}\)

    To compute the dot product of the vectors \(\vec{u}\boldsymbol{=}\left\langle 5,\left.2\right\rangle \right.\) and \(\vec{v}\boldsymbol{=}\left\langle 3,\left.4\right\rangle \right.\)

    Solution

    We compute: \[\overrightarrow{u}\bullet \overrightarrow{v}\boldsymbol{=}5\bullet 3\mathrm{+\ }2\bullet 4=15+8=23 \nonumber \]

    Since the dot product is a scalar, it follows the properties of real numbers.

    Properties of the Dot Product
    1. \(\vec{u} \cdot \vec{v}=\vec{v} \cdot \vec{u}\)the dot product is commutative
    2. \(\vec{u} \cdot(\vec{v}+\vec{w})=\vec{u} \cdot \vec{v}+\vec{u} \cdot \vec{w}\) the dot product distributes over vector addition
    3. \(\vec{u} \cdot \overrightarrow{0}=0\),the dot product with the zero vector \(\overrightarrow{0}\), is the scalar 0.
    4. \(\vec{u} \cdot \vec{u}=\|\vec{u}\|^2\)
    Example \(\PageIndex{2}\)

    Compute the dot product \(\overrightarrow{u}\bullet \left(\overrightarrow{v}+\overrightarrow{w}\right)=\overrightarrow{u}\bullet \overrightarrow{v}+\overrightarrow{u}\bullet \overrightarrow{w}\), where \(\overrightarrow{u}=\left\langle 5,\left.-2\right\rangle \right.\), \(\overrightarrow{v}=\left\langle 6,\left.4\right\rangle \right.\), and \(\overrightarrow{w}=\left\langle -3,\left.7\right\rangle \right.\).

    Solution

    \[\begin{align} \vec{u} \cdot(\vec{v}+\vec{w})&=\vec{u} \cdot \vec{v}+\vec{u} \cdot \vec{w} \nonumber\\
    \vec{u} \cdot(\vec{v}+\vec{w})&=\langle 5,-2\rangle \cdot\langle 6,4\rangle+\langle 5,-2\rangle \cdot\langle-3,7\rangle \nonumber \\
    &=(5 \cdot 6+(-2) \cdot 4)+(5 \cdot(-3)+(-2) \cdot 7) \nonumber \\
    &=30-8-15-14 \nonumber \\
    &=-7 \nonumber
    \end{align} \nonumber \]

    The Length of a Vector

    The length (magnitude) of a vector you know is given by \(\left\|\overrightarrow{v}\right\|=\sqrt{{v_x}^2+{v_y}^2}\). The length can also be found using the dot product. If we dot a vector \(\overrightarrow{v}=\left\langle v_x,\left.v_y\right\rangle \right.\) with itself, we get

    \[\overrightarrow{v}\bullet \overrightarrow{v}=\left\langle v_x,\left.v_y\right\rangle \right.\bullet \left\langle v_x,\left.v_y\right\rangle \right. \nonumber \] \[\overrightarrow{v}\bullet \overrightarrow{v}=v_x\bullet v_x+v_y\bullet v_y \nonumber \] \[\overrightarrow{v}\bullet \overrightarrow{v}= {v_x}^2+\ {v_y}^2 \nonumber \]

    By Vector Property 4, \(\overrightarrow{v}\bullet \overrightarrow{v}=\ {\left\|\overrightarrow{v}\right\|}^2\). This gives \({\left\|\overrightarrow{v}\right\|}^2={v_x}^2+{v_y}^2\).

    Taking the square root of each side produces

    \[\sqrt{{\|\overrightarrow{v}\|}^2}=\sqrt{{v_x}^2+{v_y}^2} \nonumber \]

    \[\|\overrightarrow{v}\|=\sqrt{{v_x}^2+{v_y}^2} \nonumber \]

    Which is the length of the vector \(\overrightarrow{v}\).

    The dot product of a vector \(\vec{v}=\left\langle v_x, v_y\right\rangle\) with itself gives the length of the vector.

    \[\begin{equation}
    \|\vec{v}\|=\sqrt{v_x^2+v_y^2}
    \end{equation} \nonumber \]

    Example \(\PageIndex{3}\)

    Use the dot product to find the length of the vector \(\overrightarrow{v}=\left[ \begin{array}{c} 2 \\ 6 \end{array} \right]\).

    Solution

    In this case, \(v_x=2\) and \(v_y=6.\)

    Using \(\|\overrightarrow{v}\|=\sqrt{{v_x}^2+{v_y}^2}\), we get \[\|\overrightarrow{v}\|=\sqrt{2^2+6^2} \nonumber \] \[\|\overrightarrow{v}\|=\sqrt{40} \nonumber \] \[\|\overrightarrow{v}\|=\sqrt{4\bullet 10} \nonumber \] \[\|\overrightarrow{v}\|=\sqrt{4}\bullet \sqrt{10} \nonumber \] \[\|\overrightarrow{v}\|=2\sqrt{10} \nonumber \]

    The length of the vector \(\overrightarrow{v}=\left[ \begin{array}{c} 2 \\ 6 \end{array} \right]\) is \(2\sqrt{10}\) units.

    The Angle between two Vectors

    The dot product and elementary trigonometry can be used to find the angle \(\theta\) between two vectors.

    Definition: Angle between two Vectors

    If \(\theta\) is the smallest nonnegative angle between two non-zero vectors \(\vec{u}\) and \(\vec{v}\) then

    \[\begin{equation}
    \cos \theta=\frac{\vec{u} \cdot \vec{v}}{\|\vec{u}\| \cdot\|\vec{v}\|} \; \text { or } \; \theta=\cos ^{-1} \frac{\vec{u} \cdot \vec{v}}{\|\vec{u}\| \cdot\|\vec{v}\|}
    \end{equation} \nonumber \]

    \[\begin{equation}
    \text { where } \; 0 \leq \theta \leq 2 \pi \; \text { and } \; \|\vec{u}\|=\sqrt{u_x^2+u_y{ }^2} \; \text { and } \; \|\vec{v}\|=\sqrt{v_x^2+v_y{ }^2}
    \end{equation} \nonumber \]

    Diagram of an angle between two vectors. We have vectors u and v with their starting points connected together. The two vectors are separated by theta degrees.

    Example \(\PageIndex{4}\)

    Find the angle between the vectors \(\overrightarrow{u}=\left\langle 5,\left.-3\right\rangle \right.\) and \(\overrightarrow{v}=\left\langle 2,\left.4\right\rangle \right.\).

    Solution

    Using \(\theta =\ {\mathrm{cos}}^{\mathrm{-}\mathrm{1}}\frac{\overrightarrow{u}\bullet \overrightarrow{v}}{\|\overrightarrow{u}\|\bullet \|\overrightarrow{v}\|}\), we get

    \[\theta =\ {\mathrm{cos}}^{\mathrm{-}\mathrm{1}}\frac{\left\langle 5,\left.-3\right\rangle \right.\bullet \left\langle 2,\left.4\right\rangle \right.}{\sqrt{5^2+{\left(-3\right)}^2}\bullet \sqrt{2^2+4^2}} \nonumber \]

    \[\theta =\ {\mathrm{cos}}^{\mathrm{-}\mathrm{1}}\frac{5\bullet 2+\left(-3\right)\bullet 4}{\sqrt{25+9}\bullet \sqrt{4+16}} \nonumber \]

    \[\theta =\ {\mathrm{cos}}^{\mathrm{-}\mathrm{1}}\frac{-2}{\sqrt{34}\bullet \sqrt{20}} \nonumber \]

    \[\theta =94.4 \nonumber \]

    We conclude that the angle between these two vectors is close to 94.4\(\mathrm{{}^\circ}\).

    Using Technology

    We can use technology to find the angle \(\theta\) between two vectors.

    Go to www.wolframalpha.com.

    To find the angle between the vectors \(\overrightarrow{u}=\left\langle 5,\left.-3\right\rangle \right.\) and \(\overrightarrow{v}=\left\langle 2,\left.4\right\rangle \right.\), enter angle between the vectors \(\mathrm{<}\)5, -3\(\mathrm{>}\) and \(\mathrm{<}\)2, 4\(\mathrm{>}\) in the entry field. Wolframalpha tells you what it thinks you entered, then tells you its answer. In this case, \(\theta =94.4\), rounded to one decimal place.

    clipboard_e4f57b5b3fa3f7bb0165a516ad6ec50e1.png

    Try These

    Exercise \(\PageIndex{1}\)

    Find the dot product of the vectors \(\vec{u}=\langle-2,3\rangle \) and \(\vec{v}=\langle 5,-1\rangle \).

    Answer

    \(\overrightarrow{u}\bullet \overrightarrow{v}=-13\)

    Exercise \(\PageIndex{2}\)

    Find the dot product of the vectors \(\vec{u}=\langle-4,6\rangle \) and \(\vec{v}=\langle 3,2\rangle \).

    Answer

    \(\overrightarrow{u}\bullet \overrightarrow{v}=0\)

    Exercise \(\PageIndex{3}\)

    Find the length of the vector \(\vec{u}=\langle 4,-7\rangle \).

    Answer

    \(\sqrt{65}\)

    Exercise \(\PageIndex{4}\)

    Find the length of the vectors \(\vec{v}=\langle 0,5\rangle \).

    Answer

    \(5\)

    Exercise \(\PageIndex{5}\)

    Find the angle between the vectors \(\vec{u}=\langle-2,3\rangle \) and \(\vec{v}=\langle 5,-1\rangle \).

    Answer

    \(135{}^\circ\)

    Exercise \(\PageIndex{6}\)

    Find the angle between the vectors \(\vec{u}=\langle -4,6\rangle \) and \(\vec{v}=\langle 3,2\rangle \).

    Answer

    \(90{}^\circ\)


    • Was this article helpful?