Subspaces and Spanning
The first step into vector spaces: which subsets of ℝⁿ are self-contained worlds of their own, and how a handful of vectors can build an entire space
§1A Story Before We Begin
Imagine you run a delivery company in a flat city. Every route your trucks can take is some combination of "go east" and "go north." You never need a third instruction — from those two moves you can reach any address in town. Those two directions span the whole city.
Now suppose one truck is stuck on a single straight highway. No matter how it drives — forward, backward, fast, slow — it stays on that one line. The set of places it can reach is smaller than the whole city, but it is still self-contained: combine any two reachable points and you land on another reachable point. That smaller self-contained world is a subspace.
§2Quick Recall & A Word on Where We Are
You already know $\mathbb{R}^n$: the set of all lists of $n$ real numbers, which we call vectors. You can add two of them and scale one by a number, and the result is again in $\mathbb{R}^n$. From Lecture 1 you also know a homogeneous system $A\mathbf{x} = \mathbf{0}$ and its solutions.
§3What Is a Subspace?
A subspace is a subset of $\mathbb{R}^n$ that is a self-contained world: you cannot escape it by adding its vectors or scaling them. Three simple rules capture exactly this.
A set $U$ of vectors in $\mathbb{R}^n$ is called a subspace of $\mathbb{R}^n$ if it satisfies all three:
$\textbf{S1.}$ The zero vector $\mathbf{0}$ is in $U$.
$\textbf{S2.}$ If $\mathbf{x}$ and $\mathbf{y}$ are in $U$, then $\mathbf{x} + \mathbf{y}$ is in $U$.
$\textbf{S3.}$ If $\mathbf{x}$ is in $U$, then $a\mathbf{x}$ is in $U$ for every real number $a$.
We say $U$ is closed under addition when S2 holds, and closed under scalar multiplication when S3 holds. "Closed" is the key word: you stay inside $U$ no matter what you do.
§4The Two "Free" Subspaces
Every $\mathbb{R}^n$ comes with two subspaces you get for free, sitting at the two extremes of size.
$\textbf{(a) } \mathbb{R}^n$ itself is a subspace of $\mathbb{R}^n$. It obviously contains $\mathbf{0}$, and adding or scaling vectors in $\mathbb{R}^n$ lands you back in $\mathbb{R}^n$. All three axioms hold trivially.
$\textbf{(b) } U = \{\mathbf{0}\}$, the set containing only the zero vector, is a subspace. Check: $\mathbf{0}$ is in it (S1); $\mathbf{0} + \mathbf{0} = \mathbf{0}$ stays in it (S2); $a\mathbf{0} = \mathbf{0}$ stays in it (S3). This is the smallest possible subspace.
These two — the whole space and the zero space — are called the improper subspaces (some texts say "trivial"). Any other subspace, sitting strictly between them in size, is called a proper subspace. The interesting geometry lives in the proper ones.
§5Lines and Planes Through the Origin
The proper subspaces of $\mathbb{R}^3$ turn out to be exactly the lines and planes that pass through the origin. The "through the origin" part is not optional — it is what makes S1 work. Let us prove it for a plane.
Let $U = \{ (x, y, z) : ax + by + cz = 0 \}$ be the set of points on a plane through the origin in $\mathbb{R}^3$ (here $a, b, c$ are fixed numbers, not all zero). Show $U$ is a subspace.
Play with the four cases below. Watch how "through the origin" is exactly the dividing line between a subspace and an impostor.
§6Two Subspaces Every Matrix Carries
Every matrix quietly creates two subspaces. They are among the most useful objects in all of linear algebra.
Let $A$ be an $m \times n$ matrix.
• The null space is $\operatorname{null} A = \{\mathbf{x} \text{ in } \mathbb{R}^n : A\mathbf{x} = \mathbf{0}\}$ — all the inputs that $A$ crushes to zero.
• The image is $\operatorname{im} A = \{A\mathbf{x} : \mathbf{x} \text{ in } \mathbb{R}^n\}$ — all the outputs $A$ can produce.
Show that for an $m \times n$ matrix $A$, $\operatorname{null} A$ is a subspace of $\mathbb{R}^n$.
§7Impostors: Sets That Are NOT Subspaces
Do not fall into thinking every subset of $\mathbb{R}^n$ is a subspace. Most are not. To disprove a subspace claim, you only need one axiom to fail — and one specific counterexample is enough.
$\textbf{Impostor 1: } U_1 = \{ (x, y) \text{ in } \mathbb{R}^2 : x \geq 0 \}$ — the right half-plane.
This one contains $\mathbf{0}$ and is closed under addition (two points with $x \geq 0$ add to a point with $x \geq 0$). But S3 fails. Take the point $(1, 0)$, which is in $U_1$, and scale by $a = -1$:
$$(-1)\cdot(1, 0) = (-1, 0), \quad \text{which has } x = -1 < 0.$$
So $(-1, 0)$ is not in $U_1$. Scaling knocked us out of the set. Not a subspace.
$\textbf{Impostor 2: } U_2 = \{ (x, y) \text{ in } \mathbb{R}^2 : x^2 = y^2 \}$.
This set is the two diagonal lines $y = x$ and $y = -x$. It contains $\mathbf{0}$ and is closed under scaling (if $x^2 = y^2$ then $(ax)^2 = (ay)^2$). But S2 fails. Both $(1, 1)$ and $(1, -1)$ are in $U_2$ (each satisfies $x^2 = y^2$). Add them:
$$(1, 1) + (1, -1) = (2, 0), \quad \text{but } 2^2 = 4 \neq 0 = 0^2.$$
So $(2, 0)$ is not in $U_2$. Adding two members left the set. Not a subspace. Lesson: a set built from a non-linear condition (an inequality, a square, a product) almost always fails one of the closure rules.
§8Part B — Spanning: Building a Space From a Few Vectors
Subspaces can be infinite — a plane has infinitely many points. It would be hopeless to list them all. The magic of spanning is that you can describe an entire infinite subspace with just a handful of vectors, plus one instruction: "take all combinations of these."
§9Linear Combinations
A linear combination of vectors $\mathbf{v}_1, \mathbf{v}_2, \ldots, \mathbf{v}_k$ is any vector of the form $$a_1\mathbf{v}_1 + a_2\mathbf{v}_2 + \cdots + a_k\mathbf{v}_k,$$ where the numbers $a_1, a_2, \ldots, a_k$ are called the coefficients. You scale each vector by a number and add the results.
Let $\mathbf{v}_1 = (1, 0)$ and $\mathbf{v}_2 = (0, 1)$ in $\mathbb{R}^2$. Then
$$3\mathbf{v}_1 + 5\mathbf{v}_2 = 3(1,0) + 5(0,1) = (3, 0) + (0, 5) = (3, 5).$$
So $(3, 5)$ is a linear combination of $\mathbf{v}_1$ and $\mathbf{v}_2$ with coefficients $3$ and $5$. In fact every vector $(x, y)$ in $\mathbb{R}^2$ is $x\mathbf{v}_1 + y\mathbf{v}_2$ — these two build the whole plane.
§10The Span of a Set of Vectors
The span of vectors $\mathbf{v}_1, \mathbf{v}_2, \ldots, \mathbf{v}_k$ is the set of all their linear combinations: $$\operatorname{span}\{\mathbf{v}_1, \ldots, \mathbf{v}_k\} = \{\, a_1\mathbf{v}_1 + a_2\mathbf{v}_2 + \cdots + a_k\mathbf{v}_k \;:\; a_1, \ldots, a_k \text{ in } \mathbb{R} \,\}.$$ If $U = \operatorname{span}\{\mathbf{v}_1, \ldots, \mathbf{v}_k\}$, we say the vectors span $U$, or that $U$ is spanned by them, and we call $\{\mathbf{v}_1, \ldots, \mathbf{v}_k\}$ a spanning set for $U$.
In words: the span is everything you can reach by mixing the given vectors with every possible choice of coefficients. Let us see what different numbers of vectors produce.
• One nonzero vector $\mathbf{v}$: $\operatorname{span}\{\mathbf{v}\} = \{t\mathbf{v}\}$ is a line through the origin.
• Two vectors in different directions: their span is a plane through the origin.
• Three independent vectors in $\mathbb{R}^3$: their span is $\textbf{all of } \mathbb{R}^3$.
Watch this happen live — go from zero, to one, to two vectors and see the span grow from a point to a line to a plane:
§11Testing Membership: Is a Vector in the Span?
The core skill is answering: "is a given vector $\mathbf{p}$ in $\operatorname{span}\{\ldots\}$?" This is just asking whether $\mathbf{p}$ can be written as a linear combination — which turns into solving a linear system.
Let $\mathbf{x} = (2, -1, 2, 1)$ and $\mathbf{y} = (3, 4, -1, 1)$ in $\mathbb{R}^4$. Determine whether $\mathbf{p} = (0, -11, 8, 1)$ or $\mathbf{q} = (2, 3, 1, 2)$ lies in $U = \operatorname{span}\{\mathbf{x}, \mathbf{y}\}$.
§12Theorem 5.1.1 — Every Span Is a Subspace
The two big ideas of today — subspace and span — are secretly the same idea. This theorem is the bridge.
Let $U = \operatorname{span}\{\mathbf{x}_1, \mathbf{x}_2, \ldots, \mathbf{x}_k\}$ in $\mathbb{R}^n$. Then:
$\textbf{1.}$ $U$ is a subspace of $\mathbb{R}^n$ containing each $\mathbf{x}_i$.
$\textbf{2.}$ If $W$ is any subspace that contains each $\mathbf{x}_i$, then $U \subseteq W$.
We will not prove this formally, but you already have the pieces: Part 1 is just checking S1, S2, S3 for combinations (each holds because a combination of combinations is still a combination), and Part 2 is the closure argument in the box above.
§13Four Classic Spanning Facts
If $\mathbf{x}$ and $\mathbf{y}$ are in $\mathbb{R}^n$, show that $\operatorname{span}\{\mathbf{x}, \mathbf{y}\} = \operatorname{span}\{\mathbf{x} + \mathbf{y}, \mathbf{x} - \mathbf{y}\}$.
Show that $\mathbb{R}^n = \operatorname{span}\{\mathbf{e}_1, \mathbf{e}_2, \ldots, \mathbf{e}_n\}$, where $\mathbf{e}_1, \ldots, \mathbf{e}_n$ are the columns of the identity matrix $I_n$.
For an $m \times n$ matrix $A$, let $\mathbf{x}_1, \ldots, \mathbf{x}_k$ be the basic solutions of $A\mathbf{x} = \mathbf{0}$ produced by the Gaussian algorithm. Then $\operatorname{null} A = \operatorname{span}\{\mathbf{x}_1, \ldots, \mathbf{x}_k\}$.
Let $\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_n$ be the columns of an $m \times n$ matrix $A$. Then $\operatorname{im} A = \operatorname{span}\{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_n\}$.
§14Exercises
Instructive problems are solved in full. Where several are the same type, one is worked and the rest carry hints. The proof problems are worth your time — do not just read the solution, try them first.
For each set, we check the axioms. Remember: one failing axiom (with a counterexample) is enough to disqualify.
$\textbf{(a)}$ $\mathbf{x} = (2, -1, 0, 1)$, $\mathbf{y} = (1, 0, 0, 1)$, $\mathbf{z} = (0, 1, 0, 1)$.
$\textbf{(b)}$ $\mathbf{x} = (1, 2, 15, 11)$, $\mathbf{y} = (2, -1, 0, 2)$, $\mathbf{z} = (1, -1, -3, 1)$. $\quad\textbf{(c)}$ $\mathbf{x} = (8, 3, -13, 20)$, $\mathbf{y} = (2, 1, -3, 5)$, $\mathbf{z} = (-1, 0, 2, -3)$. $\quad\textbf{(d)}$ $\mathbf{x} = (2, 5, 8, 3)$, $\mathbf{y} = (2, -1, 0, 5)$, $\mathbf{z} = (-1, 2, 2, -3)$.
$\textbf{(a)}$ $\{(1,1,1,1),(0,1,1,1),(0,0,1,1),(0,0,0,1)\}$. $\quad\textbf{(b)}$ $\{(1,3,-5,0),(-2,1,0,0),(0,2,1,-1),(1,-4,5,0)\}$.
Let $U$ be a non-empty subset of $\mathbb{R}^n$. Show $U$ is a subspace if and only if S2 (closed under addition) and S3 (closed under scalar multiplication) both hold.
Let $U$ and $W$ be subspaces of $\mathbb{R}^n$. Define $U \cap W = \{\mathbf{x} : \mathbf{x} \in U \text{ and } \mathbf{x} \in W\}$ and $U + W = \{\mathbf{u} + \mathbf{w} : \mathbf{u} \in U, \mathbf{w} \in W\}$. Show both are subspaces of $\mathbb{R}^n$.
A subspace is a self-contained world; a span is how you build one from a few vectors.
We now know a subspace can be described by a spanning set — but a spanning set can be wasteful. In Example 5, two different sets described the same subspace, and one might carry a redundant vector that adds nothing. That raises the sharpest question in linear algebra: what is the smallest set of vectors that still spans a subspace, with no waste? Vectors that carry no redundancy are called linearly independent, and a smallest spanning set is a basis. Those two ideas — independence and basis — are where we go next, and they unlock the notion of dimension.