Topic · Linear Algebra

Vectors

A vector is the simplest object in linear algebra and one of the most useful in all of mathematics. It carries two ideas at once — a direction in space and a list of numbers — and the entire subject is built on translating fluently between the two.

What you'll leave with

  • Two equivalent ways to think about a vector: an arrow with magnitude and direction, or an ordered list of numbers.
  • How to add vectors and scale them — both geometrically and component-wise — and why the two pictures always agree.
  • How to compute the magnitude (length) of a vector and normalize it to length 1.
  • The leap from $\mathbb{R}^2$ to $\mathbb{R}^n$: the same rules work in any dimension, and that's the whole point of linear algebra.

1. Two views of a vector

Ask a physicist what a vector is and you'll hear "an arrow with magnitude and direction." Ask a programmer and you'll hear "a list of numbers." Both are right, and the secret to linear algebra is that they describe the same thing.

Vector (two equivalent definitions)

Geometric: a directed segment in space — an arrow — characterized by how long it is and which way it points. Where the arrow starts doesn't matter; only its length and direction do.

Algebraic: an ordered tuple of numbers, written $\vec{v} = (v_1, v_2, \ldots, v_n)$. Each number is a component. The number of components is the vector's dimension.

To translate between the views, plant the tail of the arrow at the origin. The coordinates of its tip are the components. So the vector $\vec{v} = (3, 4)$ is the arrow that runs from $(0, 0)$ to the point $(3, 4)$; the vector $\vec{u} = (1, 2, 3)$ runs from the origin out to the point $(1, 2, 3)$ in 3-D space.

1 2 3 4 5 6 1 2 3 4 5 6 x y 3 4 (3, 4) v = (3, 4) arrow from origin to the point (3, 4)
A 2-D vector as an arrow from the origin. The components are the coordinates of the tip.
Notation

Vectors are written several ways: $\vec{v}$, $\mathbf{v}$ (bold), or simply $v$ when context is clear. Components are listed as $(v_1, v_2, \ldots)$ in a row, or stacked in a column $\begin{pmatrix} v_1 \\ v_2 \end{pmatrix}$. The column form will become important once matrices arrive.

2. Vector addition

Two vectors can be added, and the result is another vector. Both views give the same answer — they just describe the operation differently.

Geometric (tip-to-tail). Draw the first vector. Pick up the second and slide it (without rotating) so its tail sits on the tip of the first. The sum is the new arrow that runs from the original tail to the final tip.

Algebraic (component-wise). Add the matching components.

$$ (a, b) + (c, d) = (a + c,\; b + d) $$

For example, $(1, 2) + (3, 1) = (4, 3)$. Plot all three and the rule becomes visually obvious: the second arrow, starting where the first one ended, lands at exactly the spot the sum points to.

1 2 3 4 5 1 2 3 4 5 x y u v (slid over) u + v (4, 3) u = (1, 2) v = (3, 1) u + v = (4, 3) add components independently
Tip-to-tail addition. Sliding v so its tail meets u's tip puts its head exactly where the algebraic sum says it should be.
Why both views agree

Sliding v over by u shifts each of its coordinates by the matching coordinate of u — which is exactly what component-wise addition does. The geometry isn't a separate fact about vectors; it's the same fact, drawn.

Vector addition is commutative ($\vec{u} + \vec{v} = \vec{v} + \vec{u}$) and associative ($(\vec{u} + \vec{v}) + \vec{w} = \vec{u} + (\vec{v} + \vec{w})$). Both are obvious from the algebra — addition of real numbers is commutative and associative — and almost as obvious from the picture once you draw the parallelogram.

Parallelogram law

The tip-to-tail picture has a twin: draw both $\vec{u}$ and $\vec{v}$ from the same tail, complete the parallelogram they span, and the diagonal from that shared tail is the sum $\vec{u} + \vec{v}$. It's the same fact as tip-to-tail seen from a different angle — and it makes commutativity visually obvious, since the diagonal doesn't care which side of the parallelogram you walked first.

