Skip to main content

Section 2.2 Geometry: The dot product

So far we have seen vectors as algebraic objects (columns of numbers) and geometric objects (directed line segments). We have alluded to notions such as "length" and "angle" in the previous section. The goal of this section is to take those geometric ideas and discover how they can be interpreted algebraically. Our method is to start from our understanding of plane geometry, derive formulas for length and angle that work in \(\mathbb{R}^2\text{,}\) and then take those formulas as definitions in higher dimensions. By the end of this section we will be able to make sense of things like the length of a vector in \(\mathbb{R}^{15}\) or the angle between two vectors in \(\mathbb{R}^{2112}\text{.}\)

Subsection 2.2.1 The dot product

Perhaps surprisingly, it turns out that length and angle are closely related by a single algebraic construction. For now, this definition is somewhat unmotivated. The remainder of this section will explain the usefulness of this concept.

Definition 2.2.1.

Suppose that \(\vec{v} = \begin{bmatrix}v_1\\ \vdots \\ v_n\end{bmatrix}\) and \(\vec{w} = \begin{bmatrix}w_1 \\ \vdots \\ w_n \end{bmatrix}\) are vectors in \(\mathbb{R}^n\text{.}\) We define their dot product (or inner product) to be:

\begin{equation*} \vec{v} \cdot \vec{w} = v_1w_1 + \cdots + v_nw_n\text{.} \end{equation*}

Note 2.2.2.

There are several important things to notice in the definition above:

  • The vectors \(\vec{v}\) and \(\vec{w}\) must both be from \(\mathbb{R}^n\) for the same value of \(n\text{.}\) It makes no sense to write \(\vec{v} \cdot \vec{w}\) if \(\vec{v}\) is in \(\mathbb{R}^2\) and \(\vec{w}\) is in \(\mathbb{R}^3\text{,}\) for example.

  • The inputs to the dot product are two vectors, but the output is a scalar. The dot product is a completely different operation from scalar multiplication!

  • As a consequence of the previous point, an expression like \(\vec{v} \cdot (\vec{w} \cdot \vec{z})\) is meaningless, because we cannot take the dot product of a vector (like \(\vec{v}\)) with a scalar (like \(\vec{w} \cdot \vec{z}\)).

  • \(\displaystyle \begin{bmatrix}1\\1\\5\end{bmatrix} \cdot \begin{bmatrix}\sqrt{2} \\ 0 \\ \pi\end{bmatrix} = 1(\sqrt{2}) + 1(0) + 5(\pi) = \sqrt{2}+5\pi \)

  • \(\displaystyle \begin{bmatrix}1\\-2\end{bmatrix} \cdot \begin{bmatrix} 1\\ 1/2\end{bmatrix} = 1(1) + (-2)(1/2) = 0 \)

  • \(\displaystyle \begin{bmatrix}2\\1\end{bmatrix} \cdot \begin{bmatrix} 2\\1\end{bmatrix} = 2(2) + 1(1) = 2^2 + 1^2 = 5 \)

Take a moment and try to see if you can find the geometric significance of the second and third examples above. Each of them illustrates something that will be explored in more detail below.

We will prove (2), leaving the others as exercises. Suppose that \(\vec{v} = \begin{bmatrix}v_1 \\ \vdots \\ v_n\end{bmatrix}\text{,}\) \(\vec{w} = \begin{bmatrix}w_1 \\ \vdots \\ w_n \end{bmatrix}\text{,}\) and \(\vec{z} = \begin{bmatrix}z_1\\ \vdots \\ z_n\end{bmatrix}\text{.}\) Then:

\begin{align*} \vec{v} \cdot (\vec{w} + \vec{z}) \amp = \begin{bmatrix}v_1 \\ \vdots \\ v_n \end{bmatrix} \cdot \left(\begin{bmatrix}w_1 \\ \vdots \\ w_n\end{bmatrix} + \begin{bmatrix}z_1 \\ \vdots \\ z_n\end{bmatrix}\right) \\ \amp = \begin{bmatrix}v_1 \\ \vdots \\ v_n \end{bmatrix} \cdot \begin{bmatrix}w_1+z_1 \\ \vdots \\ w_n + z_n \end{bmatrix} \\ \amp = v_1(w_1+z_1) + \cdots + v_n(w_n+z_n) \\ \amp = (v_1w_1 + v_1z_1) + \cdots + (v_nw_n + v_nz_n) \\ \amp = (v_1w_1 + \cdots + v_nw_n) + (v_1z_1 + \cdots + v_nz_n) \\ \amp = \begin{bmatrix}v_1 \\ \vdots \\ v_n\end{bmatrix} \cdot \begin{bmatrix}w_1 \\ \vdots \\ w_n \end{bmatrix} + \begin{bmatrix}v_1\\ \vdots \\ v_n\end{bmatrix}\cdot \begin{bmatrix}z_1 \\ \vdots \\ z_n\end{bmatrix} \\ \amp = \vec{v} \cdot \vec{w} + \vec{v} \cdot \vec{z} \end{align*}

Subsection 2.2.2 Length

Now that we have the basic properties of the dot product, we are ready to start exploring what it means. We will start with the very special case of taking the dot product of a vector with itself. We begin in \(\mathbb{R}^2\text{.}\)

Consider the vector \(\vec{v} = \begin{bmatrix}2\\1\end{bmatrix}\text{.}\) In Example 2.2.3 we calculated that \(\vec{v} \cdot \vec{v} = 2^2+1^2 = 5\text{.}\)

Figure 2.2.6. Calculating the length of \(\vec{v}\)

Using the Pythagorean Theorem we calculate that the length of the line segment representing \(\vec{v}\) is \(\sqrt{2^2+1^2} = \sqrt{\vec{v} \cdot \vec{v}}\text{.}\)

The example generalizes to any vector in \(\mathbb{R}^2\text{:}\) If \(\vec{v} = \begin{bmatrix}x\\y\end{bmatrix}\text{,}\) then \(\vec{v} \cdot \vec{v} = x^2+y^2\text{,}\) and if we draw \(\vec{v}\) in the plane we will get a line segment of length \(\sqrt{x^2+y^2} = \sqrt{\vec{v}\cdot\vec{v}}\text{.}\)

Our plan is to take \(\sqrt{\vec{v}\cdot\vec{v}}\) as the definition of the length of \(\vec{v}\) when \(\vec{v}\) is a vector in any \(\mathbb{R}^n\text{.}\) Before we can sensibly do that we need to know that the expression \(\vec{v}\cdot\vec{v}\) always produces a non-negative answer, so that the square root makes sense.

For the first claim, if \(\vec{v} = \begin{bmatrix}v_1 \\ \vdots \\ v_n\end{bmatrix}\) then \(\vec{v} \cdot \vec{v} = v_1^2 + \cdots + v_n^2\text{.}\) For each index \(j\) we have \(v_j^2 \geq 0\text{,}\) and the sum of non-negative numbers is non-negative, so \(\vec{v} \cdot \vec{v} \geq 0\text{.}\)

The second claim is an "if and only if" statement, which means that it asserts two things. Specifically, we need to prove that if \(\vec{v} = \vec{0}\) then \(\vec{v}\cdot\vec{v} = 0\text{,}\) and we also need to prove that if \(\vec{v} \cdot \vec{v} = 0\) then \(\vec{v} = \vec{0}\text{.}\)

The first direction is easy: If \(\vec{v} = \vec{0}\) then \(\vec{v} \cdot \vec{v} = \vec{0}\cdot\vec{0} = 0^2+\cdots + 0^2 = 0\text{.}\)

For the other direction, if \(\vec{v}\cdot\vec{v} = 0\) then \(v_1^2+\cdots+v_n^2 = 0\text{.}\) For each \(j\) we know \(v_j^2 \geq 0\text{,}\) and the only way that a sum of non-negative numbers can be \(0\) is if all of the numbers are \(0\text{,}\) so in fact each \(v_j^2 = 0\text{.}\) Thus each \(v_j = 0\text{,}\) so \(\vec{v} = \vec{0}\text{.}\)

Definition 2.2.8.

Suppose that \(\vec{v}\) is a vector in \(\mathbb{R}^n\text{.}\) We define the length (or norm, or magnitude) of \(\vec{v}\) to be:

\begin{equation*} \norm{v} = \sqrt{\vec{v}\cdot\vec{v}}\text{.} \end{equation*}

Note 2.2.9.

