8.5 The angle between two vectors

Back

DEFINITION 8.5.1 Let X and Y be non{zero vectors. Then the angle

between X and Y is the unique value of µ de¯ned by

cos µ =

X ¢ Y

jjXjj ¢ jjY jj

; 0 · µ · ¼:

REMARK 8.5.1 By Cauchy's inequality, we have

¡1 ·

X ¢ Y

jjXjj ¢ jjY jj · 1;

so the above equation does de¯ne an angle µ.

In terms of components, if X = [a1; b1; c1]t and Y = [a2; b2; c2]t, then

cos µ =

p a1a2 + b1b2 + c1c2

a2

1 + b2

1 + c2

1

p

a2

2 + b2

2 + c2

2

: (8.9)

The next result is the well-known cosine rule for a triangle.

THEOREM 8.5.1 (Cosine rule) If A; B; C are points with A 6= B and

A 6= C, then the angle µ between vectors

-

AB and

-

AC sati¯es

cos µ =

AB2 + AC2 ¡ BC2

2AB ¢ AC

; (8.10)

or equivalently

BC2 = AB2 + AC2 ¡ 2AB ¢ AC cos µ:

(See Figure 8.10.)

Proof. Let A = (x1; y1; z1); B = (x2; y2; z2); C = (x3; y3; z3). Then

-

AB = a1i + b1j + c1k

-

AC = a2i + b2j + c2k

-

BC = (a2 ¡ a1)i + (b2 ¡ b1)j + (c2 ¡ c1)k;

where

ai = xi+1 ¡ x1; bi = yi+1 ¡ y1; ci = zi+1 ¡ z1; i = 1; 2:

8.5. THE ANGLE BETWEEN TWO VECTORS 167

¢

¢

¢

¢

¢

¢®

-

6

y

z

x

O

¡

¡

¡

¡

A

C

C

C

C

C

C

C

C

C

Q

Q

Q

Q

Q

Q

B

µ

cos µ = AB2+AC2¡BC2

2AB¢AC

Figure 8.10: The cosine rule for a triangle.

Now by equation 8.9,

cos µ =

a1a2 + b1b2 + c1c2

AB ¢ AC

:

Also

AB2 + AC2 ¡ BC2 = (a2

1 + b2

1 + c2

1) + (a2

2 + b2

2 + c2

2)

¡ ((a2 ¡ a1)2 + (b2 ¡ b1)2 + (c2 ¡ c1)2)

= 2a1a2 + 2b1b2 + c1c2:

Equation 8.10 now follows, since

-

AB ¢

-

AC= a1a2 + b1b2 + c1c2:

EXAMPLE 8.5.1 Let A = (2; 1; 0); B = (3; 2; 0); C = (5; 0; 1). Find

the angle µ between vectors

-

AB and

-

AC.

Solution.

cos µ =

-

AB ¢

-

AC

AB ¢ AC

:

Now -

AB= i + j and

-

AC= 3i ¡ j + k:

168 CHAPTER 8. THREE{DIMENSIONAL GEOMETRY

¢

¢

¢

¢

¢

¢®

-

6

y

z

x

O

¡

QQ

A

C

C

C

C

C

C

C

C

C

Q

Q

Q

Q

Q

Q ¡

¡

¡

¡

B

AB2 + AC2 = BC2

Figure 8.11: Pythagoras' theorem for a right{angled triangle.

Hence

cos µ =

1 £ 3 + 1 £ (¡1) + 0 £ 1

p12 + 12 + 02

p

32 + (¡1)2 + 12

=

2

p2p11

=

p2

p11

:

Hence µ = cos¡1 p2 p11

.

DEFINITION 8.5.2 If X and Y are vectors satisfying X ¢ Y = 0, we say

X is orthogonal or perpendicular to Y .

REMARK 8.5.2 If A; B; C are points forming a triangle and

-

AB is or-

thogonal to

-

AC, then the angle µ between

-

AB and

-

AC satis¯es cos µ = 0

and hence µ = ¼

2 and the triangle is right{angled at A.

Then we have Pythagoras' theorem:

BC2 = AB2 + AC2: (8.11)

We also note that BC ¸ AB and BC ¸ AC follow from equation 8.11. (See

Figure 8.11.)

EXAMPLE 8.5.2 Let A = (2; 9; 8); B = (6; 4; ¡2); C = (7; 15; 7). Show

that

-

AB and

-

AC are perpendicular and ¯nd the point D such that ABDC

forms a rectangle.

8.5. THE ANGLE BETWEEN TWO VECTORS 169

¢

¢

¢

¢

¢

¢®

-

6

y

z

x

O

C

C

C

C

C

C

C

C

¡@

ÃÃÃÃÃ

@

@

@

@

@

@

@

@

@

@

@

C

A

B

P

¡

¡

¡

Figure 8.12: Distance from a point to a line.

Solution.

-

AB ¢

-

AC= (4i ¡ 5j ¡ 10k) ¢ (5i + 6j ¡ k) = 20 ¡ 30 + 10 = 0:

Hence

-

AB and

-

AC are perpendicular. Also, the required fourth point D

clearly has to satisfy the equation

-

BD=

-

AC; or equivalently D ¡ B =

-

AC :

Hence

D = B+

-

AC= (6i + 4j ¡ 2k) + (5i + 6j ¡ k) = 11i + 10j ¡ 3k;

so D = (11; 10; ¡3).

THEOREM 8.5.2 (Distance from a point to a line) If C is a point

and L is the line through A and B, then there is exactly one point P on L

such that

-

CP is perpendicular to

-

AB, namely

P = A + t

-

AB; t =

-

AC ¢

-

AB

AB2 : (8.12)

Moreover if Q is any point on L, then CQ ¸ CP and hence P is the point

on L closest to C.

170 CHAPTER 8. THREE{DIMENSIONAL GEOMETRY

The shortest distance CP is given by

CP =

q

AC2AB2 ¡ (

-

AC ¢

-

AB)2

AB

: (8.13)

(See Figure 8.12.)

Proof. Let P = A + t

-

AB and assume that

-

CP is perpendicular to

-

AB.

Then

-

CP ¢

-

AB = 0

(P ¡ C)¢

-

AB = 0

(A + t

-

AB ¡C)¢

-

AB = 0

(

-

CA +t

-

AB)¢

-

AB = 0

-

CA ¢

-

AB +t(

-

AB ¢

-

AB) = 0

¡

-

AC ¢

-

AB +t(

-

AB ¢

-

AB) = 0;

so equation 8.12 follows.

The inequality CQ ¸ CP, where Q is any point on L, is a consequence

of Pythagoras' theorem.

Finally, as

-

CP and

-

PA are perpendicular, Pythagoras' theorem gives

CP2 = AC2 ¡ PA2

= AC2 ¡ jjt

-

AB jj2

= AC2 ¡ t2AB2

= AC2 ¡

0

@

-

AC ¢

-

AB

AB2

1

A

2

AB2

=

AC2AB2 ¡ (

-

AC ¢

-

AB)2

AB2 ;

as required.

EXAMPLE 8.5.3 The closest point on the line through A = (1; 2; 1) and

B = (2; ¡1; 3) to the origin is P = ( 17

14 ; 19

14 ; 20

14 ) and the corresponding

shortest distance equals 5

14

p42.

Another application of theorem 8.5.2 is to the projection of a line segment

on another line:

8.5. THE ANGLE BETWEEN TWO VECTORS 171

¢

¢

¢

¢

¢

¢®

-

6

y

z

x

O

@

@

@

@

@

@

@

B

A

¡

¡

¡

¡

¡

@

@

@

@

""""""""""

PPPPPPPPP

C2

C1

P2

P1

""

Figure 8.13: Projecting the segment C1C2 onto the line AB.

THEOREM 8.5.3 (The projection of a line segment onto a line)

Let C1; C2 be points and P1; P2 be the feet of the perpendiculars from

C1 and C2 to the line AB. Then

P1P2 = j

-

C1C2 ¢^nj;

where

^n =

1

AB

-

AB :

Also

C1C2 ¸ P1P2: (8.14)

(See Figure 8.13.)

Proof. Using equations 8.12, we have

P1 = A + t1

-

AB; P2 = A + t2

-

AB;

where

t1 =

-

AC1 ¢

-

AB

AB2 ; t2 =

-

AC2 ¢

-

AB

AB2 :

Hence

-

P1P2 = (A + t2

-

AB) ¡ (A + t1

-

AB)

= (t2 ¡ t1)

-

AB;

172 CHAPTER 8. THREE{DIMENSIONAL GEOMETRY

so

P1P2 = jj

-

P1P2 jj = jt2 ¡ t1jAB

=

¯¯¯¯¯¯

-

AC2 ¢

-

AB

AB2 ¡

-

AC1 ¢

-

AB

AB2

¯¯¯¯¯¯

AB

=

¯¯¯¯

-

C1C2 ¢

-

AB

¯¯¯¯

AB2 AB

=

¯¯¯¯

-

C1C2 ¢^n

¯¯¯¯

;

where ^n is the unit vector

^n =

1

AB

-

AB :

Inequality 8.14 then follows from the Cauchy{Schwarz inequality 8.3.

DEFINITION 8.5.3 Two non{intersecting lines are called skew if they

have non{parallel direction vectors.

Theorem 8.5.3 has an application to the problem of showing that two skew

lines have a shortest distance between them. (The reader is referred to

problem 16 at the end of the chapter.)

Before we turn to the study of planes, it is convenient to introduce the

cross{product of two vectors.