Free vs. position vectors

A free vector has no fixed location — the same arrow drawn anywhere on the page represents the same vector. A position vector is a free vector with its tail conventionally pinned to the origin, so its tip identifies a specific point. The vector $\vec{v} = (3, 4)$ is free; calling it "the position vector of the point $(3, 4)$" just commits to drawing it from the origin.

3. Scalar multiplication

Multiplying a vector by an ordinary number — called a scalar in this context — scales its length. If the scalar is negative, it also flips the direction.

$$ c \cdot (v_1, v_2, \ldots, v_n) = (c\,v_1,\; c\,v_2,\; \ldots,\; c\,v_n) $$

Every component is multiplied by the same number $c$. Geometrically:

  • $c = 2$ doubles the arrow's length, same direction.
  • $c = \tfrac{1}{2}$ halves it.
  • $c = -1$ flips it — same length, opposite direction.
  • $c = 0$ collapses it to the zero vector $(0, 0, \ldots, 0)$.

For example, if $\vec{v} = (3, 4)$, then $2\vec{v} = (6, 8)$ and $-\tfrac{1}{2}\vec{v} = (-1.5, -2)$. The arrow points the same way (or the exact opposite way), only stretched.

Vocabulary

The word scalar just means "a number that scales." In the basic setting that's a real number; later, when we work over the complex numbers, scalars can be complex. The distinction matters because vectors and scalars live in different worlds — vectors stack into lists, scalars are single numbers.

Combining addition and scalar multiplication lets you write linear combinations like $3\vec{u} - 2\vec{v}$, which are the bread and butter of the rest of linear algebra. A linear combination of vectors $\vec{v}_1, \vec{v}_2, \ldots, \vec{v}_k$ is any expression of the form $c_1 \vec{v}_1 + c_2 \vec{v}_2 + \cdots + c_k \vec{v}_k$ where the $c_i$ are scalars. Every vector in $\mathbb{R}^2$, for instance, can be written as a linear combination of $(1, 0)$ and $(0, 1)$ — that's what "coordinates" really are.

Standard basis vectors

In $\mathbb{R}^n$, the standard basis is the collection of unit vectors that have a $1$ in one slot and $0$ everywhere else: $\vec{e}_1 = (1, 0, \ldots, 0)$, $\vec{e}_2 = (0, 1, 0, \ldots, 0)$, up to $\vec{e}_n = (0, 0, \ldots, 1)$. In $\mathbb{R}^2$ and $\mathbb{R}^3$, these are often written $\hat{i}, \hat{j}, \hat{k}$.

Any vector decomposes as a linear combination of them: $(3, 4) = 3\hat{i} + 4\hat{j} = 3\vec{e}_1 + 4\vec{e}_2$. The components are the coefficients in this combination.

4. Magnitude and unit vectors

The magnitude (or length, or norm) of a vector is exactly what it sounds like: how long the arrow is. For a 2-D vector, draw the right triangle whose legs are the two components and apply the Pythagorean theorem:

$$ \|\vec{v}\| = \sqrt{v_1^2 + v_2^2} $$

So $\|(3, 4)\| = \sqrt{9 + 16} = \sqrt{25} = 5$. The same idea generalizes: in $\mathbb{R}^n$, square each component, add, take the square root.

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

Magnitude is always non-negative. It equals zero only for the zero vector — the one vector with no direction at all.

Unit vector

A vector of magnitude exactly $1$. Unit vectors are useful because they isolate direction from length.

To turn any non-zero vector into a unit vector pointing the same way — a process called normalizing — divide it by its own magnitude:

$$ \hat{v} = \frac{\vec{v}}{\|\vec{v}\|} $$