Here are some things about the above definition that help make it a good notion of length:

  • The definition is sensible for any vector. We proved in Theorem 2.2.7 that \(\vec{v} \cdot \vec{v} \geq 0\text{,}\) so \(\norm{\vec{v}} = \sqrt{\vec{v}\cdot\vec{v}}\) makes sense.

  • Every vector has non-negative length, because the square root function always returns a non-negative number.

  • The only vector in \(\mathbb{R}^n\) with length \(0\) is the vector \(\vec{0}\text{.}\) This is because we proved in Theorem 2.2.7 that \(\vec{v}\cdot\vec{v} = 0\) if and only if \(\vec{v} = \vec{0}\text{,}\) which means that \(\norm{\vec{v}} = 0\) if and only if \(\vec{v} = \vec{0}\text{.}\)

  • This definition of length agrees with our geometric understanding of length for vectors in the plane. If you have seen geometry in three-dimensional space you will also recognize that in \(\mathbb{R}^3\) the length of the line segment from the origin \(O = (0,0,0)\) to a point \(P = (x, y, z)\) is \(\sqrt{x^2+y^2+z^2}\text{,}\) which agrees with our definition of \(\norm{\vec{OP}}\text{.}\)

When we want to prove things about lengths it is often easier to work with the square of the length, to remove the square root. The next theorem illustrates this technique, and also tells that length is affected by scalar multiplication in a reasonable way.

We calculate \(\norm{c\vec{v}}^2\text{,}\) using the properties of dot products from Theorem 2.2.4

\begin{align*} \norm{c\vec{v}}^2 \amp = (c\vec{v}) \cdot (c\vec{v}) \\ \amp = c(\vec{v} \cdot (c\vec{v})) \\ \amp = c(c\vec{v} \cdot \vec{v}) \\ \amp = c^2(\vec{v}\cdot \vec{v}) \\ \amp = c^2\norm{v}^2 \end{align*}

Now we take square roots on both sides. Remember that \(\sqrt{x^2} = \abs{x}\) for every real number \(x\text{,}\) and that lengths are always non-negative, to see

\begin{equation*} \norm{c\vec{v}} = \sqrt{\norm{c\vec{v}}^2} = \sqrt{c^2\norm{\vec{v}^2}} = \abs{c}\norm{\vec{v}}\text{.} \end{equation*}

Unfortunately, there is no way to calculate \(\norm{\vec{v}+\vec{w}}\) just from \(\norm{v}\) and \(\norm{w}\text{.}\) For instance, if \(\vec{v} = \begin{bmatrix}1\\0\end{bmatrix}\text{,}\) \(\vec{w} = \begin{bmatrix}0\\1\end{bmatrix}\text{,}\) and \(\vec{z} = \begin{bmatrix}-1\\0\end{bmatrix}\) then \(\norm{\vec{v}} = \norm{\vec{w}} = \norm{\vec{z}} = 1\text{,}\) but \(\norm{\vec{v}+\vec{w}} = \sqrt{2}\) while \(\norm{\vec{v}+\vec{z}} = 0\text{.}\)

Although we don't have an exact calculation of \(\norm{\vec{v}+\vec{w}}\text{,}\) we do have two very useful inequalities, which we present here without proof.

Definition 2.2.13.

A unit vector is a vector \(\vec{v}\) such that \(\norm{\vec{v}} = 1\text{.}\)

We just need to do a calculation, using Theorem 2.2.10

\begin{align*} \norm{\frac{1}{\norm{\vec{v}}}\vec{v}} \amp = \abs{\frac{1}{\norm{\vec{v}}}}\norm{\vec{v}} \\ \amp = \frac{1}{\norm{\vec{v}}}\norm{\vec{v}} \\ \amp = 1 \end{align*}

Subsection 2.2.3 Angle

In the previous section we examined \(\vec{v}\cdot\vec{v}\) and saw that we could extract the length of \(\vec{v}\) from this dot product. We now turn to the more general case of the dot product of two different vectors. We again begin by exploring the situation in \(\mathbb{R}^2\text{.}\) We will be encountering angles and using some trigonometry in this section, so now is a good time to set the following convention:

Unless explicitly stated otherwise, all angles are measured in radians.

Consider two vectors, \(\vec{v}\) and \(\vec{w}\text{,}\) in \(\mathbb{R}^2\text{.}\) Draw both vectors in standard position, and let \(\theta\) be the shorter of the two angles between the vectors (so \(0 \leq \theta \leq \pi\)).

Figure 2.2.15. \(\theta\) is the angle between \(\vec{v}\) and \(\vec{w}\text{,}\) \(\psi\) is not.

Using the cosine law, we get

\begin{equation*} \norm{\vec{v} - \vec{w}}^2 = \norm{\vec{v}}^2 + \norm{\vec{w}}^2 - 2\norm{\vec{v}}\norm{\vec{w}}\cos\theta\text{.} \end{equation*}

Next, we expand the left side and use properties of the dot product from Theorem 2.2.4:

\begin{align*} \norm{\vec{v} - \vec{w}}^2 \amp = (\vec{v} - \vec{w})\cdot(\vec{v} - \vec{w})\\ \amp = \vec{v}\cdot\vec{v} - \vec{v}\cdot\vec{w} - \vec{w}\cdot\vec{v} + \vec{w}\cdot\vec{w} \\ \amp = \norm{\vec{v}}^2 + \norm{\vec{w}}^2 - 2(\vec{v}\cdot\vec{w}) \end{align*}

Now we plug this back in to the left side of the equation

\begin{equation*} \norm{\vec{v}}^2 + \norm{\vec{w}}^2 - 2(\vec{v} \cdot \vec{w}) = \norm{\vec{v}}^2 + \norm{\vec{w}}^2 - 2\norm{\vec{v}}\norm{\vec{w}}\cos\theta\text{.} \end{equation*}

Simplifying this leads to

\begin{equation*} \vec{v}\cdot\vec{w} = \norm{\vec{v}}\norm{\vec{w}}\cos\theta\text{.} \end{equation*}

As long as neither \(\vec{v}\) nor \(\vec{w}\) is \(\vec{0}\) we can write this as

\begin{equation*} \cos\theta = \frac{\vec{v}\cdot\vec{w}}{\norm{\vec{v}}\norm{\vec{w}}}\text{.} \end{equation*}

As we did with length, we now take the formula we found for \(\mathbb{R}^2\) as the definition of angle in \(\mathbb{R}^n\text{.}\)

Definition 2.2.16.

Suppose that \(\vec{v}\) and \(\vec{w}\) are non-zero vectors in \(\mathbb{R}^n\text{.}\) The angle between \(\vec{v}\) and \(\vec{w}\) is the angle \(\theta\) such that \(0 \leq \theta \leq \pi\) that satisfies

\begin{equation*} \cos\theta = \frac{\vec{v}\cdot\vec{w}}{\norm{\vec{v}}\norm{\vec{w}}}\text{.} \end{equation*}

What is the angle between \(\vec{v} = \begin{bmatrix}1\\0\\2\\-1\end{bmatrix}\) and \(\vec{w} = \begin{bmatrix}0\\1\\-1\\0\end{bmatrix}\) in \(\mathbb{R}^4\text{?}\)

Solution.

Let \(\theta\) be the angle we're looking for. Then:

\begin{equation*} \cos\theta = \frac{\vec{v}\cdot\vec{w}}{\norm{\vec{v}}\norm{\vec{w}}} = \frac{-2}{\sqrt{6}\sqrt{2}} = -\frac{1}{\sqrt{3}}\text{.} \end{equation*}

The angle is therefore the angle with \(0 \leq \theta \leq \pi \) with \(\cos\theta = -\frac{1}{\sqrt{3}}\text{.}\) This angle is approximately \(\theta = 2.186\) (radians, as always).

Definition 2.2.18.

We say that two vectors \(\vec{v}\) and \(\vec{w}\) are orthogonal (or perpendicular) if \(\vec{v}\cdot\vec{w} = 0\text{.}\) We write \(\vec{v} \perp \vec{w}\) as an abbreviation for the statement "\(\vec{v}\) and \(\vec{w}\) are orthogonal".

Note 2.2.19.

Suppose that \(\vec{v} \perp \vec{w}\text{.}\) Then one of the following three things must be true:

  • \(\displaystyle \vec{v} = \vec{0} \)

  • \(\displaystyle \vec{w} = \vec{0} \)

  • \(\cos\theta = 0 \text{,}\) in which case \(\theta = \pi/2\text{,}\) i.e., the angle between the two vectors is \(90^\circ\text{.}\)

