Skip to main content
Logo image

Coordinated Linear Algebra

Section 7.1 The Dot Product

Subsection 7.1.1 The Dot Product

Definition 7.1.1.

Let \(\mathbf{u}\) and \(\mathbf{v}\) be vectors in \(\R^n\text{.}\) The dot product of \(\mathbf{u}\) and \(\mathbf{v}\text{,}\) denoted by \(\mathbf{u}\cdot \mathbf{v}\text{,}\) is given by
\begin{equation*} \mathbf{u}\cdot\mathbf{v}=\begin{bmatrix}u_1\\u_2\\\vdots\\u_n\end{bmatrix}\cdot\begin{bmatrix}v_1\\v_2\\\vdots\\v_n\end{bmatrix}=u_1v_1+u_2v_2+\ldots+u_nv_n. \end{equation*}
We will see the dot product reppear over and over again. As such, an example of a computation is reasonable to start with:

Example 7.1.2.

Find \(\mathbf{u}\cdot \mathbf{v}\) if \(\mathbf{u}=\begin{bmatrix}-2\\0\\1\end{bmatrix}\) and \(\mathbf{v}=\begin{bmatrix}3\\2\\-4\end{bmatrix}\text{.}\)
\begin{equation*} \mathbf{u}\cdot\mathbf{v}=\begin{bmatrix}-2\\0\\1\end{bmatrix}\cdot\begin{bmatrix}3\\2\\-4\end{bmatrix}=(-2)(3)+(0)(2)+(1)(-4)=-6-4=-10 \end{equation*}
Note that the dot product of two vectors is a scalar. For this reason, the dot product is sometimes called a scalar product.
A quick examination of Example 7.1.2 will convince you that the dot product is commutative. In other words, \(\mathbf{u}\cdot\mathbf{v}=\mathbf{v}\cdot\mathbf{u}\text{.}\) This and other properties of the dot product are stated below.

Proof.

We will prove Item 2. The remaining properties are left as exercises.
\begin{align*} \left(\mathbf{u}+\mathbf{v}\right)\cdot \mathbf{w}\amp=\left(\begin{bmatrix} u_1\\ u_2\\ \vdots\\ u_n \end{bmatrix}+\begin{bmatrix} v_1\\ v_2\\ \vdots\\ v_n \end{bmatrix}\right)\cdot \begin{bmatrix}w_1\\w_2\\\vdots\\w_n\end{bmatrix}=\begin{bmatrix} u_1+v_1\\ u_2+v_2\\ \vdots\\ u_n+v_n \end{bmatrix}\cdot \begin{bmatrix}w_1\\w_2\\\vdots\\w_n\end{bmatrix} \\ \amp=(u_1+v_1)w_1 + (u_2+v_2)w_2 + \ldots + (u_n+v_n)w_n \\ \amp=u_1w_1 + v_1w_1 + u_2w_2+v_2w_2 + \ldots + u_nw_n+v_nw_n \\ \amp=(u_1w_1 + u_2w_2\ldots + u_nw_n) + (v_1w_1 + v_2w_2 + \ldots + v_nw_n) \\ \amp=\begin{bmatrix} u_1\\ u_2\\ \vdots\\ u_n \end{bmatrix} \cdot\begin{bmatrix}w_1\\w_2\\\vdots\\w_n\end{bmatrix} +\begin{bmatrix} v_1\\ v_2\\ \vdots\\ v_n \end{bmatrix} \cdot \begin{bmatrix}w_1\\w_2\\\vdots\\w_n\end{bmatrix} =\mathbf{u}\cdot\mathbf{w}+\mathbf{v}\cdot\mathbf{w} \end{align*}
We will illustrate Item 6 with an example.

Example 7.1.4.

Let \(\mathbf{u}=\begin{bmatrix}-2\\3\end{bmatrix}\text{.}\) Use \(\mathbf{u}\) to illustrate Item 6 of Theorem 7.1.3.
\begin{equation*} \norm{\mathbf{u}}^2=(-2)^2+3^2=(-2)(-2)+(3)(3)=\begin{bmatrix}-2\\3\end{bmatrix}\cdot\begin{bmatrix}-2\\3\end{bmatrix}=\mathbf{u}\cdot\mathbf{u} \end{equation*}
If we take the square root of both sides of the equation in Item 6, we get an alternative way to think of the length of a vector (Subsection 2.1.7).
Let’s also look at an example of Item 7.

