Uni-Sine
MathematicsVectors and matrices

Angle between two vectors calculator

The angle between two vectors comes from the dot product: cos θ = (a · b) ÷ (|a||b|). Multiply matching components and add to get a · b, divide by the product of the lengths, then take inverse cos. For a = (2, 1) and b = (1, 3), a · b = 5, |a| = √5 and |b| = √10, so cos θ = 5 ÷ √50 and θ = 45°. This angle between two vectors calculator is part of our Vectors Calculator, in 2D or 3D.

Try it

Vectors Calculator

Visualise magnitude, direction and operations

Go to its page

How to find the angle in the calculator

  1. Open the Vectors Calculator. It starts in Single mode, so choose Two Vectors for 2D or 3D at the top.
  2. Under Vectors, type the components of vector a and vector b, or drag their tips on the grid.
  3. Read θ, the angle between them, in Results, along with the dot product a · b. In 3D you also get both magnitudes and the cross product.
  4. Under Display, the Degrees chip switches the angle between degrees and radians.
  5. Open Formulas to see the angle formula with your numbers.

Angle between two vectors formula

\cos\theta = \frac{\vec{a} \cdot \vec{b}}{|\vec{a}|\ |\vec{b}|}

In 2D, a · b = a₁b₁ + a₂b₂, and in 3D add a₃b₃. The magnitude |a| is √(a₁² + a₂² + a₃²). The angle always comes out between 0° and 180°: it is the angle between the vectors placed tail to tail.

Worked examples you can check in the calculator

Example 1: two 2D vectors

\cos\theta = \frac{2 \times 1 + 1 \times 3}{\sqrt{5} \times \sqrt{10}} = \frac{5}{\sqrt{50}} = 0.7071

θ = cos⁻¹(0.7071) = 45°. Choose Two Vectors and type a = (2, 1) and b = (1, 3).

Example 2: the calculator's 2D vectors

Two Vectors starts with a = (5, 5) and b = (−3, 4). a · b = −15 + 20 = 5, |a| = √50 = 7.071 and |b| = 5, so cos θ = 5 ÷ 35.36 = 0.1414 and θ = 81.9°.

Example 3: two 3D vectors

In 3D mode the calculator starts with a = (3, 4, 2) and b = (−1, 2, 5). a · b = −3 + 8 + 10 = 15, |a| = √29 = 5.385 and |b| = √30 = 5.477:

\cos\theta = \frac{15}{5.385 \times 5.477} = 0.5086 \qquad \theta = 59.4^{\circ}

Example 4: perpendicular and parallel vectors

For a = (4, −2) and b = (1, 2), a · b = 4 − 4 = 0, so cos θ = 0 and θ = 90°: the vectors are perpendicular. A zero dot product is the quick test for a right angle. At the other extreme, (1, 2) and (−2, −4) point in exactly opposite directions, and the angle between them is 180°.

Try one

practice
Pick an answer, then check it.
What is the angle between (1, 0, 1) and (0, 1, 1)?

What the sign of the dot product tells you

a · bAngleMeaning
PositiveLess than 90°The vectors point broadly the same way
ZeroExactly 90°Perpendicular
NegativeMore than 90°The vectors point broadly opposite ways

Where the angle between vectors is used

In physics, the work done by a force is the dot product of the force and the displacement: W = F · d = |F||d| cos θ. A force of (3, 4) N that moves an object (5, 0) m does W = 3 × 5 + 4 × 0 = 15 J of work. The force has magnitude 5 N, so cos θ = 15 ÷ (5 × 5) = 0.6 and the force acts at 53.1° to the motion. Only the part of the force along the motion, 5 cos 53.1° = 3 N, does any work. The same angle formula finds the angle between two lines in 3D geometry, using their direction vectors.

Common mistakes

  • Forgetting to divide by the magnitudes. The dot product on its own isn't cos θ.
  • Calculator in the wrong mode. cos⁻¹ in radians gives a number like 0.785 instead of 45.
  • Adding components instead of multiplying. a · b multiplies matching components, then adds.
  • Using vectors placed head to tail. The angle is between the vectors tail to tail.
  • Sign slips with negative components. Bracket them: 5 × (−3) = −15.

Common questions

How do you find the angle between two vectors?
Work out the dot product, divide by the product of the magnitudes, and take inverse cos: θ = cos⁻¹((a · b) ÷ (|a||b|)).
How do you know if two vectors are perpendicular?
Their dot product is zero, so the angle between them is 90°.
Does the same formula work in 3D?
Yes. Include the third components in both the dot product and the magnitudes.
Can the angle be more than 180°?
No. The angle between two vectors is always between 0° and 180°, because inverse cos gives answers in that range.
Can I see the answer in radians?
Yes. Turn off the Degrees chip under Display.

Revision cards

Read the front, say your answer, then flip to check.

Where to go next

  • Solve it

    Vectors Calculator

    Visualise magnitude, direction and operations

    Open the tool
  • Test it

    Geometry, Algebra 2 & SAT Math

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
  • Test it

    College Linear Algebra

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Maths · Vectors and matricesDot product calculator: 2D and 3D, with the angleFree dot product calculator: find the dot product of two vectors in 2D or 3D, and the angle between them, with the formula worked through.