Synapse

An interconnected graph of micro-tutorials

Vectors

This is an early draft. Content may change as it gets reviewed.

A vector is an ordered list of numbers:

$$\mathbf{v} = \begin{pmatrix} 3 \ 1 \ 4 \end{pmatrix}$$

This is a vector in 3 dimensions (three entries). You can think of it as:

All three interpretations are useful. In statistics, you’ll mostly think of vectors as rows of data. In geometry, as arrows.

Operations

Vectors have two core operations:

Addition: Add corresponding entries.

$$(3, 1, 4) + (1, 5, 9) = (4, 6, 13)$$

Geometrically, this is “follow one arrow, then the other.” The result is the diagonal of the parallelogram formed by the two vectors.

Scalar multiplication: Multiply every entry by a number.

$$2 \times (3, 1, 4) = (6, 2, 8)$$

This stretches (or shrinks) the arrow without changing its direction. Multiply by $-1$ and the arrow flips to point the opposite way.

Explore a vector

Try It: A Vector in 2D

Drag the purple dot to move the vector. The coordinates and length update in real time.

Vector addition

Try It: Vector Addition

Drag the tips of u and v. The orange arrow is their sum $\mathbf{u} + \mathbf{v}$ — the diagonal of the parallelogram. Try making the vectors point in opposite directions and watch the sum shrink.

Length

The length (or norm) of a vector is its distance from the origin:

$$|\mathbf{v}| = \sqrt{v_1^2 + v_2^2 + \cdots + v_n^2}$$

For $(3, 4)$: $\sqrt{9 + 16} = \sqrt{25} = 5$. This is just Pythagoras extended to any number of dimensions.

A unit vector has length 1. You can turn any vector into a unit vector by dividing by its length: $\hat{\mathbf{v}} = \mathbf{v} / |\mathbf{v}|$. This keeps the direction but normalises the scale.

Dimensions

The number of entries in a vector is its dimension. A 2D vector lives in a plane. A 3D vector lives in space. A 67D vector — one entry per linguistic feature — lives in a 67-dimensional feature space. You can’t visualise it, but the arithmetic works the same way.