Example 7.1.6.

Note that the standard unit vectors \(\mathbf{i},\mathbf{j}\) in \(\mathbb{R}^2\) are orthogonal--see Figure 2.1.15. Indeed,
\begin{equation*} \mathbf{i}\cdot\mathbf{j}=1(0)+0(1)=0. \end{equation*}
In general, by Item 7, for standard unit vectors \(\mathbf{e}_i,\mathbf{e}_j\) in \(\mathbb{R}^n\) with \(i\neq j\text{,}\) the vectors \(\mathbf{e}_i\) and \(\mathbf{e}_j\) are orthogonal since \(\mathbf{e}_i\cdot \mathbf{e}_j= 0\text{.}\)
To conclude this subsection, we connect the dot product back to matrix multiplication.

Observation 7.1.7.

Let \(A\) be an \(m\times n\) matrix whose rows are vectors \(\mathbf{r}_1\text{,}\) \(\mathbf{r}_2,\ldots ,\mathbf{r}_n\text{.}\) Let \(B\) be an \(n\times p\) matrix with columns \(\mathbf{b}_1, \mathbf{b}_2, \ldots, \mathbf{b}_p\text{.}\) Observe that \((i,j)\)-entry of \(AB\) is
\begin{equation*} a_{i1}b_{1j}+a_{i2}b_{2j}+\dots +a_{in}b_{nj}=\sum_{k=1}^na_{ik}b_{kj} = \mathbf{r}_i \cdot \mathbf{b}_j \end{equation*}
and so
\begin{equation*} AB=\begin{bmatrix}\mathbf{r}_1\cdot \mathbf{b}_1\amp \mathbf{r}_1\cdot \mathbf{b}_2\amp \ldots\amp \mathbf{r}_1\cdot \mathbf{b}_p\\ \mathbf{r}_2\cdot \mathbf{b}_1\amp \mathbf{r}_2\cdot \mathbf{b}_2\amp \ldots\amp \mathbf{r}_2\cdot \mathbf{b}_p\\ \vdots\amp \vdots\amp \amp \vdots \\ \mathbf{r}_m\cdot \mathbf{b}_1\amp \mathbf{r}_m\cdot \mathbf{b}_2\amp \ldots\amp \mathbf{r}_m\cdot \mathbf{b}_p\end{bmatrix} \end{equation*}
In particular, if \(\mathbf{x}\) is in \(\R^n\text{,}\) then each entry of \(A\mathbf{x}\) is the dot product of a row of \(A\) with \(\mathbf{x}\text{.}\)

Subsection 7.1.2 Orthogonal Projections

Given a line \(l\) and a vector \(\mathbf{v}\) emanating from a point on \(l\text{,}\) it is sometimes convenient to express \(\mathbf{v}\) as the sum of a vector \(\mathbf{v}_{\parallel}\text{,}\) parallel to \(l\text{,}\) and a vector \(\mathbf{v}_{\perp}\text{,}\) perpendicular to \(l\text{.}\) If you have taken a physics course, you may have seen a force vector decomposed into the sum of two components: one parallel and one perpendicular to the direction of motion.
Suppose \(\mathbf{d}\) is a direction vector for \(l\text{.}\) Then \(\mathbf{v}_{\parallel}=k\mathbf{d}\) for some scalar \(k\text{.}\) Our goal is to find \(k\text{.}\)
\begin{align*} \mathbf{v}\cdot\mathbf{d}\amp=(\mathbf{v}_{\parallel}+\mathbf{v}_{\perp})\cdot\mathbf{d} \\ \amp=(k\mathbf{d}+\mathbf{v}_{\perp})\cdot\mathbf{d} \\ \amp=k\mathbf{d}\cdot\mathbf{d}+\mathbf{v}_{\perp}\cdot\mathbf{d} \\ \amp=k\norm{\mathbf{d}}^2+0 \\ \amp=k\norm{\mathbf{d}}^2 \end{align*}
We conclude that
\begin{equation*} k=\frac{\mathbf{v}\cdot\mathbf{d}}{\norm{\mathbf{d}}^2} \end{equation*}
and
\begin{equation*} \mathbf{v}_{\parallel}=k\mathbf{d}=\left(\frac{\mathbf{v}\cdot\mathbf{d}}{\norm{\mathbf{d}}^2}\right)\mathbf{d} \end{equation*}
The vector \(\mathbf{v}_{\parallel}=\left(\frac{\mathbf{v}\cdot\mathbf{d}}{\norm{\mathbf{d}}^2}\right)\mathbf{d}\) is called the projection of \(\mathbf{v}\) onto \(\mathbf{d}\). In our discussion, \(\mathbf{d}\) is a direction vector for line \(l\text{.}\) So, we can also say that \(\mathbf{v}_{\parallel}\) is the projection of \(\mathbf{v}\) onto \(l\).
To find \(\mathbf{v}_{\perp}\text{,}\) observe that \(\mathbf{v}_{\perp}=\mathbf{v}-\mathbf{v}_{\parallel}\text{.}\)