Let \(\vec{v} = \begin{bmatrix}3\\2\\1\\-1\end{bmatrix}\) and \(\vec{w} = \begin{bmatrix}0\\1\\-1\\1\end{bmatrix}\text{.}\) Then \(\vec{v} \perp \vec{w}\) (that is, these two vectors are orthogonal), because \(\vec{v}\cdot\vec{w} = 0\text{.}\)

We begin with a calculation.

\begin{align*} \norm{\vec{v} + \vec{w}}^2 \amp = (\vec{v} + \vec{w}) \cdot (\vec{v} + \vec{w}) \\ \amp = \vec{v} \cdot \vec{v} + 2(\vec{v}\cdot\vec{w}) + \vec{w}\cdot\vec{w} \\ \amp = \norm{\vec{v}}^2 + \norm{\vec{w}}^2 + 2(\vec{v}\cdot\vec{w}) \end{align*}

From here we see that \(\norm{\vec{v}+\vec{w}}^2 = \norm{\vec{v}}^2 + \norm{\vec{w}}^2\) if and only if \(2(\vec{v}\cdot\vec{w}) = 0\text{,}\) which is if and only if \(\vec{v} \perp \vec{w}\text{.}\)

Subsection 2.2.4 Orthogonal projections

It happens fairly often that we have vectors \(\vec{v}\) and \(\vec{w}\text{,}\) and we would like to express \(\vec{v}\) as the sum of a vector in the same direction as \(\vec{w}\) and a vector that is orthogonal to \(\vec{w}\text{.}\)

If \(\vec{w} = \begin{bmatrix}1\\0\end{bmatrix}\) this is not difficult to do: Given \(\vec{v} = \begin{bmatrix}x\\y\end{bmatrix}\) we can write

\begin{equation*} \vec{v} = x\begin{bmatrix}1\\0\end{bmatrix}+ y\begin{bmatrix}0\\1\end{bmatrix} = x\vec{w}+ \begin{bmatrix}0\\y\end{bmatrix}\text{,} \end{equation*}

and \(\vec{w}\perp\begin{bmatrix}0\\y\end{bmatrix}\text{.}\) Our next goal is to generalize this idea to cases when \(\vec{w}\) is not necessarily along a coordinate axis. As in previous sections, we begin in \(\mathbb{R}^2\) and then generalize to higher dimensions.

Figure 2.2.22. The orthogonal projection of \(\vec{v}\) on \(\vec{w}\text{.}\)

From highschool geometry you know that the shortest distance from the tip of \(\vec{v}\) to the line following \(\vec{w}\) occurs at the point on that line where the angle made to the tip of \(\vec{v}\) is a right angle, as shown in the figure above. The vector from the origin to this point, labelled as \(\vec{p}\) on the figure, is called the orthogonal projection of \(\vec{v}\) on \(\vec{w}\), and is often written as \(\proj_{\vec{w}}(\vec{v})\text{.}\)

Let \(\vec{u} = \frac{1}{\norm{\vec{w}}}\vec{w}\text{,}\) so that \(\vec{u}\) is the unit vector in the same direction as \(\vec{w}\text{.}\) Then we have

\begin{equation*} \vec{p} = \norm{\vec{p}}\vec{u}\text{,} \end{equation*}

so to find a formula for \(\vec{p}\) we only need to calculate \(\norm{\vec{p}}\text{,}\) which is the length of the line segment from the origin to the tip of \(\vec{p}\text{.}\)

From the trigonometry of right-angled triangles we have \(\cos\theta = \frac{\norm{\vec{p}}}{\norm{\vec{v}}}\text{,}\) so \(\norm{\vec{p}} = \norm{\vec{v}}\cos\theta\text{.}\) We know a formula for \(\cos\theta\) (Definition 2.2.16), and plugging that in gives us

\begin{equation*} \norm{\vec{p}} = \norm{\vec{v}}\left(\frac{\vec{v}\cdot\vec{w}}{\norm{\vec{v}}\norm{\vec{w}}}\right) = \frac{\vec{v}\cdot\vec{w}}{\norm{\vec{w}}}\text{.} \end{equation*}

Putting together these calculations, we obtain:

\begin{equation*} \vec{p} = \norm{\vec{p}}\vec{u} = \frac{\vec{v}\cdot\vec{w}}{\norm{\vec{w}}}\left(\frac{1}{\norm{\vec{w}}}\vec{w}\right) = \frac{\vec{v}\cdot\vec{w}}{\vec{w}\cdot\vec{w}}\vec{w}\text{.} \end{equation*}

The result of this calculation now becomes our definition in general.

Definition 2.2.23.

Let \(\vec{v}\text{,}\) \(\vec{w}\) be vectors in \(\mathbb{R}^n\) with \(\vec{w} \neq \vec{0}\text{.}\) The orthogonal projection of \(\vec{v}\) on \(\vec{w}\) is the vector

\begin{equation*} \proj_{\vec{w}}(\vec{v}) = \frac{\vec{v}\cdot\vec{w}}{\vec{w}\cdot\vec{w}}\vec{w}\text{.} \end{equation*}

Definition 2.2.24.

Let \(\vec{v}\text{,}\) \(\vec{w}\) be vectors in \(\mathbb{R}^n\text{,}\) with \(\vec{w} \neq \vec{0}\text{.}\) The component of \(\vec{v}\) orthogonal to \(\vec{w}\) is the vector

\begin{equation*} \operatorname{perp}_{\vec{w}}(\vec{v}) = \vec{v} - \proj_{\vec{w}}(\vec{v})\text{.} \end{equation*}

First, notice that \(\vec{0} = 0\vec{w}\text{,}\) so \(\vec{0}\) is parallel to \(\vec{w}\text{,}\) but also \(\vec{0}\cdot\vec{w} = 0\text{,}\) so \(\vec{0}\) is orthogonal to \(\vec{w}\text{.}\)

Now suppose that \(\vec{v}\) is a vector that is both parallel to \(\vec{w}\) and orthogonal to \(\vec{w}\text{.}\) Since \(\vec{v}\) is parallel to \(\vec{w}\) there is a scalar \(c\) such that \(\vec{v} = c\vec{w}\text{.}\) Since \(\vec{v} \perp \vec{w}\) we have \(\vec{v}\cdot\vec{w} = 0\text{.}\) Therefore

\begin{align*} 0 \amp = \vec{v}\cdot\vec{w} \\ \amp = (c\vec{w})\cdot\vec{w} \\ \amp = c(\vec{w}\cdot\vec{w}) \\ \amp c\norm{\vec{w}}^2 \end{align*}

From here we see that either \(c=0\) or \(\norm{\vec{w}}^2 = 0\text{.}\) The latter option is impossible, because one of our assumptions is that \(\vec{w} \neq \vec{0}\text{.}\) Therefore \(c=0\text{,}\) and hence

\begin{equation*} \vec{v} = c\vec{w} = 0\vec{w} = \vec{0}\text{.} \end{equation*}

There are two things that need to be proved here. First, we must show that the choice \(\vec{v_1} = \proj_{\vec{w}}(\vec{v})\) and \(\vec{v_2} = \operatorname{perp}_{\vec{w}}(\vec{v})\) has the properties stated in the theorem, and then we need to show that this is the only possible choice of \(\vec{v_1}\) and \(\vec{v_2}\text{.}\)

First, let's show that the proposed choice of \(\vec{v_1}\) and \(\vec{v_2}\) does work. That is, let \(\vec{v_1} = \proj_{\vec{w}}(\vec{v})\) and \(\vec{v_2} = \operatorname{perp}_{\vec{w}}(\vec{v})\text{.}\) From the formula for \(\proj_{\vec{w}}(\vec{v})\) we see that this vector is a scalar multiple of \(\vec{w}\text{,}\) and hence \(\vec{v_1}\) is parallel to \(\vec{w}\text{.}\) Next, we calculate:

