Maths⏱ 5 min read
What Is a Vector and How Do You Add, Subtract and Scale Them?
Vectors describe quantities that have both magnitude and direction. They're fundamental to physics, engineering, and computer graphics. Here's the essential maths with worked examples.
A vector is a quantity with both size (magnitude) and direction — unlike a scalar, which has only size. Velocity, force, and displacement are all vectors; speed, mass, and temperature are scalars. Understanding vector maths is essential for physics, navigation, and engineering.
Vector Notation
2D vector: v = (x, y) or v = xi + yj
3D vector: v = (x, y, z) or v = xi + yj + zk
Examples:
Displacement 5km east and 3km north: v = (5, 3)
Force: 10N at 30° above horizontal
x component: 10 × cos(30°) = 8.66N
y component: 10 × sin(30°) = 5N
v = (8.66, 5)
Magnitude of a Vector
|v| = √(x² + y²) [2D]
|v| = √(x² + y² + z²) [3D]
Example: v = (3, 4)
|v| = √(9 + 16) = √25 = 5 units
(This is just Pythagoras applied to vectors)
Adding Vectors
Add component by component:
a + b = (a_x + b_x, a_y + b_y)
Example: walking 4km east then 3km north-east
v1 = (4, 0)
v2 = (3cos45°, 3sin45°) = (2.12, 2.12)
Total = (4 + 2.12, 0 + 2.12) = (6.12, 2.12)
Magnitude = √(6.12² + 2.12²) = √(37.45 + 4.49) = √41.94 = 6.48 km
Direction = arctan(2.12 / 6.12) = 19.1° north of east
Subtracting Vectors
a − b = (a_x − b_x, a_y − b_y)
Used for relative velocity, displacement between points:
Point A = (3, 5), Point B = (8, 2)
Vector from A to B = B − A = (8−3, 2−5) = (5, −3)
Distance AB = √(25 + 9) = √34 ≈ 5.83 units
Scalar Multiplication
k × v = (k × v_x, k × v_y)
Scales the magnitude, preserves direction (negative k reverses it)
Example: v = (3, 4), k = 2
2v = (6, 8)
|2v| = √(36 + 64) = √100 = 10 (twice the original 5) ✓
Unit Vectors
A unit vector has magnitude = 1, used for direction only.
Unit vector û = v ÷ |v|
Example: v = (3, 4), |v| = 5
û = (3/5, 4/5) = (0.6, 0.8)
|û| = √(0.36 + 0.64) = √1 = 1 ✓
Use unit vectors to express direction cleanly,
then scale with a magnitude to get any specific vector in that direction.
Dot Product (Scalar Product)
a · b = a_x×b_x + a_y×b_y (= |a||b|cos θ)
Used to find the angle between vectors:
cos θ = (a · b) ÷ (|a| × |b|)
Example: a = (3, 4), b = (1, 2)
a · b = (3×1) + (4×2) = 3 + 8 = 11
|a| = 5, |b| = √5
cos θ = 11 ÷ (5 × √5) = 11 ÷ 11.18 = 0.984
θ = arccos(0.984) = 10.3°