Definition 7.1.8.

Let \(\mathbf{v}\) be a vector, and let \(\mathbf{d}\) be a non-zero vector. The projection of \(\mathbf{v}\) onto \(\mathbf{d}\) is given by
\begin{equation*} \text{proj}_{\mathbf{d}}\mathbf{v}=\left(\frac{\mathbf{v}\cdot\mathbf{d}}{\norm{\mathbf{d}}^2}\right)\mathbf{d} \end{equation*}
Although we will revisit the projection in greater detail much later, we illustrate it in an explicit case with a picture.

Example 7.1.9.

Find the projection of \(\mathbf{v}\text{,}\) shown below, onto the line given by \(y=\frac{1}{2}x-1\text{.}\)
We begin by finding vectors \(\mathbf{v}\) and \(\mathbf{d}\text{.}\) The tail of \(\mathbf{v}\) is located at \((-2, -2)\text{,}\) and the head of \(\mathbf{v}\) is at \((2, 4)\text{.}\) Using the ``head-tail" formula we get
\begin{equation*} \mathbf{v}=\begin{bmatrix}2-(-2)\\4-(-2)\end{bmatrix}=\begin{bmatrix}4\\6\end{bmatrix} \end{equation*}
The direction vector for the line \(y=\frac{1}{2}x-1\) is
\begin{equation*} \mathbf{d}=\begin{bmatrix}2\\1\end{bmatrix} \end{equation*}
We find that \(\mathbf{v}\cdot\mathbf{d}=14\) and \(\norm{\mathbf{d}}^2=5\text{.}\) Thus
\begin{equation*} \text{proj}_{\mathbf{d}}\mathbf{v}=\left(\frac{\mathbf{v}\cdot\mathbf{d}}{\norm{\mathbf{d}}^2}\right)\mathbf{d}=\frac{14}{5}\begin{bmatrix}2\\1\end{bmatrix}=\begin{bmatrix}28/5\\14/5\end{bmatrix} \end{equation*}

Subsection 7.1.3 Distance from a Point to a Line

The shortest distance from a point to a line is the length of the perpendicular line segment dropped from the point to the line. Vector projection formula will help us find the length of such a perpendicular.

Example 7.1.10.