\begin{align*} \vec{v_2}\cdot\vec{w} \amp = \operatorname{perp}_{\vec{w}}(\vec{v})\cdot \vec{w} \\ \amp = \left(v - \proj_{\vec{w}}(\vec{v})\right)\cdot \vec{w} \\ \amp = \vec{v}\cdot\vec{w} - \proj_{\vec{w}}(\vec{v})\cdot\vec{w} \\ \amp = \vec{v}\cdot\vec{w} - \left(\frac{\vec{v}\cdot\vec{w}}{\vec{w}\cdot\vec{w}}\vec{w}\right)\cdot\vec{w} \\ \amp = \vec{v}\cdot\vec{w} - \left(\frac{\vec{v}\cdot\vec{w}}{\vec{w}\cdot\vec{w}}\right)(\vec{w}\cdot\vec{w}) \\ \amp = \vec{v} \cdot\vec{w} - \vec{v}\cdot\vec{w} \\ \amp = 0 \end{align*}

Thus our proposed choice of \(\vec{v_2}\) does satisfy \(\vec{v_2}\perp\vec{w}\text{.}\) Finally, we have

\begin{equation*} \vec{v_1}+\vec{v_2} = \proj_{\vec{w}}(\vec{v}) + \operatorname{perp}_{\vec{w}}(\vec{v}) = \proj_{\vec{w}}(\vec{v}) + (v - \proj_{\vec{w}}(\vec{v})) = \vec{v}\text{.} \end{equation*}

So far we have proved that the propsed choices of \(\vec{v_1}\) and \(\vec{v_2}\) have all the properties we wanted. Now we turn to showing that these are the only choices that work. Do to that, suppose that we have another decomposition, say \(\vec{v} = \vec{z_1} + \vec{z_2}\text{,}\) where \(\vec{z_1}\) is parallel to \(\vec{w}\) and \(\vec{z_2}\) is orthogonal to \(\vec{w}\text{.}\) Then we have

\begin{equation*} \vec{v} = \vec{v_1}+\vec{v_2} = \vec{z_1}+\vec{z_2}\text{,} \end{equation*}

so

\begin{equation*} \vec{v_1}-\vec{z_1} = \vec{z_2}-\vec{v_2}\text{.} \end{equation*}

The vector \(\vec{v_1}-\vec{z_1}\) is the difference of two vectors each of which is parallel to \(\vec{w}\text{,}\) so it is also parallel to \(\vec{w}\text{.}\) On the other hand, \(\vec{z_2} - \vec{v_2}\) is the difference of two vectors that are each orthogonal to \(\vec{w}\text{,}\) so it is also orthogonal to \(\vec{w}\) (you should verify this fact!). But these two vectors are the same, so this one vector is both parallel to \(\vec{w}\) and orthogonal to \(\vec{w}\text{.}\) In Lemma 2.2.25 we saw that the only such vector is \(\vec{0}\text{.}\) Therefore \(\vec{v_1} - \vec{z_1} = \vec{0}\text{,}\) so \(\vec{z_1} = \vec{v_1}\text{.}\) Similarly, \(\vec{z_2} - \vec{v_2} = \vec{0}\text{,}\) so \(\vec{z_2} = \vec{v_2}\text{.}\)

Write the vector \(\begin{bmatrix}1\\3\\-1\end{bmatrix}\) as the sum of a vector that is parallel to \(\begin{bmatrix}1\\1\\0\end{bmatrix}\) and a vector that is orthogonal to \(\begin{bmatrix}1\\1\\0\end{bmatrix}\text{.}\)

Solution.

By Theorem 2.2.26 there is only one way to do this, namely:

\begin{equation*} \begin{bmatrix}1\\3\\-1\end{bmatrix} = \proj_{\begin{bmatrix}1\\1\\0\end{bmatrix}}\left(\begin{bmatrix}1\\3\\-1\end{bmatrix}\right) + \operatorname{perp}_{\begin{bmatrix}1\\1\\0\end{bmatrix}}\left(\begin{bmatrix}1\\3\\-1\end{bmatrix}\right)\text{.} \end{equation*}

Now it's just a matter of calculating those two vectors.

\begin{align*} \proj_{\begin{bmatrix}1\\1\\0\end{bmatrix}}\left(\begin{bmatrix}1\\3\\-1\end{bmatrix}\right) \amp = \left(\frac{\begin{bmatrix}1\\3\\-1\end{bmatrix} \cdot \begin{bmatrix}1\\1\\0\end{bmatrix}}{\begin{bmatrix}1\\1\\0\end{bmatrix}\cdot\begin{bmatrix}1\\1\\0\end{bmatrix}}\right)\begin{bmatrix}1\\1\\0\end{bmatrix}\\ \amp = \frac{4}{2}\begin{bmatrix}1\\1\\0\end{bmatrix} \\ \amp = \begin{bmatrix}2\\2\\0\end{bmatrix} \end{align*}

And

\begin{align*} \operatorname{perp}_{\begin{bmatrix}1\\1\\0\end{bmatrix}}\left(\begin{bmatrix}1\\3\\-1\end{bmatrix}\right) \amp = \begin{bmatrix}1\\3\\-1\end{bmatrix} - \proj_{\begin{bmatrix}1\\1\\0\end{bmatrix}}\left(\begin{bmatrix}1\\3\\-1\end{bmatrix}\right)\\ \amp = \begin{bmatrix}1\\3\\-1\end{bmatrix} - \begin{bmatrix}2\\2\\0\end{bmatrix}\\ \amp = \begin{bmatrix}-1\\1\\-1\end{bmatrix} \end{align*}

Here is the desired expression:

\begin{equation*} \begin{bmatrix}-1\\3\\1\end{bmatrix} = \begin{bmatrix}2\\2\\0\end{bmatrix} + \begin{bmatrix}-1\\1\\-1\end{bmatrix}\text{.} \end{equation*}

You could verify directly that \(\begin{bmatrix}-1\\1\\-1\end{bmatrix} \perp \begin{bmatrix}1\\1\\0\end{bmatrix}\text{,}\) but we don't actually need to, because in Theorem 2.2.26 we proved that the method we used here always works.

Exercises 2.2.5 Exercises

1.

Compute \(\vec{u \cdot v}\) where:
  1. \(\vec{u} = \begin{bmatrix} 2 \\ -1 \\ 3\end{bmatrix} \) and \(\vec{v} = \begin{bmatrix} -1 \\ 1 \\ 1 \end{bmatrix} \)

  2. \(\vec{u} = \begin{bmatrix} 1 \\ 2 \\ -1\end{bmatrix} \) and \(\vec{v} = \vec{u}\text{.}\)

  3. \(\vec{u} = \begin{bmatrix} 1 \\ 1 \\ -3\end{bmatrix} \) and \(\vec{v} = \begin{bmatrix} 2 \\ -1 \\ 1 \end{bmatrix} \)

  4. \(\vec{u} = \begin{bmatrix} 3 \\ -1 \\ 5\end{bmatrix} \) and \(\vec{v} = \begin{bmatrix} 6 \\ -7 \\ -5 \end{bmatrix} \)

  5. \(\vec{u} = \begin{bmatrix} x \\ y \\ z\end{bmatrix} \) and \(\vec{v} = \begin{bmatrix} a \\ b \\ c \end{bmatrix} \)

  6. \(\vec{u} = \begin{bmatrix} x \\ y \\ z\end{bmatrix} \) and \(\vec{v} = 0\)

Hint.
The dot product of two vectors is the sum of the product of the components.
Answer.
  1. \(\displaystyle 0\)

  2. \(\displaystyle 6\)

  3. \(\displaystyle -2\)

  4. \(\displaystyle 0\)

  5. \(\displaystyle x\cdot a + y\cdot b + z\cdot c\)

  6. \(\displaystyle 0\)

Solution.
Recall: the dot product of two vectors is the sum of the product of the components.
  1. \begin{align*} \vec{u}\cdot \vec{v} \amp = \begin{bmatrix} 2 \\ -1 \\ 3\end{bmatrix} \cdot \begin{bmatrix} -1 \\ 1 \\ 1 \end{bmatrix} = 2\cdot (-1) + (-1)\cdot 1 + 3\cdot 1 = -2 -1+3 = 0. \end{align*}

  2. \begin{align*} \vec{u}\cdot \vec{v} \amp = \begin{bmatrix} 1 \\ 2 \\ -1\end{bmatrix} \cdot \begin{bmatrix} 1 \\ 2 \\ -1\end{bmatrix} = 1\cdot 1 + 2\cdot 2 + (-1)\cdot (-1) = 1+4+1 = 6. \end{align*}

  3. \begin{align*} \vec{u}\cdot \vec{v} \amp = \begin{bmatrix} 1 \\ 1 \\ -3\end{bmatrix} \cdot \begin{bmatrix} 2 \\ -1 \\ 1 \end{bmatrix} = 1\cdot 2 + 1\cdot (-1) + (-3)\cdot 1 = 2-1-3=-2 \end{align*}

  4. \begin{align*} \vec{u}\cdot \vec{v} \amp = \begin{bmatrix} 3 \\ -1 \\ 5\end{bmatrix} \cdot \begin{bmatrix} 6 \\ -7 \\ -5 \end{bmatrix} = 3\cdot 6 + (-1)\cdot (-7)+5\cdot(-5)\\ \amp = 18 + 7 -25 = 0. \end{align*}

  5. \begin{align*} \vec{u}\cdot \vec{v} \amp = \begin{bmatrix} x \\ y \\ z\end{bmatrix} \cdot \begin{bmatrix} a \\ b \\ c \end{bmatrix} = x\cdot a + y\cdot b + z\cdot c. \end{align*}

  6. \begin{align*} \vec{u}\cdot \vec{v} \amp = \begin{bmatrix} x \\ y \\ z\end{bmatrix} \cdot \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} = x\cdot 0 + y\cdot 0 + z\cdot 0 = 0 + 0 + 0 = 0. \end{align*}

