The Dot Product

Given the two vectors below, their dot product \(\vec{v} \dotp \vec{w}\) is defined as below.

\[ \begin{aligned} \vec{v} &= \langle v_1, v_2 \rangle \\ \vec{w} &= \langle w_1, w_2 \rangle \end{aligned} \]

Dot Product in \(\mathbb{R}^2\)

\[ \vec{v} \dotp \vec{w} = v_1 w_1 + v_2 w_2 \]

We have discussed a variety of notations used to denote vectors. Below is the dot product stated in a different way.

\[ \begin{aligned} \mathbf{v} &= v_1\mathbf{i} + v_2\mathbf{j} \\ \mathbf{w} &= w_1\mathbf{i} + w_2\mathbf{j} \end{aligned} \]
\[ \mathbf{v} \dotp \mathbf{w} = v_1 w_1 + v_2 w_2 \]

An Example

Given the vectors \(\vec{v} = \langle 8, 9 \rangle\) and \(\vec{w} = \langle 7, -2 \rangle\), find \(\vec{v} \dotp \vec{w}\).

\[ \begin{aligned} \vec{v} \dotp \vec{w} &= v_1 w_1 + v_2 w_2 \\ &= (8)(7) + (9)(-2) \\ &= 38 \end{aligned} \]

Important: The dot product does not yield a vector! It results in a scalar. It is sometimes called the scalar product.

Given the two vectors below, their dot product \(\vec{v} \dotp \vec{w}\) is defined as below.

\[ \begin{aligned} \vec{v} &= \langle v_1, v_2, v_3 \rangle \\ \vec{w} &= \langle w_1, w_2, w_3 \rangle \end{aligned} \]

Dot Product in \(\mathbb{R}^3\)

\[ \vec{v} \dotp \vec{w} = v_1 w_1 + v_2 w_2 + v_3 w_3 \]

An Example

Given the vectors \(\mathbf{v} = 2\mathbf{i} + 8\mathbf{j} + 6\mathbf{k}\) and \(\mathbf{w} = \mathbf{i} - 2\mathbf{k}\), find \(\mathbf{v} \dotp \mathbf{w}\).

\[ \begin{aligned} \mathbf{w} &= \mathbf{i} - 2\mathbf{k} \\ &= 1\mathbf{i} + 0\mathbf{j} - 2\mathbf{k} \end{aligned} \]
\[ \begin{aligned} \mathbf{v} \dotp \mathbf{w} &= v_1 w_1 + v_2 w_2 + v_3 w_3 \\ &= (2)(1) + (8)(0) + (6)(-2) \\ &= -10 \end{aligned} \]

Given vectors \(\vec{u}\), \(\vec{v}\), and \(\vec{w}\), the following are true.

Commutative Property
\[ \vec{v} \dotp \vec{w} = \vec{w} \dotp \vec{v} \]
Zero Vector Property
\[ \vec{0} \dotp \vec{v} = 0 \]
Distributive Property
\[ \vec{u} \dotp (\vec{v} + \vec{w}) = \vec{u} \dotp \vec{v} + \vec{u} \dotp \vec{w} \]
Magnitude Property
\[ \vec{v} \dotp \vec{v} = \|\vec{v}\|^2 \]

Each of these properties can be verified by writing the vectors in components and carrying out the operations. As an example, we verify one of them below.

Verify the below property, for the vector \(\vec{v} = \langle v_1, v_2, v_3 \rangle\).

\[ \vec{v} \dotp \vec{v} = \|\vec{v}\|^2 \]

This follows by performing the operations via the components of the vectors.

\[ \|\vec{v}\| = \sqrt{v_1^2 + v_2^2 + v_3^2} \]
\[ \vec{v} \dotp \vec{w} = v_1 w_1 + v_2 w_2 + v_3 w_3 \]

Using the definition of the dot product with \(\vec{w} = \vec{v}\):

\[ \begin{aligned} \vec{v} \dotp \vec{v} &= v_1 v_1 + v_2 v_2 + v_3 v_3 \\ &= v_1^2 + v_2^2 + v_3^2 \\ &= \|\vec{v}\|^2 \end{aligned} \]

The other properties are proven in a similar way.

The angle \(\theta\), where \(0 \le \theta \le \pi\), between nonzero vectors \(\vec{v}\) and \(\vec{w}\) is given by the below formula.

Angle between Two Vectors

\[ \cos\theta = \frac{\vec{v} \dotp \vec{w}}{\|\vec{v}\|\,\|\vec{w}\|} \]
Vectors v and w drawn from the same point with the angle theta between them, and the vector v minus w going from the tip of w to the tip of v.

