Math 32, September 8: Dot and Cross Product Section 1: Dot Product We have discussed the basic properties of individual vectors, such as their coordinates, orientation, and magnitude, but the most interesting properties arise when considering how vectors are related to one another. For instance, consider the following pictures: y z x θ y θ x A number of questions are of obvious importance. For example, we might want to know the angle between the two shown vectors, or how much of a push one vector gives in the direction of another. In 3D, we will expand these notions to include questions of whether vectors are pointing in the same general direction, and how to generate new vectors which lead in necessarily lead in new directions. We start by defining the following. 1
Definition 1 Consider two vectors a = a 1, a 2, a 3 and b = b 1, b 2, b 3. product of a and b is defined as The dot a b = a 1 b 1 + a 2 b 2 + a 3 b 3. In other words, to compute the dot product, we multiply the two vectors component-wise and then add the result. Consider the following examples. Example 1 Determine the dot products a b, a c, and b c for the following vectors: a = 3, 1, 0 b = 1, 2, 2 c = 0, 2, 2. Solution: We have a b = (3)(1) + ( 1)(2) + (0)( 2) = 1 a c = (3)(0) + ( 1)(2) + (0)(2) = 2 b c = (1)(0) + (2)(2) + ( 2)(2) = 0. z (0,2,2) (3,-1,0) x y (1,2,-2) 2
Note: The dot product easily generalizes to vectors of arbitrary dimension. For general vectors a = a 1,..., a n and b = b 1,..., b n, we have n a b = a i b i. i=1 In particular, in 2D, we have a b = a 1 b 1 + a 2 b 2. Note: The dot product goes under several different names within mathematics and physics. For instance, in linear algebra and functional analysis is it often called a inner product and denoted a, b. It is also known as the scalar product. The dot product gives important information about the relationship between two vectors. Among the most important is the following. Theorem 1 Let θ [0, π] be the angle between two vectors a and b. Then a b = a b cos(θ). This formula relates the angle between two vectors (in any dimension) to the dot product and magnitude of the vectors. The more important (and surprising) consequence of Theorem 1 is that, since the magnitude of a vector is always positive, the sign of the dot product is directly related to θ. Specifically, we have the following. Note: It follows from Theorem 1 that cos(θ) = a b a b [ a b > 0 θ 0, π ) ( 2 π ] a b < 0 θ 2, π a b = 0 θ = π 2 (acute angle) (obtuse angle) (90 angle) 3
Example 2 Determine the angle between the three vectors a, b, and c in the previous example: a = 3, 1, 0 b = 1, 2, 2 c = 0, 2, 2. Solution: We have already computed the dot products, so it only remains to compute the magnitudes. We have a = (3) 2 + ( 1) 2 + (0) 2 = 10 b = (1) 2 + (2) 2 + (2) 2 = 9 = 3 c = (0) 2 + (2) 2 + (2) 2 = 8 = 2 2. It follows that the angle between a and b satisfies cos(θ) = a b a b = 1 ( ) 1 3 = θ = arccos 10 3 1.465. 10 The angle between a and b satisfies cos(θ) = a c a b = 2 2 2 10 The angle between b and c satisfies = θ = arccos ( 1 ) 2 1.796. 5 cos(θ) = b c b c = 0 6 2 = θ = arccos (0) = π 2. Notice that 1.465 < π 2 and 1.796 > π 2 so that, as expected, the angle between a and b is acute while the angle between a and c is obtuse. Section 2: Projections Suppose we have two vectors and wish to determine how much of the vector is in the direction of another. This question is trivial when one of the vectors is along a major axis. For instance, if we wish to determine how much of the vector (2, 5, 1) is in the direction of (1, 0, 0), we may simply take the x-coordinate and drop the rest, so that we have (2, 0, 0). 4
The question is more complicated when the vectors are interest are at odd angles, as in the following picture: a b proj b (a) The red vector above has special properties which we formally define now. Definition 2 Consider two vectors a and b. We define the projection of a onto b (denoted proj b (a)) to be the vector parallel to b with the property that a proj b (a) is perpendicular to b. Despite the seeming difficulty in finding projections, we actually have all of the tools we need! We start by recognizing that, now that we understand the dot product, we know how to determine the angle θ between the vectors a and b. We have cos(θ) = a b a b. (1) We notice that the vector a and the projection form a right-angled triangle and that the angle is also given by θ. It follows from fundamental trigonometric identities that we have cos(θ) = adj hyp = proj b(a). (2) a We can now combine (1) and (2) to solve for the magnitude of the projection. We have proj b (a) = a b b. 5
To get the vector projection, we need to combine this magnitude with the required direction, which is given by the vector b. We need to be slightly careful here we do not multiply by the vector b because this already has a magnitude. Rather, we need to multiply by the unit vector in the direction of b. Finally, we obtain the following. Formula for vector projection: ( a b proj b (a) = b ) b b = Note: This formula works in any dimension. ( ) a b b 2 b. Example 3 Find proj b (a) and proj a (b) for the following vectors: a = 2, 3 b = 1, 1 Solution: We have a b = (2)( 1) + (3)(1) = 1 a = (2) 2 + (3) 2 = 13 b = ( 1) 2 + (1) 2 so that and proj b (a) = a b b 2 b = 1 ( 2) 1, 1 = 1 2 2, 1 2 proj a (b) = a b a 2 a = 1 2 ( 13) 2, 3 = 2 13, 3. 13 a a b b 6
Section 3: Cross Product For three-dimensional vectors, there is another important notion of vector multiplication. Unlike the dot product, this multiplication produce a vector rather than a scalar value. We formally define the following. Definition 3 Consider two vectors a = a 1, a 2, a 3 and b = b 1, b 2, b 3. The cross product of a and b is given by a b = a 2 b 3 a 3 b 2, a 3 b 1 a 1 b 3, a 1 b 2 a 2 b 1. The formula for the cross product is cumbersome and also difficult to remember; however, it can be simplified with some basic concepts from linear algebra. The 2 2 determinant of a matrix is given by the formula a 1 a 2 b 1 b 2 = a 1b 2 a 2 b 1. (3) This formula may be extended to 3 3 matrices by the (recursive) formula a 1 a 2 a 3 b 1 b 2 b 3 c 1 c 2 c 3 = a 1 b 2 b 3 c 2 c 3 a 2 b 1 b 3 c 1 c 3 + a 3 b 1 b 2 c 1 c 2. (4) The connection with Definition 3 should now be apparent the coordinates of a b appear like 2 2 determinants (3), and the order of indices matches the order of the 2 2 determinants in (4). We can piece these together to get the following. Formula for cross products: i j k a b = a 1 a 2 a 3 b 1 b 2 b 3 = a 2 a 3 b 2 b 3 i a 1 a 3 b 1 b 3 j + a 1 a 2 b 1 b 2 k. 7
Example 4 Compute the cross product of the following vectors: a = 1, 0, 1 b = 0, 2, 0 Solution: We have i j k a b = 1 0 1 0 2 0 = 0 1 2 0 i 1 1 0 0 j + 1 0 0 2 k = [(0)(0) ( 1)(2)]i [(1)(0) ( 1)(0)]j + [(1)(2) (0)(0)]k = 2, 0, 2. As with the dot product, the cross product is intimately related to the angle between two vectors. We have the following. Theorem 2 Consider two vectors a = a 1, a 2, a 3 and b = b 1, b 2, b 3. Let θ [0, π] denote the angle between a and b. Then: 1. a b = a b sin(θ); 2. a b is orthogonal to both a and b; 3. a b = b a; and 4. a b = 0 is and only if a and b are parallel. Example 5 Reconsider the vectors a = 1, 0, 1 and b = 0, 2, 0 from Example 4. Verify that a b = 2, 0, 2 is orthogonal to a and b. Solution: We need to compute the dot product (a b) a and (a b) b. 8
We have (a b) a = 2, 0, 2 1, 0, 1 = (2)(1) + (0)(0) + (2)( 1) = 0 (a b) b = 2, 0, 2 0, 2, 0 = (2)(0) + (0)(2) + (2)(0) = 0. The result can be clearly seen by plotting the vectors: (2,0,2) z x (0,2,0) y (1,0,-1) Note: It is important to note that, while a b always produces a vector orthogonal to a and b, such a vector is not unique. For instance, in Example 4, the vectors 1, 0, 1 and 2, 0, 2 are also orthogonal to a = 1, 0, 1 and b = 0, 2, 0. (In fact, any vector of the form t 2, 0, 2, t 0, will work!) It is possible to determine the direction of the vector a b by a trick known as the right-hand rule. In this test, we imagine orientating our right hand so that our index finger is aligned with a. We then curl our fingers so that they sweep toward b. The direction of our extended thumb in this configuration corresponds to the direction of the cross product a b. (Notice that, if you do this with your left hand, your thumb points in the other direction.) 9
Suggested Problems 1. Suppose a and b are unit vectors. Show that a b is a unit vector. 2. Show that a b gives the area of a parallelogram with base length a and side length b. [Hint: Determine a formula for the height of the parallelogram and then use Property 1 of Theorem 2.] 3. Consider the vectors a = 3, 1, 1, b = 0, 2, 3, and c = 1, 3, 0. Compute the following: (a) a b (b) a c (c) b c (d) a c (e) a (b c) (f) proj a (b) (g) proj b (a) (h) proj a (c) (i) The angle θ between a and b (j) The angle θ between a and c 10