2.

Compute \(\norm{\vec{v}}\) if \(\vec{v}\) equals:
  1. \(\displaystyle \begin{bmatrix} 2 \\ -1 \\ 2\end{bmatrix} \)

  2. \(\displaystyle \begin{bmatrix} 1 \\ -1 \\ 2\end{bmatrix} \)

  3. \(\displaystyle \begin{bmatrix} 1 \\ 0 \\ -1\end{bmatrix} \)

  4. \(\displaystyle \begin{bmatrix} -1 \\ 0 \\ 2\end{bmatrix} \)

  5. \(\displaystyle 2\begin{bmatrix} 1 \\ -1 \\ 2\end{bmatrix} \)

  6. \(\displaystyle -3\begin{bmatrix} 1 \\ 1 \\ 2\end{bmatrix} \)

Hint.
Definition: The norm\(\norm{\vec{v}}\) of a vector \(\vec{v}\) is defined as
\begin{equation*} \norm{\vec{v}} = \sqrt{\vec{v}\cdot \vec{v}} . \end{equation*}
Answer.
  1. \(\displaystyle 3\)

  2. \(\displaystyle \sqrt{6}\)

  3. \(\displaystyle \sqrt{2}\)

  4. \(\displaystyle \sqrt{5}\)

  5. \(\displaystyle 2\sqrt{6}\)

  6. \(\displaystyle \sqrt{54}\)

Solution.
  1. \begin{align*} \norm{\vec{v}}^2 \amp = \begin{bmatrix} 2 \\ -1 \\ 2\end{bmatrix} \cdot \begin{bmatrix} 2 \\ -1 \\ 2\end{bmatrix} \\ \amp = 2\cdot 2 + (-1)\cdot (-1)+ 2\cdot 2 = 4 +1+4=9 . \end{align*}

    Therefore, \(\norm{\vec{v}}=\sqrt{\vec{v}\cdot\vec{v}} = 3\text{.}\)

  2. \begin{align*} \norm{\vec{v}}^2 \amp = \begin{bmatrix} 1 \\ -1 \\ 2\end{bmatrix} \cdot \begin{bmatrix} 1 \\ -1 \\ 2\end{bmatrix} \\ \amp = 1\cdot 1+(-1)\cdot (-1)+2\cdot 2 = 1+1+4 = 6 . \end{align*}

    Therefore, \(\norm{\vec{v}}=\sqrt{\vec{v}\cdot\vec{v}} =\sqrt{6}\text{.}\)

  3. \begin{align*} \norm{\vec{v}}^2 \amp = \begin{bmatrix} 1 \\ 0 \\ -1\end{bmatrix} \cdot \begin{bmatrix} 1 \\ 0 \\ -1\end{bmatrix} \\ \amp = 1\cdot 1+0\cdot 0+(-1)\cdot (-1) = 1+0+1 =2 . \end{align*}

    Therefore, \(\norm{\vec{v}}=\sqrt{\vec{v}\cdot\vec{v}} =\sqrt{2}\text{.}\)

  4. \begin{align*} \norm{\vec{v}}^2 \amp = \begin{bmatrix} -1 \\ 0 \\ 2\end{bmatrix} \cdot \begin{bmatrix} -1 \\ 0 \\ 2\end{bmatrix} \\ \amp = (-1)\cdot (-1) + 0\cdot 0 + 2\cdot 2 = 1+0+4 = 5 . \end{align*}

    Therefore, \(\norm{\vec{v}}=\sqrt{\vec{v}\cdot\vec{v}} =\sqrt{5}\text{.}\)

  5. \begin{align*} \norm{\vec{v}}^2 \amp = \left( 2\begin{bmatrix} 1 \\ -1 \\ 2\end{bmatrix} \right) \cdot \left( 2\begin{bmatrix} 1 \\ -1 \\ 2\end{bmatrix} \right)\\ \amp = \begin{bmatrix} 2 \\ -2 \\ 4\end{bmatrix} \cdot \begin{bmatrix} 2 \\ -2 \\ 4\end{bmatrix} \\ \amp = 2\cdot 2 + (-2)\cdot (-2) + 4\cdot 4 = 4+4+16 = 24 . \end{align*}

    Therefore, \(\norm{\vec{v}}=\sqrt{\vec{v}\cdot\vec{v}} =\sqrt{4\cdot 6}=2\sqrt{6}\text{.}\)

  6. \begin{align*} \norm{\vec{v}}^2 \amp = \left(-3\begin{bmatrix} 1 \\ 1 \\ 2\end{bmatrix} \right) \cdot \left(-3\begin{bmatrix} 1 \\ 1 \\ 2\end{bmatrix} \right)\\ \amp = \begin{bmatrix} -3 \\ -3 \\ -6\end{bmatrix} \cdot \begin{bmatrix} -3 \\ -3 \\ -6\end{bmatrix} \\ \amp = (-3)\cdot (-3) + (-3)\cdot (-3) + (-6)\cdot (-6) = 9+9+36 = 54 \end{align*}

    Therefore, \(\norm{\vec{v}}=\sqrt{\vec{v}\cdot\vec{v}} =\sqrt{54}\text{.}\)

3.

Find a unit vector in the direction of:
  1. \(\displaystyle \begin{bmatrix} 7 \\ -1 \\ 5\end{bmatrix} \)

  2. \(\displaystyle \begin{bmatrix} -2 \\ -1 \\ 2\end{bmatrix} \)

Hint 1.
Definition: A vector \(\vec{v}\) is called unit vector if \(\norm{\vec{v}}=1.\)
Hint 2.
Given a non-zero vector \(\vec{w}\text{,}\) what norm and direction does \(\vec{v}=\frac{1}{\norm{\vec{w}}}\vec{w}\) have?
Answer.
  1. \(\displaystyle \begin{bmatrix} \frac{7}{5\sqrt{3}} \\ \frac{-1}{5\sqrt{3}} \\ \frac{5}{5\sqrt{3}}\end{bmatrix} \)

  2. \(\displaystyle \begin{bmatrix} \frac{-2}{3} \\ \frac{-1}{3} \\ \frac{2}{3}\end{bmatrix} \)

Solution.
  1. We first compute the square of the norm of the vector:

    \begin{align*} \norm{\begin{bmatrix} 7 \\ -1 \\ 5\end{bmatrix} }^2 \amp = \begin{bmatrix} 7 \\ -1 \\ 5\end{bmatrix} \cdot \begin{bmatrix} 7 \\ -1 \\ 5\end{bmatrix} \\ \amp = 7^2 + (-1)^2 + 5^2 = 49+1+25 = 75, \end{align*}

    so that \(\norm{\begin{bmatrix} 7 \\ -1 \\ 5\end{bmatrix} } = \sqrt{75}=5\sqrt{3}\text{.}\) Thus, a unit vector in the same direction is given by

    \begin{equation*} \frac{1}{\norm{\begin{bmatrix} 7 \\ -1 \\ 5\end{bmatrix} }} \begin{bmatrix} 7 \\ -1 \\ 5\end{bmatrix} = \begin{bmatrix} \frac{7}{5\sqrt{3}} \\ \frac{-1}{5\sqrt{3}} \\ \frac{5}{5\sqrt{3}}\end{bmatrix} . \end{equation*}
  2. We first compute the square of the norm of the vector:

    \begin{align*} \norm{\begin{bmatrix} -2 \\ -1 \\ 2\end{bmatrix} }^2 \amp = \begin{bmatrix} -2 \\ -1 \\ 2\end{bmatrix} \cdot \begin{bmatrix} -2 \\ -1 \\ 2\end{bmatrix} \\ \amp = (-2)^2+(-1)^2+2^2 = 4+1+4 = 9 , \end{align*}

    so that \(\norm{\begin{bmatrix} -2 \\ -1 \\ 2\end{bmatrix} } = \sqrt{9}=3\text{.}\) Thus, a unit vector in the same direction is given by

    \begin{equation*} \frac{1}{\norm{\begin{bmatrix} -2 \\ -1 \\ 2\end{bmatrix} }} \begin{bmatrix} -2 \\ -1 \\ 2\end{bmatrix} = \begin{bmatrix} \frac{-2}{3} \\ \frac{-1}{3} \\ \frac{2}{3}\end{bmatrix} . \end{equation*}

