3 · Angles and Projections
Chapter 3

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 𝑢 =𝑢1,𝑢2,,𝑢𝑛 and 𝑣 =𝑣1,𝑣2,,𝑣𝑛, then the dot product of 𝑢 and 𝑣 is the scalar

𝑢𝑣=𝑢1𝑣1+𝑢2𝑣2++𝑢𝑛𝑣𝑛=𝑛𝑖=1𝑢𝑖𝑣𝑖.

For example, the dot product of 1,2 and 3,4 is

1,23,4=1×3+2×4=3+8=11.

The dot product of ˆı ˆȷ and 2ˆı ˆȷ +3ˆ𝑘 can be computed by either converting to coordinate notation or pairing up the coefficients and multiplying:

(ˆıˆȷ)(2ˆıˆȷ+3ˆ𝑘)=(1×2)+(1×1)+(0×3)=3.

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 𝑢 is any vector, then

𝑢=𝑢𝑢.

Indeed, if 𝑢 =𝑢1,𝑙𝑑𝑜𝑡𝑠,𝑢𝑛, then

𝑢𝑢=𝑢21++𝑢2𝑛=𝑢2.

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 𝑥,𝑦,𝑧 in 3.

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 𝑤 are vectors and 𝑐 is a scalar, then

0𝑢=0,𝑢𝑣=𝑣𝑢,
𝑢(𝑣+𝑤)=𝑢𝑣+𝑢𝑤,

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 𝑢 and 𝑣 are nonzero vectors, their dot product is related to the angle 𝜃 between them by

𝑢𝑣=𝑢𝑣cos𝜃.

Rearranging this gives a formula which computes the angle using only vector operations:

cos𝜃=𝑢𝑣𝑢𝑣.

The nonzero hypothesis matters because the zero vector has no direction, so there is no angle between 0 and another vector.

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.

Figure 3.1 The coordinate sum and the geometric formula always give the same number. The dot product is positive when the angle is acute, zero when the vectors are perpendicular, and negative when the angle is obtuse.

This sign test follows immediately from the angle formula. The magnitudes are positive, so the sign of 𝑢 𝑣 is the sign of cos𝜃.

Exercise 3.6 (Angles Between Vectors). What is the angle between 1,2 and 3,4 in radians?

What is the angle between ˆı +ˆȷ and ˆȷ in degrees?

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 90, or 𝜋/2 radians.

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 𝑢, there is usually a whole collection of vectors orthogonal to it. What does this collection look like? In the plane it forms a line, while in three-dimensional space it forms a plane.

Figure 3.2 In 2, all vectors satisfying 𝑢 𝑤 =0 lie along one line through the origin. In 3, they fill an entire plane perpendicular to 𝑢. This is the geometry we will use to describe planes in Chapter 5.

3.3Projections and Orthogonal Decomposition

One very useful application of the dot product is to help measure “how much of the vector 𝑣 is pointed in the direction 𝑢?”

If ˆ𝑢 is a unit vector, this amount is simply the dot product 𝑣 ˆ𝑢. If 𝑢 is not a unit vector to start with, we first make it into one by dividing by its magnitude:

𝑣ˆ𝑢=𝑣𝑢𝑢.

Definition 3.8 (Scalar Projection). For 𝑢 0, the scalar projection of 𝑣 onto 𝑢 is

comp𝑢(𝑣)=𝑣𝑢𝑢.

The scalar projection is a signed number. Its absolute value says how much of 𝑣 points along the line determined by 𝑢; its sign records which of the two directions along that line it points.

Exercise 3.9 (Scalar Projections). What is the scalar projection of 1,2 onto 3,4?

What is the scalar projection of 4,3, 2 onto 0,1,0?

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 𝑢 and whose signed length is the scalar we just computed. This vector can be thought of as the projection of 𝑣 onto 𝑢, or the shadow of 𝑣 on the line spanned by 𝑢.

Definition 3.10 (Vector Projection). For 𝑢 0, the vector projection of 𝑣 onto 𝑢 is the scalar projection times the unit vector in the direction of 𝑢:

proj𝑢(𝑣)=comp𝑢(𝑣)ˆ𝑢=(𝑣𝑢𝑢)𝑢𝑢=𝑣𝑢𝑢𝑢𝑢.

The projection captures the part of 𝑣 parallel to 𝑢. What is left over is

𝑣=𝑣proj𝑢(𝑣).

This remainder is orthogonal to 𝑢, since

𝑢𝑣=𝑢𝑣𝑢(𝑣𝑢𝑢𝑢𝑢)=𝑢𝑣𝑣𝑢=0.

Thus every vector can be broken into one piece parallel to 𝑢 and one piece perpendicular to it.

Theorem 3.11 (Orthogonal Decomposition). If 𝑢 0, then

𝑣=proj𝑢(𝑣)+𝑣,𝑢𝑣=0.

The figure below holds all three ideas at once: a signed scalar projection, a vector projection, and the perpendicular remainder. Drag 𝑣 past a right angle to see why the scalar projection needs a sign.

Figure 3.3 The shadow of 𝑣 on the line spanned by 𝑢 is proj𝑢(𝑣). Its signed length is comp𝑢(𝑣), and the vector from the shadow to 𝑣 is the perpendicular remainder 𝑣.

Example 3.12 (Projection and Decomposition). Project 𝑣 =1,1,2 onto 𝑢 = 2,3,1, and find the perpendicular remainder.

First compute

𝑣𝑢=3,𝑢𝑢=14.

Therefore

proj𝑢(𝑣)=3142,3,1=37,914,314.

Subtracting this from 𝑣 gives

𝑣=107,514,2514.

As a check,

2,3,1107,514,2514=0,

so the remainder really is orthogonal to 𝑢.

Remark 3.13 (Direction Angles (Optional)). If 𝑣 =𝑎,𝑏,𝑐, its scalar projections onto the three standard basis vectors are

compˆı(𝑣)=𝑣ˆı=𝑎,compˆȷ(𝑣)=𝑣ˆȷ=𝑏,compˆ𝑘(𝑣)=𝑣ˆ𝑘=𝑐.

This confirms our original interpretation of the components: 𝑎 is the amount in the ˆı direction, 𝑏 is the amount in the ˆȷ direction, and 𝑐 is the amount in the ˆ𝑘 direction.

If 𝛼,𝛽, and 𝛾 are the angles a nonzero vector 𝑣 =𝑎,𝑏,𝑐 makes with ˆı,ˆȷ, and ˆ𝑘, then

cos𝛼=𝑣ˆı𝑣=𝑎𝑣,cos𝛽=𝑣ˆȷ𝑣=𝑏𝑣,cos𝛾=𝑣ˆ𝑘𝑣=𝑐𝑣.

These three numbers are called the direction cosines of 𝑣.

Figure 3.4 The direction cosines are precisely the components of the unit vector ˆ𝑣. Since ˆ𝑣 =1, they always satisfy

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.