The hat $\hat{v}$ is the standard notation for "this is a unit vector." For $\vec{v} = (3, 4)$ with magnitude $5$, the unit vector is $\hat{v} = (3/5, 4/5) = (0.6, 0.8)$. Check: $0.6^2 + 0.8^2 = 0.36 + 0.64 = 1$, so its length is indeed $\sqrt{1} = 1$.

Zero vector has no unit form

You can normalize any non-zero vector, but $\vec{0}$ has no direction at all — and dividing by $\|\vec{0}\| = 0$ is undefined. There is no "unit zero vector."

5. Where vectors live: $\mathbb{R}^n$

The set of all ordered pairs of real numbers — every $(x, y)$ in the plane — is called $\mathbb{R}^2$. The set of all ordered triples $(x, y, z)$ is $\mathbb{R}^3$. The pattern is general: $\mathbb{R}^n$ is the set of all ordered $n$-tuples of real numbers, and an element of $\mathbb{R}^n$ is an $n$-dimensional vector.

SpaceA typical elementHow to picture it
$\mathbb{R}^1$$(7)$A point — or signed length — on the number line
$\mathbb{R}^2$$(3, 4)$An arrow in the plane
$\mathbb{R}^3$$(1, 2, 3)$An arrow in 3-D space
$\mathbb{R}^n$, $n \geq 4$$(v_1, \ldots, v_n)$You can't picture it — but the algebra still works exactly

Here is the punchline of the whole subject: the rules you just learned — add component-wise, scale every component, take the square root of the sum of squares for the length — work in every dimension. Nothing about the algebra cares whether $n$ is $2$, $3$, or $10\,000$. Most theorems of linear algebra are proven once, dimension-agnostically, and apply everywhere.

Linear algebra is the study of vectors in $\mathbb{R}^n$ and the operations that respect their structure. The fact that we can't visualize $\mathbb{R}^{10}$ doesn't matter; the algebra is the visualization.

This is why a 768-dimensional word embedding, a 12-megapixel image flattened into a vector of $3.6 \times 10^7$ pixel values, and the arrow on a 2-D blackboard are all the same kind of object. Once you trust the algebra, the geometry of low dimensions is just a useful sketch.

A note on "dimension"

In this topic, the dimension of a vector is the number of components — straightforward. Later, "dimension" will be redefined for whole vector spaces in terms of how many independent vectors you need to span them. The two notions will turn out to agree for $\mathbb{R}^n$, but they're not literally the same definition.

6. Playground: add two vectors

Drag the four sliders to set the components of $\vec{u}$ and $\vec{v}$. The orange arrow is $\vec{u}$, the green arrow is $\vec{v}$, and the dashed green copy slid over to $\vec{u}$'s tip shows the tip-to-tail trick. The bold light arrow from the origin is the sum $\vec{u} + \vec{v}$ — it lands exactly where the dashed copy ends, because the geometry and the component-wise algebra are the same fact.

x y u v u + v
u (3.0, 1.0)
|u| 3.16
v (1.0, 2.0)
|v| 2.24
u + v (4.0, 3.0)
|u + v| 5.00
3.0
1.0
1.0
2.0
Try it

Set $\vec{v} = -\vec{u}$ (e.g. $\vec{u} = (3, 1)$ and $\vec{v} = (-3, -1)$): the dashed copy slides back to the origin and the sum collapses to the zero vector. Adding the opposite is exactly what undoes a vector.

7. Common pitfalls

Vectors are not points

It's tempting to identify the vector $(3, 4)$ with the point $(3, 4)$ in the plane — and visually they look identical when you anchor the tail at the origin. But a vector has no fixed location; the same arrow drawn anywhere on the page is the same vector. Points have positions; vectors have only length and direction.

Addition is component-wise, not concatenation

$(1, 2) + (3, 4)$ is $(4, 6)$, not $(1, 2, 3, 4)$. Adding vectors keeps the dimension the same. Concatenation — sticking lists end to end — is a different operation that lives in programming, not in linear algebra.

