Skip to main content

Section 3.1 The Dot Product and the Angle between Two Vectors

Consider two vectors \(\mathbf u\) and \(\mathbf v\text{,}\) and let \(\mathbf w = \mathbf u - \mathbf v\text{,}\) as shown in FigureΒ 3.1. By the law of cosines,
\begin{equation} \|\mathbf w\|^2 = \|\mathbf u\|^2 + \|\mathbf v\|^2 - 2\|\mathbf u\|\|\mathbf v\|\cos\theta.\tag{3.1} \end{equation}
Diagram Exploration Keyboard Controls
Key Action
Enter, A Activate keyboard driven exploration
B Activate menu driven exploration
Escape Leave exploration mode
Cursor down Explore next lower level
Cursor up Explore next upper level
Cursor right Explore next element on level
Cursor left Explore previous element on level
X Toggle expert mode
W Extra details if available
Space Repeat speech
M Activate step magnification
Comma Activate direct magnification
N Deactivate magnification
Z Toggle subtitles
C Cycle contrast settings
T Monochrome colours
L Toggle language (if available)
K Kill current sound
Y Stop sound output
O Start and stop sonification
P Repeat sonification output
Figure 3.1. The vectors \(\mathbf u\text{,}\) \(\mathbf v\text{,}\) and \(\mathbf w = \mathbf u - \mathbf v\text{,}\) together with the angle \(\theta\) between \(\mathbf u\) and \(\mathbf v\text{.}\)

Proof.

Watch the video below for a proof of the law of cosines using vectors.
Figure 3.2. Proving the law of cosines: drop a perpendicular from the tip of \(\mathbf u\) and apply the Pythagorean theorem to the right triangle whose hypotenuse is \(\mathbf w = \mathbf u - \mathbf v\text{.}\)
Writing \(\mathbf u = \langle u_1, u_2, u_3\rangle\) and \(\mathbf v = \langle v_1, v_2, v_3\rangle\text{,}\) note that \(\mathbf w = \mathbf u - \mathbf v\text{,}\) and hence
\begin{equation} \begin{aligned} \|\mathbf w\|^2 \amp = \|\mathbf u - \mathbf v\|^2 \\ \amp = (u_1-v_1)^2 + (u_2-v_2)^2 + (u_3-v_3)^2 \\ \amp = (u_1^2+u_2^2+u_3^2) + (v_1^2+v_2^2+v_3^2) \\ \amp \qquad - 2(u_1v_1+u_2v_2+u_3v_3). \end{aligned}\tag{3.2} \end{equation}
Also, from the law of cosines in (3.1) we have
\begin{equation} \|\mathbf w\|^2 = (u_1^2+u_2^2+u_3^2) + (v_1^2+v_2^2+v_3^2) - 2\|\mathbf u\|\|\mathbf v\|\cos\theta.\tag{3.3} \end{equation}
From (3.2) and (3.3), it follows that \(u_1v_1+u_2v_2+u_3v_3 = \|\mathbf u\|\|\mathbf v\|\cos\theta\text{,}\) and therefore the angle between the two vectors \(\mathbf u\) and \(\mathbf v\) can be evaluated using the following equation.

Definition 3.4 Dot Product.

The term \(u_1v_1+u_2v_2+u_3v_3\) in the numerator of (3.4) is known as the dot product of the two vectors \(\mathbf u = \langle u_1,u_2,u_3\rangle\) and \(\mathbf v = \langle v_1,v_2,v_3\rangle\text{,}\) and is denoted \(\mathbf u \cdot \mathbf v\text{.}\)
\begin{equation} \mathbf u \cdot \mathbf v = u_1v_1+u_2v_2+u_3v_3.\tag{3.5} \end{equation}

Example 3.5 Computing a dot product.

Let \(\mathbf u = \langle 1,2,3\rangle\) and \(\mathbf v = \langle -2,0,4\rangle\text{.}\) Compute \(\mathbf u \cdot \mathbf v\text{,}\) and use it to find the angle between \(\mathbf u\) and \(\mathbf v\text{.}\)
Solution.
Multiply the corresponding components and add:
\begin{equation*} \mathbf u \cdot \mathbf v = (1)(-2) + (2)(0) + (3)(4) = -2 + 0 + 12 = 10. \end{equation*}
Since the dot product is positive, the angle between the two vectors is acute. To find it, use (3.4):
\begin{equation*} \begin{aligned} \|\mathbf u\| \amp = \sqrt{1+4+9} = \sqrt{14} \\ \|\mathbf v\| \amp = \sqrt{4+0+16} = \sqrt{20} \\ \cos\theta \amp = \frac{\mathbf u \cdot \mathbf v}{\|\mathbf u\|\|\mathbf v\|} = \frac{10}{\sqrt{14}\,\sqrt{20}} \approx 0.5976 \\ \theta \amp = \cos^{-1}(0.5976) \approx 0.930 \text{ radians} \approx 53.3^{\circ}. \end{aligned} \end{equation*}

Remark 3.6 Orthogonal vectors.

If the two vectors \(\mathbf u\) and \(\mathbf v\) are orthogonal, then \(\theta = \pi/2\text{,}\) which means \(\mathbf u \cdot \mathbf v = 0\text{.}\) Conversely, if \(\mathbf u\) and \(\mathbf v\) are two vectors such that \(\mathbf u \cdot \mathbf v = 0\text{,}\) then \(\mathbf u\) and \(\mathbf v\) are orthogonal.
\begin{equation} \mathbf u \cdot \mathbf v = 0 \iff \mathbf u \perp \mathbf v.\tag{3.6} \end{equation}

