Vector calculator: dot product, cross product, angle

A vector has a size and a direction. The dot product measures how aligned two vectors are, and the cross product (in 3D) gives a vector perpendicular to both.

Write 2x or 2*x to multiply, ^ for powers, and ; between simultaneous equations. You can also type factor, expand, derivative of, integrate … from a to b, limit … as x->0 or 15% of 80.

Try an example

Before you start

This page is easier if you are comfortable with:

What this topic covers

Find the length with the magnitude, a direction with the unit vector and a 2D angle with direction of a 2D vector. The dot product is the scalar product; the cross product and 3D work are on the vector product and distance in 3D.

Each part of this topic has its own page with the formula, worked examples and a solver: Magnitude of a vector (2D and 3D), Unit vector, Direction of a 2D vector, Scalar product.

Closely related topics: Matrices, Complex numbers, Right-angled trigonometry.

What is it used for?

A vector has both size and direction. The dot product measures how aligned two vectors are, and the cross product gives a vector perpendicular to both.

How to solve it

  1. Magnitude: the square root of the sum of the squared components.
  2. Dot product: multiply matching components and add. It is zero when the vectors are perpendicular.
  3. Angle between vectors: cos θ = (a · b) ÷ (|a||b|).
  4. Cross product: a × b has components (a₂b₃ - a₃b₂, a₃b₁ - a₁b₃, a₁b₂ - a₂b₁).
  5. Unit vector: divide a vector by its magnitude.

Worked examples

The examples marked with a button were worked out by the solver on this page. You can try each one yourself.

Example 1: angle between (1,0,2) and (3,1,1)

Worked out by the solver on this page. Press the button to try it yourself.

Vectors
Answer
θ=47.6∘\theta = 47.6^{\circ}
  1. Use
  2. Dot product
  3. Magnitudes
  4. Substitute
  5. Inverse cosine

Example 2: dot product of (1,2,3) and (4,5,6)

Worked out by the solver on this page. Press the button to try it yourself.

Vectors
Answer
a⋅b=32a \cdot b = 32
  1. Multiply matching components and add
  2. Evaluate
  3. Meaning
    The dot product is positive, so the angle between the vectors is acute.

Example 3: cross product of (1,2,3) and (4,5,6)

Worked out by the solver on this page. Press the button to try it yourself.

Vectors Answer checked
Answer
(−36−3)\begin{pmatrix}-3 \\ 6 \\ -3\end{pmatrix}
  1. Use
  2. Substitute
  3. Check: the result is perpendicular to both vectors (both dot products are 0)

Example 4: magnitude of (3,4)

Worked out by the solver on this page. Press the button to try it yourself.

Magnitude of a vector
Answer
∣a∣=5|\mathbf{a}| = 5
  1. Length from Pythagoras

Example 5: unit vector of (3,4)

Worked out by the solver on this page. Press the button to try it yourself.

Unit vector Answer checked
Answer
(3545)\begin{pmatrix}\dfrac{3}{5} \\ \dfrac{4}{5}\end{pmatrix}
  1. Length from Pythagoras
  2. Divide the vector by its length
  3. Check: its length is 1

Special cases

A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.

Magnitude

|(3, 4)| = 5

√(9 + 16).

Dot product

(1, 2, 3)·(4, 5, 6) = 32

Multiply and add components.

Angle

(1, 0, 2) and (3, 1, 1): 47.6°

cos θ = a·b/(|a||b|).

Unit vector

(3, 4)/5 = (0.6, 0.8)

Divide by the magnitude.

Word problems

Add and scale vectors component by component. Use the dot product for angles and the cross product for perpendicular vectors.

Magnitude

Magnitude of (3, 4).

  1. √(3² + 4²)5
  2. Check: 3-4-5 triangle ✓5

Dot product

Dot product of (1, 2, 3) and (4, 5, 6).

  1. Multiply4 + 10 + 18
  2. Check: 32 ✓32

Cross product Higher

First component of (1, 2, 3) × (4, 5, 6).

  1. a₂b₃ − a₃b₂12 − 15
  2. Check: −3 ✓-3

Angle Higher

Angle between (1, 0, 2) and (3, 1, 1).

  1. Dot5
  2. Magnitudes√5 × √11
  3. cos θ0.6742
  4. Check: 47.6° ✓47.6

Common mistakes

Dot product as a vector

(4, 10, 18) ✗

32 ✓

The dot product is a number.

Forgetting the magnitudes in the angle formula

cos θ = a·b ✗

divide by |a||b| ✓

Normalise.

Cross product is commutative

a × b = b × a ✗

a × b = −b × a ✓

Order matters.

Wrong sign in a cross component

12 + 15 ✗

12 − 15 ✓

Use the cyclic pattern.

Exam tips

  1. Components add and scale.
  2. a·b = Σ aᵢbᵢ.
  3. cos θ = a·b/(|a||b|).
  4. Cross product ⟂ both.
  5. Unit vector: divide by |a|.

Practice questions

Try each one on paper, then open the answer. Use the solver above to see the full working.

1. |(5, 12)| Foundation

13

2. (2, 3)·(4, −1) Foundation

5

3. (1, 0, 0)·(0, 1, 0) Foundation

0

4. |(1, 2, 2)| Higher

3

5. Angle between (1, 0) and (1, 1) (degrees) Higher

45

6. x of the unit vector of (6, 8) Higher

0.6

Practice generator

Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.

Solve: …

Key terms

Vector
Magnitude and direction.
Magnitude
Length.
Dot product
A scalar a·b.
Cross product
A vector a × b.
Unit vector
Length 1.
Component
x, y or z part.

Frequently asked questions

What is the dot product?

The sum of the products of the components, a number.

How do I find the angle between vectors?

cos θ = a·b/(|a||b|).

What is a unit vector?

A vector of length 1.

Which page covers magnitude?

magnitude of a vector.

Which page covers the scalar product?

scalar product.

Which page covers unit vectors?

unit vector and direction of a 2D vector.

More in Vectors and matrices and the formula sheets.