Magnitude is never negative

$\|\vec{v}\|$ is a length, so it's $\geq 0$ always. If you've computed a negative magnitude you've dropped a sign — most likely forgetting that $(-3)^2 = +9$, not $-9$. The squaring step erases sign information on purpose.

Only vectors of the same dimension can be added

$(1, 2) + (3, 4, 5)$ is undefined — there's no fourth component on the left to add the $5$ to. Likewise, you can't dot-product or subtract a 2-vector with a 3-vector. Dimensions must match.

8. Worked examples

Work each one before opening the solution. The goal isn't the final number — it's to confirm your steps match the recipes from above.

Example 1 · Add $\vec{u} = (2, -1, 5)$ and $\vec{v} = (3, 4, -2)$

Step 1. Add component-by-component:

$$ \vec{u} + \vec{v} = (2 + 3,\; -1 + 4,\; 5 + (-2)) $$

Step 2. Simplify:

$$ \vec{u} + \vec{v} = (5,\; 3,\; 3) $$

Check. Both inputs have dimension $3$, and so does the output. Component sums match.

Example 2 · Compute $-3\vec{v}$ for $\vec{v} = (4, -2, 1)$

Step 1. Multiply every component by $-3$:

$$ -3\vec{v} = (-3 \cdot 4,\; -3 \cdot (-2),\; -3 \cdot 1) $$

Step 2. Simplify:

$$ -3\vec{v} = (-12,\; 6,\; -3) $$

Sanity check. The result has the same dimension as $\vec{v}$. The sign of every non-zero component flipped (because the scalar was negative), and each magnitude tripled.

Example 3 · Find the magnitude of $\vec{w} = (6, -8)$

Step 1. Square each component:

$$ 6^2 = 36, \quad (-8)^2 = 64 $$

Step 2. Sum and take the square root:

$$ \|\vec{w}\| = \sqrt{36 + 64} = \sqrt{100} = 10 $$

The vector has length $10$. Notice the squaring stripped the sign off the $-8$ — magnitudes don't care which way the arrow points.

Example 4 · Normalize $\vec{v} = (1, 2, 2)$ to a unit vector

Step 1. Compute the magnitude:

$$ \|\vec{v}\| = \sqrt{1^2 + 2^2 + 2^2} = \sqrt{1 + 4 + 4} = \sqrt{9} = 3 $$

Step 2. Divide each component by the magnitude:

$$ \hat{v} = \left(\tfrac{1}{3},\; \tfrac{2}{3},\; \tfrac{2}{3}\right) $$

Check. $\left(\tfrac{1}{3}\right)^2 + \left(\tfrac{2}{3}\right)^2 + \left(\tfrac{2}{3}\right)^2 = \tfrac{1}{9} + \tfrac{4}{9} + \tfrac{4}{9} = 1$, so $\|\hat{v}\| = 1$ as required.

Example 5 · Find the vector from point $A = (1, 3)$ to point $B = (4, 7)$

The vector $\overrightarrow{AB}$ runs from $A$ to $B$. To find its components, subtract the tail from the tip:

$$ \overrightarrow{AB} = B - A = (4 - 1,\; 7 - 3) = (3,\; 4) $$

Check. Starting at $A$ and walking by $(3, 4)$ lands at $(1 + 3,\; 3 + 4) = (4, 7) = B$.

Its magnitude $\sqrt{3^2 + 4^2} = 5$ is the straight-line distance from $A$ to $B$ — the Euclidean distance formula is just the magnitude of the difference vector.

Sources & further reading

This page synthesizes standard introductory treatments of vectors. The references below go deeper, formalize where this page was informal, and give you a visual companion if the algebra alone isn't yet sticking.

Test your understanding

A quiz that builds from easy to hard. Pick an answer to get instant feedback and a worked explanation. Your progress is saved in this browser — come back anytime to continue.

Question 1 of 22
0 correct