1. Vectors in ℝⁿ: operations and geometric interpretation

📖 Reading · 12 min
💡 Every code box below is live — edit it and hit Run.

Linear algebra is, at bottom, the study of two things: vectors (objects that can be added and scaled) and the linear maps between them (functions that respect that addition and scaling). Nearly everything in this course — systems of equations, matrices, eigenvalues, least squares — is built from just those two ingredients. This opening lesson is the ground floor: what a vector is, and the two operations, addition and scalar multiplication, that everything else is built from.

A note on the module number. This course starts at Module 16, not Module 1 — Modules 0 through 15 belong to the four-course Calculus sequence (Calculus I–IV). Linear Algebra doesn't depend on any of that material and can be taken first, alongside it, or afterward; the two series simply share one running module count so lessons in either can cross-reference the other by number (e.g. Calculus IV's coverage of Jacobians and systems of ODEs points back here).

What a vector is

A vector in \mathbb{R}^n is an ordered list of n real numbers, written as a column:

\vec v=\begin{pmatrix}v_1\\v_2\\\vdots\\v_n\end{pmatrix}\in\mathbb{R}^n

The individual numbers v_1,\dots,v_n are the vector's components or entries. \mathbb{R}^n itself is just the set of all such lists — \mathbb{R}^2 is the plane, \mathbb{R}^3 is ordinary space, and \mathbb{R}^n for n>3 has no picture but works by exactly the same rules.

Two ways to picture a vector, both useful and both correct:

  • As a point\vec v names a location, the point with those coordinates.
  • As an arrow\vec v names a displacement, drawn as an arrow from the origin to that point (or, since only length and direction matter, equally validly drawn starting anywhere).

Nothing in the algebra below cares which picture is in your head; switch between them freely, whichever makes a given calculation easier to see.

Vector addition

Two vectors in \mathbb{R}^n add componentwise:

\vec u+\vec v=\begin{pmatrix}u_1\\u_2\\\vdots\\u_n\end{pmatrix}+\begin{pmatrix}v_1\\v_2\\\vdots\\v_n\end{pmatrix}=\begin{pmatrix}u_1+v_1\\u_2+v_2\\\vdots\\u_n+v_n\end{pmatrix}

Geometrically, this is the parallelogram rule (equivalently, tip-to-tail): draw \vec u, then draw \vec v starting where \vec u ended — the arrow from the very start to the very end is \vec u+\vec v. Addition is commutative (\vec u+\vec v=\vec v+\vec u) and associative, exactly like ordinary number addition, because it is ordinary number addition, done n times in parallel.

The zero vector \vec 0=(0,0,\dots,0) is the additive identity: \vec v+\vec 0=\vec v for every \vec v. Every vector has an additive inverse -\vec v=(-v_1,\dots,-v_n), the arrow of the same length pointing the opposite way, and \vec u-\vec v means exactly \vec u+(-\vec v): tip-to-tail with \vec v reversed.

Scalar multiplication

A scalar here just means an ordinary real number (called that to distinguish it from a vector). Multiplying a vector by a scalar c scales every component:

c\vec v=\begin{pmatrix}cv_1\\cv_2\\\vdots\\cv_n\end{pmatrix}

Geometrically, c\vec v points the same direction as \vec v if c>0, the opposite direction if c<0, and has length scaled by |c|. c=0 collapses any vector to \vec 0; c=1 leaves it unchanged; c=-1 reverses it.

Addition and scalar multiplication together obey the familiar distributive and associative laws — c(\vec u+\vec v)=c\vec u+c\vec v, (c+d)\vec v=c\vec v+d\vec v, c(d\vec v)=(cd)\vec v — which is unsurprising since both operations are just ordinary real-number arithmetic applied component by component. (This short list of laws is worth remembering: Module 17 takes exactly these properties and turns them into the definition of a vector space, stripping away the requirement that a "vector" be a list of numbers at all.)

Linear combinations

Combining both operations — scaling several vectors and adding the results — gives a linear combination:

c_1\vec v_1+c_2\vec v_2+\cdots+c_k\vec v_k

for scalars c_1,\dots,c_k. This single idea, a weighted sum of vectors, is the engine of the entire course: a system of linear equations (§16.1) asks which linear combination of some given vectors produces a target vector; span and linear independence (§17.1) ask what set of vectors a family of linear combinations can reach; and a matrix-vector product (§16.2) turns out to be nothing more than a linear combination of the matrix's columns.

Standard basis vectors. In \mathbb{R}^n, let \vec e_i be the vector with a 1 in position i and 0s elsewhere — e.g. in \mathbb{R}^3, \vec e_1=(1,0,0), \vec e_2=(0,1,0), \vec e_3=(0,0,1). Every vector is a linear combination of these:

\vec v=\begin{pmatrix}v_1\\v_2\\v_3\end{pmatrix}=v_1\vec e_1+v_2\vec e_2+v_3\vec e_3

