Skip to main content
Mathematics LibreTexts

3.5: The Dot Product, Length of a Vector, and the Angle between Two Vectors in Three Dimensions

  • Page ID
    125039

    \( \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 dot product of two vectors \(\overrightarrow{u}\boldsymbol{=}\left\langle u_x,\left.u_y\right\rangle \right.\) and \(\overrightarrow{v}\boldsymbol{=}\left\langle v_x,\left.v_y\right\rangle \right.\) in two dimensions is nicely extended to three dimensions.

    Definition: Dot Product of two Vectors

    The dot product of vectors \(\vec{u}=\left\langle u_x, u_y, u_z\right\rangle\) and \(\vec{v}=\left\langle v_x, v_y, v_z\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+u_z v_z \nonumber \]

    Since \(u_x,\ u_y,\ {u_z,\ v}_x\), \(v_y\), and \(v_z\) are real numbers, you can see that the dot product is itself a real number and not a vector.

    Example \(\PageIndex{1}\)

    Compute the dot product of the vectors \(\overrightarrow{u}\boldsymbol{=}\left\langle 5,\left.2,\ 4\right\rangle \right.\) and \(\overrightarrow{v}\boldsymbol{=}\left\langle 3,\left.4,-7\right\rangle \right.\)

    Solution

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

    \[\overrightarrow{u}\bullet \overrightarrow{v}\boldsymbol{=}5\bullet 3\mathrm{+\ }2\bullet 4+4\bullet \left(-7\right)=15+8-28=-5 \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}\boldsymbol{=}\left\langle 5,\left.-2,\ -3\right\rangle \right.\), \(\overrightarrow{v}\boldsymbol{=}\left\langle 6,\left.4,\ 1\right\rangle \right.\), and \(\overrightarrow{w}\boldsymbol{=}\left\langle -3,\left.7,\ -2\right\rangle \right.\),

    Solution

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

    The Length of a Vector in Three Dimensions

    The length (magnitude) of a vector in two dimensions is nicely extended to three dimensions.

    The dot product of a vector 𝑣\(\vec{v}=\left\langle v_x, v_y\right\rangle\) with itself gives the length of the vector. \[\|\vec{v}\|=\sqrt{v_x^2+v_y^2} \nonumber \]

    You can see that the length of the vector is the square root of the sum of the squares of each of the vector’s components. The same is true for the length of a vector in three dimensions.

    Definition: Length of a Vector in Three Dimensions

    The dot product of a vector \(\vec{v}=\left\langle v_x, v_y, v_z\right\rangle\) with itself gives the length of the vector. \[\|\vec{v}\|=\sqrt{v_x^2+v_y^2+v_z^2} \nonumber \]

    Example \(\PageIndex{3}\)

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

    Solution

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

    Using \(\|\overrightarrow{v}\|=\sqrt{{v_x}^2+{v_y}^2+\ {v_z}^2}\), we get

    \[\begin{gathered}
    \|\vec{v}\|=\sqrt{4^2+2^2+6^2} \\
    \|\vec{v}\|=\sqrt{56} \\
    \|\vec{v}\|=\sqrt{4 \cdot 14} \\
    \|\vec{v}\|=\sqrt{4} \cdot \sqrt{14} \\
    \|\vec{v}\|=2 \sqrt{14}
    \end{gathered} \nonumber \]

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

    The Angle between two Vectors

    The formula for the angle between two vectors in two dimensions is nicely extended to three dimensions.

    Definition: Angle between two Vectors in 3-Dimensions

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

    \[\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}\|} \nonumber \]

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

    Example \(\PageIndex{4}\)

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

    Solution

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

    \[\begin{gathered}
    \theta=\cos ^{-1} \frac{\langle 5,-3,-1\rangle \cdot\langle 2,4,-5\rangle}{\sqrt{5^2+(-3)^2+(-1)^2} \cdot \sqrt{2^2+4^2+(-5)^2}} \\
    \theta=\cos ^{-1} \frac{5 \cdot 2+(-3) \cdot 4+(-1) \cdot(-5)}{\sqrt{25+9+1} \cdot \sqrt{4+16+25}} \\
    \theta=\cos ^{-1} \frac{3}{\sqrt{35} \cdot \sqrt{45}} \\
    \theta=85.66
    \end{gathered} \nonumber \]

    We conclude that the angle between these two vectors is close to 85.7\(\mathrm{{}^\circ}\) rounded to one decimal place.

    Using Technology

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

    Go to www.wolframalpha.com.

    To find the magnitude (length) of the vector \(\overrightarrow{v}\boldsymbol{=}\left\langle 4,\left.2,\ 4\right\rangle ,\right.\) enter magnitude of \(\mathrm{<}\)4, 2, 4\(\mathrm{>}\) in the entry field. Wolframalpha tells you what it thinks you entered, then tells you its answer. In this case, \(\left\|\overrightarrow{v}\right\|=6\).

    This screenshot from WolframAlpha shows a calculation of the magnitude of <4,2,4. The result is 6." src="/@api/deki/files/97445/clipboard_e5b9b6fa9319843040ab3d357fd7e33ef.png">

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

    This screenshot from WolframAlpha shows the calculation of the angle between vectors <5, negative 3, negative 1 and <2,4, negative 5>. The result is 85.6647 degrees." src="/@api/deki/files/97446/clipboard_ecd5ac2462c48e45c3c2106a9f3324bd9.png">

    Try These

    Exercise \(\PageIndex{1}\)

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

    Answer

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

    Exercise \(\PageIndex{2}\)

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

    Answer

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

    Exercise \(\PageIndex{3}\)

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

    Answer

    \(\sqrt{101}\)

    Exercise \(\PageIndex{4}\)

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

    Answer

    \(5\)

    Exercise \(\PageIndex{5}\)

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

    Answer

    \(63.6{}^\circ\)

    Exercise \(\PageIndex{6}\)

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

    Answer

    \(90{}^\circ\)


    • Was this article helpful?