4.

Find the distance between the following pairs of points:
  1. \(( 3 , -1 , 0)\) and \(( 2 , -1 , 1 )\)

  2. \(( 2 , -1 , 2)\) and \(( 2 , 0 , 1)\text{.}\)

  3. \(( -3 , 5 , 2)\) and \(( 1 , 3 , 3 )\)

  4. \(( 4 , 0 , -2)\) and \(( 3 , 2 , 0 )\)

Hint.
The distance from a point \(P\) to a point \(Q\) is the length of the vector from \(P\) to \(Q\text{.}\)
Answer.
  1. \(\displaystyle \sqrt{2}.\)

  2. \(\displaystyle \sqrt{2}.\)

  3. \(\displaystyle \sqrt{21}.\)

  4. \(\displaystyle 3.\)

Solution.
We need to find the length of the vector between the points.
  1. For \(P=( 3 , -1 , 0)\) and \(Q=( 2 , -1 , 1 )\text{,}\) we compute:

    \begin{equation*} \vect{PQ} = \begin{bmatrix} 2-3 \\ -1-(-1) \\ 1-0 \end{bmatrix} = \begin{bmatrix} -1 \\ 0 \\ 1 \end{bmatrix} . \end{equation*}
    Therefore,
    \begin{equation*} \norm{\vect{PQ}} = \sqrt{(-1)^2 + 0^2 + 1^2} = \sqrt{2}. \end{equation*}

  2. For \(P=( 2 , -1 , 2)\) and \(Q=( 2 , 0 , 1)\text{,}\) we compute:

    \begin{equation*} \vect{PQ} = \begin{bmatrix} 2-2 \\ 0-(-1) \\ 1-2 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \\ -1 \end{bmatrix} . \end{equation*}
    Therefore,
    \begin{equation*} \norm{\vect{PQ}} = \sqrt{0^2 + 1^2 + (-1)^2} = \sqrt{2}. \end{equation*}

  3. For \(P=( -3 , 5 , 2)\) and \(Q=( 1 , 3 , 3 )\text{,}\) we compute:

    \begin{equation*} \vect{PQ} = \begin{bmatrix} 1-(-3) \\ 3-5 \\ 3-2 \end{bmatrix} = \begin{bmatrix} 4 \\ -2 \\ 1 \end{bmatrix} . \end{equation*}
    Therefore,
    \begin{equation*} \norm{\vect{PQ}} = \sqrt{4^2 + 2^2 + 1^2} = \sqrt{21}. \end{equation*}

  4. For \(P=( 4 , 0 , -2)\) and \(Q=( 3 , 2 , 0 )\text{,}\) we compute:

    \begin{equation*} \vect{PQ} = \begin{bmatrix} 3-4 \\ 2-0 \\ 0-(-2) \end{bmatrix} = \begin{bmatrix} -1 \\ 2 \\ 2 \end{bmatrix} . \end{equation*}
    Therefore,
    \begin{equation*} \norm{\vect{PQ}} = \sqrt{(-1)^2 + 2^2 + 2^2} = \sqrt{9}=3. \end{equation*}

We should point out that, in each of the above cases, we could just as well have computed \(\norm{\vect{QP}}\) and would have gotten the same result.

5.

Find \(\cos(\theta)\) where \(\theta\) is the angle between the vectors
\begin{equation*} \vec{u} = \begin{bmatrix} 3 \\ -1 \\ -1 \end{bmatrix} \;\text{ and }\; \vec{v} = \begin{bmatrix} 1 \\ 4 \\ 2 \end{bmatrix} \end{equation*}
Hint.
Cosine formula: The angle between two non-zero vectors \(\vec{u}\) and \(\vec{v}\) is the number \(\theta \in [0,\pi)\) which satisfies
\begin{equation*} \cos (\theta) = \frac{ \vec{u}\cdot \vec{v}}{ \norm{\vec{u}}\cdot \norm{\vec{v}}} . \end{equation*}
Notice that \(\cdot\) in the expression \(\norm{\vec{u}}\cdot \norm{\vec{v}}\) is just multiplication of real numbers, while \(\cdot\) in the expression \(\vec{u}\cdot \vec{v}\) is the dot product of vectors.
Answer.
\begin{equation*} \cos (\theta) = \frac{-3}{ \sqrt{231}} \end{equation*}
Solution.

According to the Cosine Formula 2.2.5.5.1, we have to compute the norm of the vectors and their dot product:

\begin{align*} \norm{\vec{u}} \amp = \sqrt{\vec{u}\cdot\vec{u}} = \sqrt{ 3^2 + (-1)^2 + (-1)^2} = \sqrt{11}\\ \norm{\vec{v}} \amp = \sqrt{\vec{v}\cdot\vec{v}} = \sqrt{ 1^2 + 4^2 + 2^2} = \sqrt{21}\\ \vec{u}\cdot\vec{v} \amp = 3\cdot 1 + (-1)\cdot 4 + (-1)\cdot 2 = -3 \end{align*}

Therefore,

\begin{equation*} \cos (\theta) = \frac{ \vec{u}\cdot \vec{v}}{ \norm{\vec{u}}\cdot \norm{\vec{v}}} = \frac{-3}{ \sqrt{11}\cdot \sqrt{21}} = \frac{-3}{ \sqrt{231}} . \end{equation*}

6.

Find the angle between the vectors
\begin{equation*} \vec{u} = \begin{bmatrix} 1 \\ -2 \\ 1 \end{bmatrix} \;\text{ and }\; \vec{v} = \begin{bmatrix} 1 \\ 2 \\ -7 \end{bmatrix} \end{equation*}
Hint.
Look back at the Cosine Formula 2.2.5.5.1.
Answer.
\begin{equation*} \theta =\mathrm{arcos} \left(\frac{-5}{9}\right) \end{equation*}
Solution.

According to the Cosine Formula 2.2.5.5.1, we have to compute the norm of the vectors and their dot product:

\begin{align*} \norm{\vec{u}} \amp = \sqrt{\vec{u}\cdot\vec{u}} = \sqrt{ 1^2 + (-2)^2 + 1^2} = \sqrt{6}\\ \norm{\vec{v}} \amp = \sqrt{\vec{v}\cdot\vec{v}} = \sqrt{ 1^2 + 2^2 + (-7)^2} = \sqrt{54}\\ \vec{u}\cdot\vec{v} \amp = 1\cdot 1 + (-2)\cdot 2 + 1\cdot (-7) = -10 \end{align*}

Therefore,

\begin{equation*} \cos (\theta) = \frac{ \vec{u}\cdot \vec{v}}{ \norm{\vec{u}}\cdot \norm{\vec{v}}} = \frac{-10}{ \sqrt{6}\cdot \sqrt{54}} = \frac{-10}{18} = \frac{-5}{9} \end{equation*}

and

\begin{equation*} \theta =\mathrm{arcos} \left(\frac{-5}{9}\right) . \end{equation*}

7.

Find all real numbers \(x\) such that:
  1. \(\begin{bmatrix} 2 \\ -1 \\ 3 \end{bmatrix} \) and \(\begin{bmatrix} x \\ -2 \\ 1 \end{bmatrix} \) are orthogonal.

  2. \(\begin{bmatrix} 2 \\ -1 \\ 1 \end{bmatrix} \) and \(\begin{bmatrix} 1 \\ x \\ 2 \end{bmatrix} \) are at an angle of \(\frac{\pi}{3}\text{.}\)

