Mathwords logoMathwords

angle between two vectors — Definition, Formula & Examples

The angle between two vectors is the smallest rotation needed to align one vector's direction with the other, measured where their tails meet. You find it using the dot product formula and inverse cosine.

Given two nonzero vectors a\mathbf{a} and b\mathbf{b} in Rn\mathbb{R}^n, the angle θ\theta between them is defined by cosθ=abab\cos\theta = \dfrac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\|\,\|\mathbf{b}\|}, where 0θπ0 \leq \theta \leq \pi (i.e., 0° to 180°180°).

Key Formula

θ=cos1 ⁣(aba  b)\theta = \cos^{-1}\!\left(\frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\|\;\|\mathbf{b}\|}\right)
Where:
  • θ\theta = Angle between the two vectors (between 0° and 180°)
  • ab\mathbf{a} \cdot \mathbf{b} = Dot product of vectors a and b
  • a\|\mathbf{a}\| = Magnitude (length) of vector a
  • b\|\mathbf{b}\| = Magnitude (length) of vector b

How It Works

First, compute the dot product of the two vectors. Next, find each vector's magnitude. Divide the dot product by the product of the magnitudes to get cosθ\cos\theta. Finally, apply cos1\cos^{-1} (inverse cosine) to obtain the angle. The result always falls between 0° and 180°180°: an angle of 0° means the vectors point in the same direction, 90°90° means they are perpendicular, and 180°180° means they point in opposite directions.

Worked Example

Problem: Find the angle between the vectors a = (1, 2, 2) and b = (4, 0, −3).
Dot product: Multiply corresponding components and add them up.
ab=(1)(4)+(2)(0)+(2)(3)=4+06=2\mathbf{a} \cdot \mathbf{b} = (1)(4) + (2)(0) + (2)(-3) = 4 + 0 - 6 = -2
Magnitudes: Find the length of each vector.
a=12+22+22=9=3,b=42+02+(3)2=25=5\|\mathbf{a}\| = \sqrt{1^2+2^2+2^2} = \sqrt{9} = 3, \quad \|\mathbf{b}\| = \sqrt{4^2+0^2+(-3)^2} = \sqrt{25} = 5
Apply formula: Divide and take the inverse cosine.
θ=cos1 ⁣(235)=cos1 ⁣(215)97.7°\theta = \cos^{-1}\!\left(\frac{-2}{3 \cdot 5}\right) = \cos^{-1}\!\left(-\frac{2}{15}\right) \approx 97.7°
Answer: The angle between the two vectors is approximately 97.7°.

Why It Matters

Physics courses use vector angles constantly — for example, work equals FdcosθF\,d\cos\theta, so knowing the angle between force and displacement determines how much energy is transferred. In computer graphics, the angle between surface normals and light direction controls shading brightness.

Common Mistakes

Mistake: Forgetting to divide by BOTH magnitudes and dividing by only one.
Correction: The denominator must be the product ab\|\mathbf{a}\| \cdot \|\mathbf{b}\|, not just one magnitude. Without both, the cosine value can exceed the valid range of −1 to 1.

Related Terms