Mathematics / Vectors

Vectors

A vector is an arrow: a length and a direction. One example, v = (3, 4), is measured, added to, stretched and reduced to pure direction.

Beginner7 steps~6 min
v — the vector (3, 4) we follow
w — a second vector, (2, −1)
Result — what an operation produces
Components — how far along each axis
// THE SHORT VERSION

In 30 seconds

A vector is a quantity with both a size and a direction, drawn as an arrow. On a grid it is written as components: v = (3, 4) means 3 across and 4 up.

Its length comes from the Pythagorean theorem, here 5. Vectors add tip to tail, component by component, and multiplying by a number stretches, shrinks or flips the arrow.

Dividing by the length leaves a unit vector: direction only. Physics, computer graphics and machine learning all run on these few operations.

Vectors, step by step

STEPS01 / 07

Drawn here in two dimensions. The same rules hold with three components, or with hundreds, where the arrow can no longer be drawn but the arithmetic is unchanged.

STEP 01 / 07 An arrow, not a number
THE MATH
magnitude: 5 direction: 53.1° from x-axis
  1. Step 1: An arrow, not a number. A plain number says how much. A vector says how much and which way, so it is drawn as an arrow: its length is the magnitude, where it points is the direction. Sliding the arrow somewhere else does not change it. Same length and direction, same vector.
  2. Step 2: Components. On a grid, any arrow can be described by how far it goes along each axis. This one goes 3 across and 4 up, written v = (3, 4). Those numbers are its components. Two numbers describe an arrow in a plane; three are needed in space.
  3. Step 3: Length from components. The components and the arrow form a right triangle, so the Pythagorean theorem gives the magnitude: √(3² + 4²) = 5. The direction comes from the same triangle: the angle whose tangent is 4/3, about 53.1°. Components and magnitude-plus-direction are two descriptions of one arrow.
  4. Step 4: Adding vectors. To add two vectors, put the tail of the second on the tip of the first. The sum is the arrow from the very start to the very end: one move that replaces two. In numbers, just add matching components: (3 + 2, 4 − 1) = (5, 3).
  5. Step 5: Scaling. Multiplying a vector by a plain number, a scalar, multiplies every component by it. The arrow gets longer or shorter but stays on the same line. A negative scalar flips it to point the opposite way.
  6. Step 6: Unit vectors. Divide a vector by its own length and you get a unit vector: length exactly 1, same direction. It carries direction only, so v is its magnitude 5 times its direction u. The unit vectors i and j along the axes are the standard building blocks: v = 3i + 4j.
  7. Step 7: Where vectors are used. Forces and velocities are vectors, and several forces on an object combine by addition. A computer graphic moves a shape by adding one vector to every corner. In machine learning a word or an image becomes a long list of numbers, a vector with hundreds of components, and similar things point in similar directions.
VALUES SO FAR
|v|5length
angle53.1°direction
v····vector
w····vector
v + w····sum
1.5 v····scaled
−0.5 v····scaled
u····unit

Spotted a mistake on this page?