Hint 1.
Two vectors \(\vec{u}\) and \(\vec{v}\) are called orthogonal if their dot product is zero, i.e. \(\vec{u}\cdot \vec{v} = 0\text{.}\)
Hint 2.
Look back at the Cosine Formula 2.2.5.5.1.
Answer.
  1. \(\displaystyle x=\frac{-5}{2}\)

  2. \(x=1\) and \(x=-17\)

Solution.
  1. We want the dot product of the two vectors to be zero, i.e. we want

    \begin{equation*} 0 \stackrel{!}{=} \begin{bmatrix} 2 \\ -1 \\ 3 \end{bmatrix} \cdot \begin{bmatrix} x \\ -2 \\ 1 \end{bmatrix} = 2x + (-1)(-2) + 3\cdot 1 = 2x + 5 \end{equation*}

    Thus, we need \(x=\frac{-5}{2}\text{.}\)

  2. To use the Cosine Formula 2.2.5.5.1, we have to compute the norm of the vectors and their dot product:

    \begin{align*} \norm{\begin{bmatrix} 2 \\ -1 \\ 1 \end{bmatrix} } \amp = \sqrt{\begin{bmatrix} 2 \\ -1 \\ 1 \end{bmatrix} \cdot\begin{bmatrix} 2 \\ -1 \\ 1 \end{bmatrix} } = \sqrt{ 2^2 + (-1)^2 + 1^2} = \sqrt{6}\\ \norm{\begin{bmatrix} 1 \\ x \\ 2 \end{bmatrix} } \amp = \sqrt{\begin{bmatrix} 1 \\ x \\ 2 \end{bmatrix} \cdot\begin{bmatrix} 1 \\ x \\ 2 \end{bmatrix} } = \sqrt{ 1^2 + x^2 + 2^2} = \sqrt{5+x^2}\\ \begin{bmatrix} 2 \\ -1 \\ 1 \end{bmatrix} \cdot \begin{bmatrix} 1 \\ x \\ 2 \end{bmatrix} \amp = 2\cdot 1 + (-1)\cdot x + 1\cdot 2 = 4-x \end{align*}

    Therefore,

    \begin{equation*} \cos (\theta) \stackrel{!}{=} \frac{ 4-x }{\sqrt{6}\sqrt{5+x^2}}, \text{ i.e. } \cos (\theta)\sqrt{6}\sqrt{5+x^2} \stackrel{!}{=} 4-x . \end{equation*}

    Since \(\cos (\frac{\pi}{3}) = \frac{1}{2}\text{,}\) we can rewrite that to

    \begin{equation} \sqrt{6(5+x^2)} \stackrel{!}{=} 2(4-x) = 8-2x .\tag{2.2.1} \end{equation}

    If we square both sides of this equation, we get

    \begin{align*} \amp 6(5+x^2) = 30 + 6x^2 \stackrel{!}{=} (8-2x)^2 = 64 - 32x + 4x^2\\ \iff\amp -34 + 32x + 2x^2 \stackrel{!}{=} 0\\ \iff\amp -17 + 16x + x^2 \stackrel{!}{=} 0\\ \iff\amp x \stackrel{!}{=} -\frac{16}{2} \pm \sqrt{ \left(\frac{16}{2}\right)^2 - (-17) } = -8 \pm \sqrt{ 81 } = -8 \pm 9\\ \iff\amp x \stackrel{!}{=} 1 \text{ or } x \stackrel{!}{=} -17 \end{align*}

    Therefore, the answer is: for \(x=1\) and \(x=-17\text{,}\) the angle between the two vectors is \(\frac{\pi}{3}\text{.}\)

8.

Find the \(\operatorname{proj}_{\vec{v}}(\vec{w})\) where
\begin{equation*} \vec{w} = \begin{bmatrix} 1 \\ 0 \\ -2 \end{bmatrix} , \vec{v} = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} \end{equation*}
Hint.
Definition: If \(\vec{v}\) and \(\vec{w}\) are two vectors in \(\mathbb{R}^n\) and \(\vec{v}\neq \vec{0}\text{,}\) then the projection of \(\vec{w}\) onto \(\vec{v}\) is the vector \(\operatorname{proj}_{\vec{v}}(\vec{w})\) defined by
\begin{equation*} \operatorname{proj}_{\vec{v}}(\vec{w}) = \left( \frac{\vec{v}\cdot \vec{w}}{\vec{v}\cdot \vec{v}} \right) \vec{v} . \end{equation*}
Answer.
\(\operatorname{proj}_{\vec{v}}(\vec{w}) = \vec{v} = \begin{bmatrix} \frac{-5}{14} \\ \frac{-10}{14} \\ \frac{-15}{14} \end{bmatrix} \)
Solution.
Since
\begin{equation*} \operatorname{proj}_{\vec{v}}(\vec{w}) = \left( \frac{\vec{v}\cdot \vec{w}}{\vec{v}\cdot \vec{v}} \right) \vec{v} , \end{equation*}
we should first compute the dot products:
\begin{align*} \vec{v}\cdot \vec{w} \amp = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 0 \\ -2 \end{bmatrix} = 1\cdot 1 + 2\cdot 0 + 3\cdot (-2) = -5,\\ \vec{v}\cdot \vec{v} \amp = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} = 1^2 + 2^2 + 3^2 = 14, \text{ and so }\\ \amp \frac{\vec{v}\cdot \vec{w}}{\vec{v}\cdot \vec{v}} = \frac{-5}{14} . \end{align*}
Therefore,
\begin{equation*} \operatorname{proj}_{\vec{v}}(\vec{w}) = \frac{-5}{14} \vec{v} = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} = \vec{v} = \begin{bmatrix} \frac{-5}{14} \\ \frac{-10}{14} \\ \frac{-15}{14} \end{bmatrix} . \end{equation*}

9.