Let \(A(2, -1, 1)\) be a point in \(\R^3\text{.}\) Suppose line \(l\) is given by parametric equations
\begin{equation*} x=t+3 \end{equation*}
\begin{equation*} y=-t+1 \end{equation*}
\begin{equation*} z=t-2 \end{equation*}
Find the distance from \(A\) to \(l\text{.}\)
We will first construct a vector \(\mathbf{v}\) by picking an arbitrary point \(B\) on \(l\) to be the tail of \(\mathbf{v}\) and using point \(A\) as the head of \(\mathbf{v}\text{.}\) An easy point to choose on line \(l\) is the point \((3, 1, -2)\) that corresponds to \(t=0\text{.}\) Now we have
\begin{equation*} \mathbf{v}=\overrightarrow{BA}=\begin{bmatrix}2-3\\-1-1\\1-(-2)\end{bmatrix}=\begin{bmatrix}-1\\-2\\3\end{bmatrix} \end{equation*}
The line has a direction vector
\begin{equation*} \mathbf{d}=\begin{bmatrix}1\\-1\\1\end{bmatrix} \end{equation*}
We will now find the projection of \(\overrightarrow{BA}\) onto \(l\)
\begin{equation*} \text{proj}_{\mathbf{d}} \overrightarrow{BA}=\left(\frac{\mathbf{v}\cdot\mathbf{d}}{\norm{\mathbf{d}}^2}\right)\mathbf{d}=\frac{4}{3}\begin{bmatrix}1\\-1\\1\end{bmatrix}=\begin{bmatrix}4/3\\-4/3\\4/3\end{bmatrix} \end{equation*}
Next, we find \(\mathbf{v}_{\perp}\text{.}\)
\begin{equation*} \mathbf{v}_{\perp}=\mathbf{v}-\mathbf{v}_{\parallel}=\begin{bmatrix}-1\\-2\\3\end{bmatrix}-\begin{bmatrix}4/3\\-4/3\\4/3\end{bmatrix}=\begin{bmatrix}-7/3\\-2/3\\5/3\end{bmatrix} \end{equation*}
Finally, to find the distance between point \(A\) and line \(l\text{,}\) we find the magnitude of \(\mathbf{v}_{\perp}\text{.}\)
\begin{equation*} \norm{\mathbf{v}_{\perp}}=\frac{1}{3}\sqrt{49+4+25}=\frac{\sqrt{78}}{3} \end{equation*}

Exercises 7.1.4 Exercises

1.

Find the dot product of \(\mathbf{u}\) and \(\mathbf{v}\) if
\begin{equation*} \mathbf{u}=\begin{bmatrix}-1\\-2\\5\\4\end{bmatrix},\quad \mathbf{v}=\begin{bmatrix}2\\-2\\-3\\1\end{bmatrix} \end{equation*}
Answer.
\begin{equation*} \mathbf{u} \cdot \mathbf{v} = -9 \end{equation*}

2.

Find the dot product of \(\mathbf{u}\) and \(\mathbf{v}\) if
\begin{equation*} \mathbf{u}=\begin{bmatrix}1\\1/2\end{bmatrix},\quad \mathbf{v}=\begin{bmatrix}-2\\4\end{bmatrix} \end{equation*}
Answer.
\begin{equation*} \mathbf{u} \cdot \mathbf{v} = 0 \end{equation*}

3.

Use vector \(\mathbf{u}=\begin{bmatrix}2\\5\\-7\end{bmatrix}\) to illustrate Item 6 of Theorem 7.1.3.

5.

From the given list of vector pairs, identify ALL pairs of vectors that lie on perpendicular lines.
  • \(\mathbf{u}=\begin{bmatrix}1\\\frac{1}{2}\end{bmatrix}\text{,}\) \(\mathbf{v}=\begin{bmatrix}-2\\4\end{bmatrix}\)
  • \(\mathbf{u}=\begin{bmatrix}-1\\\frac{1}{2}\end{bmatrix}\text{,}\) \(\mathbf{v}=\begin{bmatrix}-2\\4\end{bmatrix}\)
  • \(\mathbf{u}=\begin{bmatrix}1\\\frac{1}{2}\end{bmatrix}\text{,}\) \(\mathbf{v}=\begin{bmatrix}1\\-2\end{bmatrix}\)
  • \(\mathbf{u}=\begin{bmatrix}-1\\-\frac{1}{2}\end{bmatrix}\text{,}\) \(\mathbf{v}=\begin{bmatrix}-2\\4\end{bmatrix}\)
Also compute \(\mathbf{u}\cdot\mathbf{v}\) for each pair. What do you observe?
Hint.
You may want to draw a picture and think about what you know about slopes of perpendicular lines.

Exercise Group.

For each problem below
  1. Find the value of \(x\) that will make vectors \(\mathbf{u}\) and \(\mathbf{v}\) perpendicular.
    Hint: Think of the \(x\)-component as the ``run" and the \(y\)-component as the ``rise", then use what you know about slopes of perpendicular lines.
  2. Find \(\mathbf{u}\cdot\mathbf{v}\text{.}\)