which is really just restating that the components of \vec v are the coefficients — but stated this way, it previews §17.2's idea of a basis: a minimal set of vectors from which every other vector is reachable by exactly one linear combination.

Length and direction, briefly

Two more quantities are worth naming now, even though their full theory waits for Module 20: the length (or norm) of a vector,

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

(the Pythagorean theorem, applied to the arrow picture), and a unit vector, one with \|\vec v\|=1. Dividing any nonzero vector by its own length, \vec v/\|\vec v\|, produces a unit vector pointing the same direction — a process called normalizing.

Doing it in Python

import numpy as np

u = np.array([1, 2, 3])
v = np.array([4, -1, 2])

print("u + v      =", list(u + v))
print("u - v      =", list(u - v))
print("3u         =", list(3 * u))
print("2u - v     =", list(2 * u - v))
print("||u||      =", round(float(np.linalg.norm(u)), 4))
u + v      = [5, 1, 5]
u - v      = [-3, 3, 1]
3u         = [3, 6, 9]
2u - v     = [-2, 5, 4]
||u||      = 3.7417

A linear combination reaching a target vector, checked directly:

import numpy as np

v1 = np.array([1, 0])
v2 = np.array([1, 1])
target = np.array([5, 2])

c1, c2 = 3, 2  # to be found by hand below
combo = c1 * v1 + c2 * v2
print("c1*v1 + c2*v2 =", list(combo))
print("matches target:", np.array_equal(combo, target))
c1*v1 + c2*v2 = [5, 2]
matches target: True

Worked example

Given \vec v_1=(1,0) and \vec v_2=(1,1), find scalars c_1,c_2 so that c_1\vec v_1+c_2\vec v_2=(5,2).

Writing out both components:

c_1\vec v_1+c_2\vec v_2=\begin{pmatrix}c_1+c_2\\c_2\end{pmatrix}=\begin{pmatrix}5\\2\end{pmatrix}

The second row gives c_2=2 directly. Substituting into the first row: c_1+2=5\Rightarrow c_1=3.

\boxed{c_1=3,\ c_2=2}

Sanity check. 3(1,0)+2(1,1)=(3,0)+(2,2)=(5,2) ✓ — matching the Python check above, and previewing exactly the kind of question §16.1 answers systematically for any number of vectors and equations, rather than by reading off rows one at a time.

Your turn

1. Let \vec u=(2,-1,3) and \vec v=(0,4,-2). Compute \vec u+2\vec v.

2. Find \|\vec w\| for \vec w=(3,4), then find the unit vector pointing the same direction as \vec w.

3. True or false: for any vectors \vec u,\vec v and scalar c, c(\vec u+\vec v)=c\vec u+c\vec v.

Solutions

1. 2\vec v=(0,8,-4), so \vec u+2\vec v=(2+0,\,-1+8,\,3+(-4))=(2,7,-1).

2. \|\vec w\|=\sqrt{3^2+4^2}=\sqrt{25}=5. The unit vector is \vec w/5=(3/5,4/5) — check: \|(3/5,4/5)\|=\sqrt{9/25+16/25}=\sqrt{1}=1 ✓.

3. True. This is the distributive law, and it holds because both sides equal (cu_1+cv_1,\dots,cu_n+cv_n) componentwise — ordinary real numbers distribute this way, and vector addition and scalar multiplication are defined component by component, so the vector version inherits it for free.

Check yourself in code

Let \vec a=(2,-1,4) and \vec b=(1,3,-2). Compute \vec a+\vec b, \vec a-\vec b, 2\vec a+3\vec b, and \|\vec a\| (rounded to 4 decimal places).

Print exactly this:

a + b   = [3, 2, 2]
a - b   = [1, -4, 6]
2a + 3b = [7, 7, 2]
||a||   = 4.5826
import numpy as np

a = np.array([2, -1, 4])
b = np.array([1, 3, -2])

print("a + b   =", list(a + b))
# print a - b, 2a + 3b, and ||a|| (rounded to 4 dp) the same way
import numpy as np

a = np.array([2, -1, 4])
b = np.array([1, 3, -2])

print("a + b   =", list(a + b))
print("a - b   =", list(a - b))
print("2a + 3b =", list(2 * a + 3 * b))
print("||a||   =", round(float(np.linalg.norm(a)), 4))

A vector in \mathbb{R}^n is a list of n numbers, added componentwise and scaled by real numbers, with both operations matching the familiar parallelogram and stretching pictures. A linear combination — scaling and adding several vectors — is the single operation the rest of this course builds on: it's what a system of equations solves for, what span and basis are defined in terms of, and, as the next lesson shows, exactly what a matrix does to a vector.

Next: systems of linear equations, and Gaussian elimination as a systematic way to find every linear combination that hits a given target.