The Dot Product

Posted on Wed 12 September 2018 in Thesis

Before the hiatus, we began discussing the geometry of vectors in three dimensions. At the end of that post, we discussed why it was impossible to define a multiplication operation on \(\mathbb{R}^3\) that also has an inverse (division) operation. However, there are still two useful "product" operations involving three-dimensional vectors. These operations aren't true multiplication operations, in that they don't have an inverse division operation, but they are still useful for understanding three-dimensional geometry. In this post we'll learn about the first of them, the so-called dot product.

Motivation - Distance and Angles

In the last section, we visualized \(\mathbb{R}^3\), the set of triples of real numbers, by considering vectors as arrows in three-dimensional space. Implicit in this description are notions of angle and distance. After all, in order to visualize the vector \((1, 2, 3)\) as an arrow in the three-dimensional coordinate system, we need first to set up three perpendicular axes (that is, the angle between each pair of axes is \(90^\circ\)), then draw tick marks along each axis at a fixed distance. Said another way, when we do this procedure we are declaring that the vectors \(\mathbf{e}_1 = (1,0,0), \mathbf{e}_2 = (0,1,0)\), and \(\mathbf{e}_3 = (0,0,1)\) should be understood geometrically as arrows of unit length that are pairwise perpendicular. As a note on terminology, we say that the collection of vectors \(\mathbf{e}_1, \mathbf{e}_2, \mathbf{e}_3\) is an orthonormal basis. "Orthonormal" is a combination of orthogonal, which is a synonym for perpendicular, while normal means that each vector is of unit length. ("Basis" has a technical meaning that we don't need to get into right now.)

The important point here is that this is an extra piece of information. Considered on its own, the triple of numbers \((1,2,3)\) has no inherent geometrical meaning. Similarly, considering \(\mathbb{R}^3\) as just a set of triples of real numbers gives it no geometrical meaning. Geometry requires some notion of measurement of distances - after all, the word geometry itself comes from Greek for "Earth measurement". We have to make some extra choices to give the set \(\mathbb{R}^3\) geometric structure. One possible choice is to declare that the vectors \(\mathbf{e}_1, \mathbf{e}_2,\) and \(\mathbf{e}_3\) are to be considered orthonormal. This allows us to consider all vectors as arrows, and then consider angles and distances in the usual way.

For example, this choice allows us to say that then length of the vector \((1,2,3)\) is \(\sqrt{14}\). We can find this by repeatedly using the Pythagorean theorem, as illustrated below.

Finding Lengths in R3

Finding Vector Lengths in \(\mathbb{R}^3\)

In this picture, the two black lines run parallel to the \(x\) and \(y\) axes, so are easily seen to have lengths 1 and 2. They form a right triangle, with hypotenuse of length \(\sqrt{1^2 + 2^2} = \sqrt{5}\) by the Pythagorean theorem. This hypotenuse is shown in orange. The orange and blue lines themselves form a right triangle, of which the red vector \((1,2,3)\) is the hypotenuse. The blue line is parallel to the \(z\) axis, so we can see that it has length \(3\), and so the red vector has length

\begin{equation*} \sqrt{ \sqrt{5}^2 + 3^3 } = \sqrt{5 + 9} = \sqrt{14} \end{equation*}

as we said before. We could use a similar procedure of breaking down vectors into their components in the \(x, y, z\) directions (which are the same as the \(\mathbf{e}_1, \mathbf{e}_2, \mathbf{e}_3\) directions) to find the length of any vector \((v_1, v_2, v_3)\), which we will write as \(\|\mathbf{v} \|\), to be

\begin{equation*} \|\mathbf{v} \| = \sqrt{v_1^2 + v_2^2 + v_3^2} \end{equation*}

Similarly, we could also find angles between vectors using similar arguments. These methods for computing lengths and angles are unified and made simpler using an operation called the dot product.

Definition of the Dot Product

Given two vectors \(\mathbf{v} = (v_1, v_2, v_3)\) and \(\mathbf{w} = (w_1, w_2, w_3)\), we define their dot product to be the number

\begin{equation*} \mathbf{v} \cdot \mathbf{w} = v_1 w_1 + v_2 w_2 + v_3 w_3 \end{equation*}

First, notice that this product operation is of a different type than the multiplication operation we wish that we could define. The dot product operation takes in two vectors and returns a single number. A multiplication operation that generalized the multiplication of complex numbers to three dimensions would be an operation that takes in two (3-dimensional) vectors and returned a third vector.

From the formula, it is easy to check that this product operation has many of the nice properties we might expect. It is commutative, that is,

\begin{equation*} \mathbf{v} \cdot \mathbf{w} = \mathbf{w} \cdot \mathbf{v}, \end{equation*}

and is distributive with respect to vector addition, that is,

\begin{equation*} (\mathbf{v}_1 + \mathbf{v}_2) \cdot \mathbf{w} = \mathbf{v}_1 \cdot \mathbf{w} + \mathbf{v}_2 \cdot \mathbf{w} \end{equation*}

As mentioned above, the dot product can be used to measure distances and angles. First, it can be used to find the length of a vector, since

\begin{equation*} \mathbf{v} \cdot \mathbf{v} = v_1^2 + v_2^2 + v_3^2 = \|\mathbf{v} \|^2, \end{equation*}

that is, taking the dot product of a vector with itself gives the square of the length.

This allows us to find distances more generally. Given two points \(p_1, p_2\) in three-dimensional space, we can consider the vectors \(\mathbf{w}_1, \mathbf{w}_2\) that go from the origin to those points. The difference \(\mathbf{w}_2 - \mathbf{w}_1\) is a vector pointing from \(p_1\) to \(p_2\), and so the length of the vector gives the distance between those point. If we use \(d(\mathbf{w}_1, \mathbf{w}_2)\) to denote the distance between the endpoints of the vectors \(\mathbf{w}_1, \mathbf{w}_2\), we have that

\begin{equation*} d(\mathbf{w}_1, \mathbf{w}_2) = \| \mathbf{w}_2 - \mathbf{w}_1 \| \end{equation*}

We can also use the dot product to find the angle between two vectors. Given two vectors \(\mathbf{v}\) and \(\mathbf{w}\), the angle \(\theta\) between these two vectors is given by the formula

\begin{equation*} \cos \theta = \frac{\mathbf{v} \cdot \mathbf{w}}{\|\mathbf{v}\| \, \|\mathbf{w}\|} \end{equation*}

As a special case, we can see that this means that \(\mathbf{v} \cdot \mathbf{w} = 0\) exactly when \(\theta = 90^\circ\), i.e., when the two vectors are orthogonal.

Why is this formula for the dot product correct? It goes back to the fact that the distances and angles are determined by declaring \(\mathbf{e}_1 = (1,0,0), \mathbf{e}_2 = (0,1,0),\) and \(\mathbf{e_3} = (0,0,1)\) to be orthonormal. We've defined the formula for the dot product exactly to make this so. For example,

\begin{equation*} \mathbf{e}_1 \cdot \mathbf{e}_1 = 1^2 + 0^2 + 0^2 = 1, \end{equation*}

as needed, and

\begin{equation*} \mathbf{e_2} \cdot \mathbf{e}_3 = 0 \cdot 0 + 1 \cdot 0 + 0 \cdot 1 = 0, \end{equation*}

with similar statements for the other vectors \(\mathbf{e}_2, \mathbf{e}_3\) and the other pairs.

Generalizations

This definition of the dot product in three dimensions has a number of different generalizations.

First, we observe that in our arguments above we gave \(\mathbf{R}^3\) a geometric structure by declaring a set of orthonormal vectors \(\mathbf{e}_1, \mathbf{e}_2, \mathbf{e}_3\). We then showed that the distances and angles between vectors that arise from those choices can be summarized by the dot product.

This also works in reverse. Given the set \(\mathbf{R}^3\), we can define a dot product on \(\mathbf{R}^3\) as above, and then use that dot product to define lengths and angles. With distances and angles defined in this way, the vectors \(\mathbf{e}_1, \mathbf{e}_2, \mathbf{e}_3\) are orthonormal. Defining a dot product and defining an orthonormal basis are essentially equivalent processes.

The idea of giving a space a geometry by defining a dot product can be generalized to the notion of inner product spaces. These are sets equipped with an operation called an "inner product" that behaves like the dot product, which gives a way to measure lengths and distances in that space. We'll return to inner product spaces later in this series.

Finally, although we defined the dot product for three-dimensional vectors since we're considering product operations in three dimensions, we can in fact define a dot product operation for any of the spaces \(\mathbb{R}^k\) we defined in the previous post. Given two elements of \(\mathbf{v} = (v_1, \ldots, v_k)\) and \(\mathbf{w} = (w_1, \ldots, w_k)\) of \(\mathbb{R}^k\), their dot product is

\begin{equation*} \mathbf{v} \cdot \mathbf{w} = v_1 w_1 + \cdots + v_k w_k \end{equation*}

The set \(\mathbb{R}^k\) along with the geometric structure that arises from the dot product is called "\(K\)-dimensional Euclidean space." It is named after Euclid, the ancient Greek mathematician who formalized the standard, two-dimensional geometry taught in high school. These geometries are all examples of the flat geometries discussed in the introductory post in this series.

This dot product is just one way, however, to take the set \(\mathbb{R}^k\) and define a geometric structure on it that allows us to compute the distance between two points. Using other distance functions can give us other, curved geometries, analogous to the sphere or saddle depicted in that introductory post. This will be hugely important later, but we'll get to that after we finish describing the geometrical interpretation of the quaternions that we're working toward.

Next Time - The Cross Product

The dot product is a product operation that takes in two vectors and returns a number, and is used to measure distances and angles in \(\mathbb{R}^3\) so that we can consider the geometry of that space. There is a second product operation on \(\mathbb{R}^3\), however, that takes in two vectors and gives back a third vector. This "cross product" is the final piece of 3-dimensional geometry we'll need to be able to understand the 4-dimensional quaternions.