6.
\begin{equation*} \mathbf{u} = \begin{bmatrix}1\\2\end{bmatrix},\quad \mathbf{v}=\begin{bmatrix}2\\x\end{bmatrix} \end{equation*}
Answer.
\begin{equation*} x = -1 \end{equation*}
\begin{equation*} \mathbf{u}\cdot\mathbf{v}=0 \end{equation*}
7.
\begin{equation*} \mathbf{u} = \begin{bmatrix}5\\2\end{bmatrix},\quad \mathbf{v}=\begin{bmatrix}x\\-4\end{bmatrix} \end{equation*}
Answer.
\begin{equation*} x = 8/5 \end{equation*}
\begin{equation*} \mathbf{u}\cdot\mathbf{v}=0 \end{equation*}
8.
\begin{equation*} \mathbf{u} = \begin{bmatrix} 4\\-3\end{bmatrix},\quad \mathbf{v} =\begin{bmatrix}6\\x\end{bmatrix} \end{equation*}
Answer.
\begin{equation*} x = 8 \end{equation*}
\begin{equation*} \mathbf{u}\cdot\mathbf{v}=0 \end{equation*}

9.

  1. Vector \(\mathbf{u}\) that lies on the line \(y=mx\text{,}\) has the form \(\mathbf{u}=k\begin{bmatrix}1\\m\end{bmatrix}\text{.}\) Assuming that \(m\neq 0\text{,}\) find the general form for a vector \(\mathbf{v}\) that lies on a line perpendicular to \(y=mx\text{.}\)
  2. Find \(\mathbf{u}\cdot \mathbf{v}\text{.}\)
  3. Formulate a conjecture about the dot product of perpendicular vectors.
Hint.
What do you know about the slopes of perpendicular lines?

Exercise Group.

Find \(\text{proj}_{\mathbf{d}}\mathbf{v}\text{.}\)
10.
Let \(\mathbf{d}=\begin{bmatrix}-1\\3\end{bmatrix}\) and \(\mathbf{v}=\begin{bmatrix}1\\4\end{bmatrix}\text{.}\) Compute \(\text{proj}_{\mathbf{d}}\mathbf{v}\text{.}\)
Answer.
\begin{equation*} \text{proj}_{\mathbf{d}}\mathbf{v}=\begin{bmatrix} -1.1\\ 3.3\end{bmatrix} \end{equation*}
11.
Suppose \(\mathbf{d}=\begin{bmatrix}0\\2\\1\end{bmatrix}\) and \(\mathbf{v}=\begin{bmatrix}-1\\-4\\2\end{bmatrix}\text{.}\) Compute the projection of \(\mathbf{v}\) onto \(\mathbf{d}\text{.}\)
Answer.
\begin{equation*} \text{proj}_{\mathbf{d}}\mathbf{v}=\begin{bmatrix} 0\\ -2.4\\ -1.2\end{bmatrix} \end{equation*}

12.

Find the projection of vector \(\mathbf{v}\) onto line \(l\text{.}\) (If entering answers in decimal form, round to the nearest one hundredth.)
Answer.
\begin{equation*} \begin{bmatrix}-95/26\\ 19/26\end{bmatrix} \end{equation*}

13.

Find the distance between point \(A\) and line \(l\text{.}\)
Answer.
\(\sqrt{3.2}\)

14.

Show that \(\text{proj}_{\mathbf{d}}\mathbf{v}\) does not depend on the length of \(\mathbf{d}\) by proving that \(\text{proj}_{\mathbf{d}}\mathbf{v}=\text{proj}_{k\mathbf{d}}\mathbf{v}\) for \(k\neq 0\text{.}\) What does this result mean geometrically? Illustrate your response with a diagram.

15.

Find the radius of a circle centered at \((4, 2)\) if the line \(y=\frac{3}{2}x+3\) is tangent to the circle. Enter your response as a fraction.
Answer.
\begin{equation*} r=\sqrt{196/13} \end{equation*}
The graph below shows the line \(y=\frac{3}{2}x+3\) together with a circle of radius \(1\text{.}\) Change the value of \(r\) to the radius you have found to visualize the correct answer.
Figure 7.1.11. A larger version of this activity is available here
 1 
https://www.geogebra.org/calculator/bngnjxee
.