Skip to main content

Vector calculator

Type the components of a (and b if you want to combine two vectors). You get the magnitude, the unit vector, the sum and difference, the scalar product, the angle between them and, in 3D, the vector product.

Separate with commas or spaces.

|a| = 5.00,   a · b = 5.00,   θ = 63.4°
|a|
5.00
|b|
2.24
a · b
5.00
Angle
63.4°
Graph loads here
Show the working

|a| = √(3² + 4²) = 5.00

Unit vector â = a ÷ |a| = 0.6000.800

|b| = 2.24

a + b = 2.006.00   a − b = 4.002.00

a · b = (3)(−1) + (4)(2) = 5.00

cos θ = a · b ÷ (|a||b|) = 5.00 ÷ (5.00 × 2.24) = 0.447, so θ = 63.4° (1.11 radians)

Answers are rounded to 3 significant figures. Give your answer to the accuracy the question asks for.

How to do it by hand

  1. Magnitude: |a| = √(a₁² + a₂² + a₃²), Pythagoras in two or three dimensions.
  2. Add or subtract vectors component by component; multiplying by a number multiplies every component.
  3. Scalar product: a · b = a₁b₁ + a₂b₂ + a₃b₃, and cos θ = a · b ÷ (|a||b|). If a · b = 0, the vectors are perpendicular.
  4. Vector product (3D): a × b is perpendicular to both a and b, and |a × b| is the area of the parallelogram they make.

Worked example

Find the angle between the vectors a = 2i + j − 2k and b = i − 3j + 4k.

Solution

|a| = √(2² + 1² + −2²) = 3.00

Unit vector â = a ÷ |a| = 0.6670.333−0.667

|b| = 5.10

a + b = 3.00−2.002.00   a − b = 1.004.00−6.00

a · b = (2)(1) + (1)(−3) + (−2)(4) = −9.00

cos θ = a · b ÷ (|a||b|) = −9.00 ÷ (3.00 × 5.10) = −0.588, so θ = 126° (2.20 radians)

a × b = −2.00−10.0−7.00   (perpendicular to both; |a × b| = 12.4 is the area of the parallelogram they make)

Answer: |a| = 3.00,   a · b = −9.00,   θ = 126°

Every number in this example is worked out by the same code as the tool above, and the code is tested against independent results from Python's SciPy library.

Where you need it

IGCSE uses vectors in two dimensions: column vectors, their magnitude by Pythagoras, adding and subtracting them and multiplying by a number. The scalar product, angles between vectors and 3D are for IB and A Level.

Common mistakes

Questions students ask

How do I know if two vectors are perpendicular?

Their scalar (dot) product is 0. For parallel vectors, one is a multiple of the other.

What is a unit vector?

A vector of length 1. Divide a vector by its magnitude to get the unit vector in the same direction.

Why can the angle come out obtuse?

If the scalar product is negative, cos θ is negative and the angle between the vectors (placed tail to tail) is more than 90°. The acute angle between two lines is 180° minus it.

More maths tools