Angles and Projections
Vectors store both magnitude and direction. In the previous chapter, we learned how to calculate magnitude. But how can we compare directions? For example, how can we measure the angle between two vectors, decide whether they are perpendicular, or determine how much one vector points along another?
All of these questions will be answered by one operation: the dot product.
3.1The Dot Product
The dot product is an operation which takes in two vectors and outputs a single number. We will use it as a tool to measure several things, but it is perhaps easiest to learn by diving right in with the definition.
Definition 3.1 (Dot Product). If
For example, the dot product of
The dot product of
We will soon unpack much more of the geometry hidden inside this simple definition, but a first thing to notice is that the magnitude of a vector can be recovered from its dot product with itself.
Theorem 3.2 (Magnitude from the Dot Product). If
Indeed, if
Thus the dot product contains the length information we developed in Chapter 2.
Exercise 3.3. Check that this formula gives the expected magnitude for the vector
The dot product is built from the multiplication and addition of ordinary numbers, so it also inherits many of their algebraic properties.
Theorem 3.4 (Properties of the Dot Product). If
and
3.2Measuring Angles
We have already seen that the dot product of a vector with itself measures the square of its magnitude. But dot products are also able to recover direction information.
Theorem 3.5 (Angles and the Dot Product). If
Rearranging this gives a formula which computes the angle using only vector operations:
The nonzero hypothesis matters because the zero vector has no direction, so
there is no angle between
The figure below calculates the same dot product in two ways. Drag either vector through a right angle and watch what happens to the sign.
This sign test follows immediately from the angle formula. The magnitudes are
positive, so the sign of
Exercise 3.6 (Angles Between Vectors). What is the angle between
What is the angle between
One particularly important angle deserves its own word.
Definition 3.7 (Orthogonality). Two vectors are called orthogonal if their dot product is zero. For nonzero
vectors, this is equivalent to the angle between them being
The zero vector dotted with any other vector is zero, so we say the zero vector is orthogonal to every vector. This is an algebraic convention: geometrically, the zero vector has no direction and therefore makes no angle at all.
For a fixed nonzero vector
3.3Projections and Orthogonal Decomposition
One very useful application of the dot product is to help measure “how much of
the vector
If
Definition 3.8 (Scalar Projection). For
The scalar projection is a signed number. Its absolute value says how much of
Exercise 3.9 (Scalar Projections). What is the scalar projection of
What is the scalar projection of
This tells us how much of a vector points in a given direction, so the answer
is a scalar, or number. Often it is useful to compute a vector whose direction
lies along
Definition 3.10 (Vector Projection). For
The projection captures the part of
This remainder is orthogonal to
Thus every vector can be broken into one piece parallel to
Theorem 3.11 (Orthogonal Decomposition). If
The figure below holds all three ideas at once: a signed scalar projection, a
vector projection, and the perpendicular remainder. Drag
Example 3.12 (Projection and Decomposition). Project
First compute
Therefore
Subtracting this from
As a check,
so the remainder really is orthogonal to
Remark 3.13 (Direction Angles (Optional)). If
This confirms our original interpretation of the components:
If
These three numbers are called the direction cosines of
The dot product turns questions about direction into calculations with components. It measures angles, detects orthogonality, and splits vectors into parallel and perpendicular pieces. In the next chapter, we will develop a different operation that measures the area and orientation determined by two vectors.