The Angle Between Vectors

Divide the dot product by both lengths.

Dividing by both lengths

The dot product of two vectors can be found in two ways: from the components, a₁b₁ + a₂b₂, and from the lengths and the angle θ between the arrows, |a| |b| cos θ. Both give the same number, so a · b = |a| |b| cos θ.

Divide both sides by the two lengths, |a| and |b|, and cos θ is left on its own: cos θ = a · b / (|a| |b|).

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 cos θ, and use the inverse cosine, cos⁻¹, 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 √(3² + 4²) = √(4² + 3²) = √25 = 5.

So cos θ = 24 / (5 × 5) = 24/25 = 0.96. That is close to 1, which means the two arrows point almost the same way, and θ = cos⁻¹ 0.96 = 16.3° to 1 decimal place.

Check it from the directions of the arrows. (3, 4) makes an angle of tan⁻¹(4/3) = 53.13° with the x-axis, and (4, 3) makes tan⁻¹(3/4) = 36.87°. The difference is 53.13° − 36.87° = 16.26°, which is 16.3°.

a5b5θ

a = (3, 4) and b = (4, 3), each of length 5. Their dot product is 24, so cos θ = 24/25 and θ = 16.3°.

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 √5 and √10, and √5 × √10 = √50 = 5√2.

So cos θ = −5 / 5√2 = −1/√2, which is −0.7071 to 4 decimal places, and θ = cos⁻¹(−0.7071) = 135°.

ab135°

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 cos θ = 0 / (|a| |b|) = 0. 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.

abθ = 120°shadow |b| cos θ −1.5

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 cos θ = −6 / 12 = −0.5, 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 √5 and √20 = 2√5, whose product is 2 × 5 = 10. So cos θ = 10 / 10 = 1, and θ = 0°: there is no turn between the arrows at all.

Reverse b to (−4, −2), and the dot product becomes −10, so cos θ = −1 and θ = 180°: 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°.

ab

b = (4, 2) lies along a = (2, 1) and is twice as long: cos θ = 1 and θ = 0°.

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 cos⁻¹ 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 √(1 + 4 + 4) = 3 and √(4 + 9 + 36) = 7. So cos θ = 20/21, which is 0.9524 to 4 decimal places, and θ = 17.8° 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 √18 = 3√2, and cos B = 12 / 12√2 = 1/√2, 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), cos θ 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. 1.u · v = 7 × 3 + 1 × 4 = 21 + 4 = 25.

    24−448km eastkm northuvOu · v = 7 × 3 + 1 × 4 = 21 + 4 = 25
    24−448km eastkm northuvOu · v = 7 × 3 + 1 × 4 = 21 + 4 = 25
    u · v = 7 × 3 + 1 × 4 = 25.
  2. 2.|u| = √72 + 12 = √50 = 5√2 and |v| = √32 + 42 = 5.

    24−448km eastkm northuvOlength of u =√50= 5√2length of v =√25= 5
    24−448km eastkm northuvOlength of u =√50= 5√2length of v =√25= 5
    |u| = √50 = 5√2 and |v| = √25 = 5.
  3. 3.cosθ = u · v|u||v| = 2525√2 = 1√2.

    24−448km eastkm northuvOthe lengths multiply to 5√2× 5 = 25√2cos θ = 25 divided by 25√2= 1/√2
    24−448km eastkm northuvOthe lengths multiply to 5√2× 5 = 25√2cos θ = 25 divided by 25√2= 1/√2
    cosθ = u · v|u||v| = 2525√2 = 1√2.
  4. 4.(a) cosθ = 1√2, so the angle between the flight paths is θ = 45°.

    24−448km eastkm north45 deguvOcos θ = 1/√2so θ = 45 deg
    24−448km eastkm north45 deguvOcos θ = 1/√2so θ = 45 deg
    (a) cosθ = 1√2, so the angle between the flight paths is 45°.
  5. 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.

    24−448km eastkm north45 deguvwOw · v = −4 × 3 + 3 × 4 = −12 + 12 = 0so w is at 90 deg to v
    24−448km eastkm north45 deguvwOw · v = −4 × 3 + 3 × 4 = −12 + 12 = 0so w is at 90 deg 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.

More vectors in the plane problems, worked step by step →

Practice The Angle Between Vectors in the app