Example 3.7 A right triangle detected with the dot product.

Consider the triangle with vertices \(A(1,-1)\text{,}\) \(B(1,1)\text{,}\) and \(C(2,0)\text{.}\) Show that this is a right triangle using the dot product.
Solution.
\begin{equation*} \begin{aligned} \vec{CA} \amp = \langle 1-2,\,-1-0\rangle = \langle -1,-1\rangle \\ \vec{CB} \amp = \langle 1-2,\,1-0\rangle = \langle -1,1\rangle \\ \vec{CA}\cdot\vec{CB} \amp = 1 - 1 = 0 \implies \vec{CA} \perp \vec{CB}. \end{aligned} \end{equation*}
Diagram Exploration Keyboard Controls
Key Action
Enter, A Activate keyboard driven exploration
B Activate menu driven exploration
Escape Leave exploration mode
Cursor down Explore next lower level
Cursor up Explore next upper level
Cursor right Explore next element on level
Cursor left Explore previous element on level
X Toggle expert mode
W Extra details if available
Space Repeat speech
M Activate step magnification
Comma Activate direct magnification
N Deactivate magnification
Z Toggle subtitles
C Cycle contrast settings
T Monochrome colours
L Toggle language (if available)
K Kill current sound
Y Stop sound output
O Start and stop sonification
P Repeat sonification output
Figure 3.8. The triangle with vertices \(A(1,-1)\text{,}\) \(B(1,1)\text{,}\) \(C(2,0)\text{,}\) together with the vectors \(\vec{CA}\) and \(\vec{CB}\) meeting at a right angle at \(C\text{.}\)

Example 3.9 The remaining angles of the triangle.

For the triangle of ExampleΒ 3.7 (shown again in FigureΒ 3.8), calculate the remaining angles.
Solution.
For the angle between the sides \(\vec{AC}\) and \(\vec{AB}\text{,}\) we have
\begin{equation*} \begin{aligned} \vec{AC} \amp = \langle 2-1,\,0+1\rangle = \langle 1,1\rangle \implies \|\vec{AC}\| = \sqrt2 \\ \vec{AB} \amp = \langle 1-1,\,1+1\rangle = \langle 0,2\rangle \implies \|\vec{AB}\| = 2 \\ \vec{AB}\cdot\vec{AC} \amp = 0 + 2 = 2 \\ \cos\theta \amp = \frac{\vec{AB}\cdot\vec{AC}}{\|\vec{AB}\|\|\vec{AC}\|} = \frac{2}{2\sqrt2} = \frac{1}{\sqrt2} \implies \theta = \frac{\pi}{4}. \end{aligned} \end{equation*}

Properties of the Dot Product.

Proof.

Write \(\mathbf u = \langle u_1,u_2,u_3\rangle\text{,}\) \(\mathbf v = \langle v_1,v_2,v_3\rangle\text{,}\) and \(\mathbf w = \langle w_1,w_2,w_3\rangle\text{.}\) Each property follows from (3.5) together with the corresponding property of real numbers.
  1. Multiplication of real numbers is commutative, so
    \begin{equation*} \mathbf u \cdot \mathbf v = u_1v_1+u_2v_2+u_3v_3 = v_1u_1+v_2u_2+v_3u_3 = \mathbf v \cdot \mathbf u. \end{equation*}
  2. Since \(c\mathbf u = \langle cu_1,cu_2,cu_3\rangle\text{,}\)
    \begin{equation*} \begin{aligned} (c\mathbf u)\cdot \mathbf v \amp = cu_1v_1+cu_2v_2+cu_3v_3 \\ \amp = c(u_1v_1+u_2v_2+u_3v_3) = c(\mathbf u \cdot \mathbf v), \end{aligned} \end{equation*}
    and the same computation applied to \(c\mathbf v = \langle cv_1,cv_2,cv_3\rangle\) gives \(\mathbf u \cdot (c\mathbf v) = c(\mathbf u \cdot \mathbf v)\text{.}\)
  3. Adding componentwise and then distributing,
    \begin{equation*} \begin{aligned} \mathbf u \cdot (\mathbf v + \mathbf w) \amp = u_1(v_1+w_1) + u_2(v_2+w_2) + u_3(v_3+w_3) \\ \amp = (u_1v_1+u_2v_2+u_3v_3) + (u_1w_1+u_2w_2+u_3w_3) \\ \amp = \mathbf u \cdot \mathbf v + \mathbf u \cdot \mathbf w. \end{aligned} \end{equation*}
  4. Taking \(\mathbf v = \mathbf u\) in (3.5), and recalling that \(\|\mathbf u\| = \sqrt{u_1^2+u_2^2+u_3^2}\text{,}\)
    \begin{equation*} \mathbf u \cdot \mathbf u = u_1^2+u_2^2+u_3^2 = \left(\sqrt{u_1^2+u_2^2+u_3^2}\right)^2 = \|\mathbf u\|^2. \end{equation*}
  5. Every component of \(\mathbf 0\) is zero, so \(\mathbf 0 \cdot \mathbf u = 0u_1+0u_2+0u_3 = 0\text{.}\)
You have attempted of activities on this page.