Dividing by both lengths
The dot product of two vectors can be found in two ways: from the components, , and from the lengths and the angle between the arrows, . Both give the same number, so .
Divide both sides by the two lengths, |a| and |b|, and is left on its own: .
So the angle between two vectors comes in three steps. Work out the dot product from the components. Work out both lengths by Pythagoras. Divide the dot product by the product of the lengths to get , and use the inverse cosine, , to find .
A worked angle
Take a = (3, 4) and b = (4, 3). The dot product is 3 × 4 + 4 × 3 = 12 + 12 = 24. Both lengths are 5, since .
So . That is close to 1, which means the two arrows point almost the same way, and to 1 decimal place.
Check it from the directions of the arrows. (3, 4) makes an angle of with the x-axis, and (4, 3) makes . The difference is 53.13° − 36.87° = 16.26°, which is 16.3°.
a = (3, 4) and b = (4, 3), each of length 5. Their dot product is 24, so and .
An obtuse angle
A negative dot product gives a negative cosine, and the angle is more than 90°. For a = (2, 1) and b = (−3, 1), a · b = −6 + 1 = −5. The lengths are and , and .
So , which is −0.7071 to 4 decimal places, and .
a = (2, 1) and b = (−3, 1). The dot product is −5, the cosine is negative, and the angle is 135°.
A dot product of zero
If a · b = 0 and neither vector is the zero vector, then . The only angle from 0° to 180° with a cosine of 0 is 90°, so the vectors are perpendicular.
Any value of the dot product can be read the same way. Positive means an acute angle, zero means a right angle, and negative means an obtuse angle.
past 90° the shadow points against a, so a · b = |a| × shadow is negative: −6
Swing b until a · b = 0
a has length 4 and b has length 3, so |a| |b| = 12. At 120°, a · b = 4 × 3 cos 120° = −6, and , which is the cosine of 120°. Swing b until the dot product is 0: the angle it stops at is 90°.
The same way, and the opposite way
a = (2, 1) and b = (4, 2) point the same way, since b = 2a. Their dot product is 2 × 4 + 1 × 2 = 10. The lengths are and , whose product is 2 × 5 = 10. So , and : there is no turn between the arrows at all.
Reverse b to (−4, −2), and the dot product becomes −10, so and : the arrows point in exactly opposite directions.
Those are the two ends of the range. The cosine of the angle between two vectors always lies from −1 to 1, and the angle from 0° to 180°.
b = (4, 2) lies along a = (2, 1) and is twice as long: and .
One angle, never two
Each cosine from −1 to 1 belongs to exactly one angle from 0° to 180°, and that is the range a calculator’s key gives. So the inverse cosine always returns the angle between the vectors, with no second angle to consider, as there can be with the sine.
Three components
The method is the same with three components. For (1, 2, 2) and (2, 3, 6), the dot product is 2 + 6 + 12 = 20, and the lengths are and . So , which is 0.9524 to 4 decimal places, and to 1 decimal place.
The angle of a triangle
To find the angle at a corner of a triangle, use the two vectors that leave that corner. In the triangle A(0, 0), B(4, 0), C(1, 3), the angle at B comes from BA = (−4, 0) and BC = (−3, 3). Then BA · BC = 12 + 0 = 12, the lengths are 4 and , and , so the angle at B is 45°.
Using AB = (4, 0) instead of BA gives a dot product of −12 and an angle of 135°. That is the angle between the line continued beyond B and BC, which is 180° − 45°, not the angle inside the triangle.
The usual mistakes
Taking the dot product as the cosine. For (3, 4) and (4, 3), is not 24: no cosine is more than 1, so the dot product has to be divided by both lengths.
Dividing by one length. 24 ÷ 5 = 4.8 is still more than 1; both lengths come out, 24 ÷ 25.
Reading a zero dot product as 0° or 180°. At 0° the dot product is as large as the lengths allow and at 180° as negative; zero is 90°.
Using vectors that do not both leave the corner, which gives 180° minus the angle wanted.
Two flight paths
In the application below, two aircraft leave one airport along the vectors u and v. Their dot product, divided by the product of their lengths, gives the cosine of the angle between the flight paths. A third path is shown to cross the second at right angles by a dot product of zero.
Worked example: The Angle Between Two Flight Paths from an Airport
Question Two aircraft take off from an airport O. With components in kilometers east and north, the first flies along u = 71 and the second along v = 34. (a) Find the angle between the two flight paths. (b) A training flight is to cross the second path at right angles, flying along w = −43. Show that w is perpendicular to v.
1.u · v = 7 × 3 + 1 × 4 = 21 + 4 = 25.
u · v = 7 × 3 + 1 × 4 = 25. 2.|u| = √72 + 12 = √50 = 5√2 and |v| = √32 + 42 = 5.
|u| = √50 = 5√2 and |v| = √25 = 5. 3.cosθ = u · v|u||v| = 2525√2 = 1√2.
cosθ = u · v|u||v| = 2525√2 = 1√2. 4.(a) cosθ = 1√2, so the angle between the flight paths is θ = 45°.
(a) cosθ = 1√2, so the angle between the flight paths is 45°. 5.(b) w · v = −4 × 3 + 3 × 4 = −12 + 12 = 0. Neither vector is zero, so cosθ = 0 and w is at 90° to v.
(b) w · v = −12 + 12 = 0, and neither vector is zero, so w is at 90° to v.
Answer: (a) 45°; (b) w · v = 0, so the paths are at 90°
Common mistakes
- Leaving out the magnitudes and taking cosθ = 25. A cosine is never more than 1; the dot product has to be divided by the product of the lengths.
- Reading a dot product of zero as meaning that one of the vectors is zero. Neither w nor v is zero; a zero dot product between two non-zero vectors means that they are perpendicular.