This follows from the Law of Cosines.

\[ c^2 = a^2 + b^2 - 2ab\cos\theta \]

In the triangle, \(a = \|\vec{v}\|\), \(b = \|\vec{w}\|\), and \(c = \|\vec{v} - \vec{w}\|\), so

A triangle with sides a and b meeting at the angle theta, and side c opposite theta.
\[ \begin{aligned} \|\vec{v} - \vec{w}\|^2 &= \|\vec{v}\|^2 + \|\vec{w}\|^2 \\ &\qquad {}- 2\|\vec{v}\|\,\|\vec{w}\|\cos\theta \end{aligned} \]

Expanding the left side with the properties of the dot product gives a second expression for it.

\[ \begin{aligned} \|\vec{v} - \vec{w}\|^2 &= (\vec{v} - \vec{w}) \dotp (\vec{v} - \vec{w}) \\ &= \vec{v} \dotp \vec{v} - \vec{v} \dotp \vec{w} \\ &\qquad {}- \vec{w} \dotp \vec{v} + \vec{w} \dotp \vec{w} \\ &= \vec{v} \dotp \vec{v} - 2\,\vec{v} \dotp \vec{w} + \vec{w} \dotp \vec{w} \\ &= \|\vec{v}\|^2 - 2\,\vec{v} \dotp \vec{w} + \|\vec{w}\|^2 \end{aligned} \]

Comparing the two expressions, the \(\|\vec{v}\|^2\) and \(\|\vec{w}\|^2\) terms are the same, so the remaining terms are equal.

\[ \begin{aligned} -2\,\vec{v} \dotp \vec{w} &= -2\|\vec{v}\|\,\|\vec{w}\|\cos\theta \\ \vec{v} \dotp \vec{w} &= \|\vec{v}\|\,\|\vec{w}\|\cos\theta \\ \cos\theta &= \frac{\vec{v} \dotp \vec{w}}{\|\vec{v}\|\,\|\vec{w}\|} \end{aligned} \]

An Example

Find the angle between the vectors \(\mathbf{v} = 2\mathbf{i} + 2\mathbf{j}\) and \(\mathbf{w} = \mathbf{j} - \mathbf{k}\).

In angle bracket notation, the vectors can be stated as below. The dot products and the magnitudes are calculated.

\[ \begin{aligned} \vec{v} &= \langle 2, 2, 0 \rangle \\ \vec{w} &= \langle 0, 1, -1 \rangle \\ \vec{v} \dotp \vec{w} &= (2)(0) + (2)(1) + (0)(-1) \\ &= 2 \\ \|\vec{v}\| &= \sqrt{2^2 + 2^2 + 0^2} \\ &= \sqrt{8} \\ \|\vec{w}\| &= \sqrt{0^2 + 1^2 + (-1)^2} \\ &= \sqrt{2} \end{aligned} \]

Next, we use the formula for the cosine of the angle between the two vectors.

\[ \begin{aligned} \cos\theta &= \frac{\vec{v} \dotp \vec{w}}{\|\vec{v}\|\,\|\vec{w}\|} \\ &= \frac{2}{\sqrt{2}\sqrt{8}} \\ &= \frac{2}{\sqrt{16}} \\ &= \frac{2}{4} \\ &= \frac{1}{2} \\ \theta &= \frac{\pi}{3} \\ \theta &= 60^\circ \end{aligned} \]

The angle between \(\mathbf{v}\) and \(\mathbf{w}\) is \(60^\circ\).

If the angle between two vectors is \(90^\circ\) or \(\pi/2\), the vectors are orthogonal.

Nonzero Vectors are Orthogonal if and only if their Dot Product is Zero.

This property is very important.

Observe what happens when \(\theta = \pi/2\) in the formula for the cosine of the angle between two vectors.

\[ \begin{aligned} \cos\theta &= \frac{\vec{v} \dotp \vec{w}}{\|\vec{v}\|\,\|\vec{w}\|} \\ \cos\frac{\pi}{2} &= \frac{\vec{v} \dotp \vec{w}}{\|\vec{v}\|\,\|\vec{w}\|} \\ 0 &= \frac{\vec{v} \dotp \vec{w}}{\|\vec{v}\|\,\|\vec{w}\|} \\ 0 &= \vec{v} \dotp \vec{w} \end{aligned} \]

In the last step, both sides are multiplied by \(\|\vec{v}\|\,\|\vec{w}\|\), which is not zero because the vectors are nonzero.