Decompose the vector \(\vec{v}\) into \(\vec{v} = \vec{a}+\vec{b}\) where \(\vec{a}\) is parallel to \(\vec{u}\) and \(\vec{b}\) is perpendicular to \(\vec{u}\text{.}\)
\begin{equation*} \vec{u} = \begin{bmatrix} 3 \\ 2\\ -5 \end{bmatrix} , \vec{v} = \begin{bmatrix} 1 \\ -1 \\ 2 \end{bmatrix} \end{equation*}
Hint 1.
Write down the definition of \(``\vec{a}\) is parallel to \(\vec{u}"\) and use the condition \(``\vec{v} = \vec{a}+\vec{b}"\) to find a formula for \(\vec{b}\) as linear combination of \(\vec{v}\) and \(\vec{u}\text{.}\)
Hint 2.
Write down the definition of \(``\vec{b}\) is perpendicular to \(\vec{u}"\text{,}\) and then replace \(\vec{b}\) with your solution to Hint 2.2.5.9.1.
Answer.
\(\vec{a} = \begin{bmatrix} \frac{-27}{38} \\ \frac{-18}{38}\\ \frac{45}{38}\end{bmatrix} \text{,}\) \(\vec{b}= \begin{bmatrix} \frac{65}{38} \\ \frac{-20}{38}\\ \frac{31}{38}\end{bmatrix} \)
Solution.
We require \(\vec{a}\) to be parallel to \(\vec{u}\text{,}\) i.e. \(\vec{a} = c \vec{u}\) for some real number \(c\) that is yet to be determined. Plugging that into \(\vec{v} = \vec{a}+\vec{b}\text{,}\) we get a definition of \(\vec{b}\) that also depends on \(c\text{:}\) \(\vec{b} = \vec{v} - c \vec{u}\text{.}\) As \(\vec{b}\) needs to be orthogonal to \(\vec{u}\text{,}\) we want \(\vec{b}\cdot \vec{u}=0\text{.}\) If we plug our tentative solution for \(\vec{b}\) into this, we get
\begin{equation*} (\vec{v} - c \vec{u})\cdot \vec{u}=0 . \end{equation*}
Using the properties of the dot product, we arrive at
\begin{equation*} \vec{v}\cdot \vec{u} = c \vec{u}\cdot \vec{u}, \text{ i.e. } c = \frac{\vec{v}\cdot \vec{u}}{\vec{u}\cdot \vec{u}} \text{ using that }\vec{u}\neq \vec{0} . \end{equation*}
We can now compute both sides and get a value for \(c\text{:}\)
\begin{align*} \vec{v}\cdot \vec{u} \amp = \begin{bmatrix} 1 \\ -1 \\ 2 \end{bmatrix} \cdot \begin{bmatrix} 3 \\ 2\\ -5 \end{bmatrix} = 1\cdot 3 + (-1)\cdot 2 + 2\cdot (-5) = -9,\\ \vec{u}\cdot \vec{u} \amp = \begin{bmatrix} 3 \\ 2\\ -5 \end{bmatrix} \cdot \begin{bmatrix} 3 \\ 2\\ -5 \end{bmatrix} = 3^2 + 2^2 + (-5)^2 = 38, \text{ so that } \end{align*}
\begin{equation*} c = \frac{-9}{38}. \end{equation*}
We can now solve for our vectors \(\vec{a}\) and \(\vec{b}\text{:}\)
\begin{gather*} \vec{a} = c \vec{u} = \frac{-9}{38}\begin{bmatrix} 3 \\ 2\\ -5 \end{bmatrix} = \begin{bmatrix} \frac{-27}{38} \\ \frac{-18}{38}\\ \frac{45}{38}\end{bmatrix} \\ \vec{b} = \vec{v} - \vec{a} = \begin{bmatrix} 1 \\ -1 \\ 2 \end{bmatrix} - \begin{bmatrix} \frac{-27}{38} \\ \frac{-18}{38}\\ \frac{45}{38}\end{bmatrix} = \begin{bmatrix} \frac{65}{38} \\ \frac{-20}{38}\\ \frac{31}{38}\end{bmatrix} . \end{gather*}
Let us do a sanity check: Is our \(\vec{b}\) indeed orthogonal to \(\vec{u}\text{?}\) We compute:
\begin{align*} \vec{b}\cdot \vec{u} \amp = \begin{bmatrix} \frac{65}{38} \\ \frac{-20}{38}\\ \frac{31}{38}\end{bmatrix} \cdot \begin{bmatrix} 3 \\ 2\\ -5 \end{bmatrix} = \frac{65}{38} \cdot 3 + \frac{-20}{38}\cdot 2 + \frac{31}{38}\cdot (-5)\\ \amp = \frac{195-40-155}{38} = 0, \end{align*}
so yes!

10.

  1. Show that, of the four diagonals of a cube, no pair is perpendicular.

  2. Show that each diagonal is perpendicular to the face diagonals it does not meet.

11.

Show that \(\norm{\vec{u}} = \norm{\vec{v}}\) if and only if \(\vec{u} + \vec{v}\) and \(\vec{u} - \vec{v}\) are perpendicular. Give an example in \(\mathbb{R}^2\text{.}\)
Hint 1.
Remember that an if and only if statement goes both ways.
Hint 2.
Use the properties of the dot product to find a formula for the dot product of \(\vec{u} + \vec{v}\) and \(\vec{u} - \vec{v}\) in terms of \(\vec{u}\) and \(\vec{v}\text{.}\)
Solution.

Since we are making a claim about the dot product of \(\vec{u} + \vec{v}\) and \(\vec{u} - \vec{v}\text{,}\) let us use the properties of the dot product to simplify it:

\begin{align} (\vec{u} + \vec{v})\cdot(\vec{u} - \vec{v}) \amp = (\vec{u} + \vec{v})\cdot\vec{u} - (\vec{u} + \vec{v})\cdot\vec{v} \amp\amp (\text{Distributivity})\notag\\ \amp = (\vec{u}\cdot\vec{u} + \vec{v}\cdot\vec{u}) - (\vec{u}\cdot\vec{v} + \vec{v}\cdot\vec{v}) \amp\amp (\text{Distributivity})\notag\\ \amp = \norm{\vec{u}}^2 + \vec{v}\cdot\vec{u} - \vec{u}\cdot\vec{v} - \norm{\vec{v}}^2 \amp\amp (\text{definition of } \norm{\cdot})\notag\\ \amp = \norm{\vec{u}}^2 + \vec{u}\cdot \vec{v} - \vec{u}\cdot\vec{v} - \norm{\vec{v}}^2 \amp\amp (\text{Commutativity})\notag\\ \amp = \norm{\vec{u}}^2 - \norm{\vec{v}}^2 .\tag{2.2.2} \end{align}

The two vectors being perpendicular means exactly that their dot product is zero, i.e.

\begin{equation*} (\vec{u} + \vec{v})\perp (\vec{u} - \vec{v}) \iff (\vec{u} + \vec{v})\cdot(\vec{u} - \vec{v}) = 0 \end{equation*}

By (2.2.2), this happens if and only if \(\norm{\vec{u}}^2 - \norm{\vec{v}}^2 = 0\text{,}\) or in other words:

\begin{equation*} (\vec{u} + \vec{v})\perp (\vec{u} - \vec{v}) \iff \norm{\vec{u}}^2 = \norm{\vec{v}}^2 \iff \norm{\vec{u}}= \norm{\vec{v}} , \end{equation*}

as claimed.

For example, the vectors \(\vec{u} = \begin{bmatrix} 3 \\ 4 \end{bmatrix} \) and \(\vec{v} = \begin{bmatrix} 5 \\ 0 \end{bmatrix} \) have the same norm since

\begin{equation*} \norm{\vec{u}}^2 = \vec{u}\cdot \vec{u} = 3^2 + 4^2 = 25 \;\text{ and }\; \norm{\vec{v}}^2 = \vec{v}\cdot \vec{v} = 5^2 + 0^2 = 25 . \end{equation*}

We check that indeed

\begin{align*} (\vec{u} + \vec{v})\cdot (\vec{u} - \vec{v}) \amp = \left( \begin{bmatrix} 3 \\ 4 \end{bmatrix} + \begin{bmatrix} 5 \\ 0 \end{bmatrix} \right) \cdot \left( \begin{bmatrix} 3 \\ 4 \end{bmatrix} - \begin{bmatrix} 5 \\ 0 \end{bmatrix} \right)\\ \amp = \begin{bmatrix} 3+5 \\ 4+0 \end{bmatrix} \cdot \begin{bmatrix} 3-5 \\ 4-0 \end{bmatrix} = \begin{bmatrix} 8 \\ 4 \end{bmatrix} \cdot \begin{bmatrix} -2 \\ 4 \end{bmatrix} \\ \amp = 8\cdot (-2) + 4\cdot 4 = 0. \end{align*}

12.

If the diagonals of a parallelogram have equal length, show that the parallelogram is a rectangle.
Hint 1.
Let two adjacent sides of the parallelogram be described by vectors \(\vec{x}\) and \(\vec{y}\text{.}\) What does it mean, in terms of \(\vec{x}\) and \(\vec{y}\text{,}\) that the parallelogram is a rectangle?
Hint 2.
It might help to look back at Exercise 2.2.5.11.
Solution.
To show that a parallelogram is a rectangle, we need to see that the enclosed angles are \(90^\circ\text{.}\) If we think of two adjacent sides of the parallelogram as vectors \(\vec{x}\) and \(\vec{y}\text{,}\) then its other two sides are translates of \(\vec{x}\) and \(\vec{y}\text{,}\) as depicted in Figure 2.2.28:

Figure 2.2.28. A parallelogram with \(\vec{x}\) and \(\vec{y}\) as two adjacent sides

We now see that the two diagonals can be described by the vectors \(\vec{x}+\vec{y}\) and \(\vec{x} - \vec{y}\text{:}\)

Figure 2.2.29. The diagonals of the parallelogram from Figure 2.2.28

If we assume that our parallelogram's diagonals have the same length, then by the above argument, that means that \(\norm{\vec{x}+\vec{y}} = \norm{\vec{x}-\vec{y}}\text{.}\) We can therefore apply Exercise 2.2.5.11 to the vectors \(\vec{u}:= \vec{x}+\vec{y}\) and \(\vec{v}:= \vec{x} - \vec{y}\text{:}\) Since \(\norm{\vec{u}} = \norm{\vec{v}}\text{,}\) we conclude that \(\vec{u} + \vec{v}\) and \(\vec{u} - \vec{v}\) are orthogonal. Plugging in the definition of \(\vec{u}\) and \(\vec{v}\text{,}\) this means that
\begin{equation*} (\vec{x}+\vec{y}) + (\vec{x} - \vec{y}) = 2\vec{x} \end{equation*}
and
\begin{equation*} (\vec{x}+\vec{y}) - (\vec{x} - \vec{y}) = 2\vec{y} \end{equation*}
are orthogonal, and therefore, so are \(\vec{x}\) and \(\vec{y}\text{.}\) Since two adjacent sides of the parallelogram are orthogonal, it is a rectangle.