Home›Courses›Linear Algebra›Week 5 · Lecture 17
← Lecture 16
On this pageRecall·Independent Lemma·Finite vs Infinite Dim·Enlarging to a Basis·Theorem 6.4.1·Example 6.4.1 — M₂₂·Example 6.4.2 — P₃·Example 6.4.3 — dim P = ∞·Theorem 6.4.2·Example 6.4.5·Dependent Lemma·Example 6.4.6·Row Space·Column Space·Null Space·Rank–Nullity·Looking Ahead·Exercises
Lecture 18 →
MATH-120 · Linear Algebra · Lecture 178 July 2026

Extending a Basis

How to grow an independent set into a full basis, how to shrink a spanning set down to one — and the four subspaces every matrix carries with it

§1Quick Recall

Lecture 16 gave us the general definition of a vector space and showed that subspaces, spans, independence, basis, and dimension all carry over from $\mathbb{R}^n$ to matrices, polynomials, and functions without a single new proof. Today we ask a very practical question that the earlier lectures never quite settled:

🎯
Today's question
Given a set of vectors that is independent but too small to be a basis, can we always grow it into one? And given a set that spans but is too big to be a basis, can we always shrink it into one? The answer to both is yes — and the tools that prove it are two small, sharp lemmas that do almost all of the work in this lecture.
  • •Independent: the only combination $a_1\mathbf{v}_1+\cdots+a_k\mathbf{v}_k=\mathbf{0}$ is the trivial one, $a_1=\cdots=a_k=0$.
  • •Spans $V$: every vector of $V$ is some linear combination of the set.
  • •Basis: independent and spans — the two properties meeting in the middle, with no waste and nothing missing.

§2Lemma 6.4.1 — The Independent Lemma

Lemma 6.4.1

Let $\{\mathbf{v}_1, \mathbf{v}_2, \ldots, \mathbf{v}_k\}$ be an independent set of vectors in a vector space $V$. If $\mathbf{u} \in V$ but $\mathbf{u} \notin \operatorname{span}\{\mathbf{v}_1,\mathbf{v}_2,\ldots,\mathbf{v}_k\}$, then $\{\mathbf{u}, \mathbf{v}_1, \mathbf{v}_2, \ldots, \mathbf{v}_k\}$ is also independent.

💡
Explanation
Independence means no vector in the set is redundant — none can be built from the others. Now bring in a genuinely new vector $\mathbf{u}$, one that cannot be reached by combining $\mathbf{v}_1,\ldots,\mathbf{v}_k$ at all. Could adding it suddenly create a dependency? A dependency would mean some nontrivial combination of $\mathbf{u},\mathbf{v}_1,\ldots,\mathbf{v}_k$ equals $\mathbf{0}$. But if the coefficient on $\mathbf{u}$ in that combination were nonzero, you could divide it out and solve for $\mathbf{u}$ in terms of the $\mathbf{v}_i$'s — directly contradicting $\mathbf{u}\notin\operatorname{span}\{\mathbf{v}_1,\ldots,\mathbf{v}_k\}$. So the coefficient on $\mathbf{u}$ must be $0$, which reduces the whole thing to a dependency among $\mathbf{v}_1,\ldots,\mathbf{v}_k$ alone — impossible, since they were already independent. So no nontrivial relation can exist: stepping "outside the span" is exactly what keeps a set independent as it grows.

§3Finite- vs. Infinite-Dimensional Spaces

Definition 6.7 — Finite / infinite dimensional

A vector space $V$ is called finite dimensional if it is spanned by a finite set of vectors. Otherwise, $V$ is called infinite dimensional.

Notice this is purely a statement about existence: does even one finite spanning list exist, no matter how large? If yes, the space is finite dimensional — even $\{\mathbf{0}\}$ qualifies, since the single vector $\mathbf{0}$ by itself spans it ($\operatorname{span}\{\mathbf{0}\}=\{\mathbf{0}\}$), so the zero vector space $\{\mathbf{0}\}$ is finite dimensional, with $\dim\{\mathbf{0}\}=0$ (the empty set is its basis).

⚖️
The dividing line, with examples
  • •Finite dimensional: $\mathbb{R}^n$ (basis $\{\mathbf{e}_1,\ldots,\mathbf{e}_n\}$, size $n$), $P_n$ (basis $\{1,x,\ldots,x^n\}$, size $n{+}1$), $M_{mn}$ (basis the matrix units, size $mn$) — each has a finite list that spans everything.
  • •Infinite dimensional: $P$, the space of all polynomials (Lecture 16, §15, and Example 6.4.3 below), and $F[a,b]$, the space of all functions on an interval — no finite list can ever span them, because you can always produce a polynomial or function of higher degree/complexity than anything your finite list can reach.

§4Lemma 6.4.2 — Enlarging to a Basis

Lemma 6.4.2

Let $V$ be a finite dimensional vector space. If $U$ is any subspace of $V$, then any independent subset of $U$ can be enlarged to a finite basis of $U$.

💡
Explanation
This is Lemma 6.4.1, run on repeat. Start with your independent subset of $U$. If it already spans $U$, you're done — it's a basis. If not, then by definition some vector $\mathbf{u}\in U$ lies outside its span, and Lemma 6.4.1 says you may add $\mathbf{u}$ while staying independent. Repeat: as long as the current set doesn't yet span $U$, there is always another vector of $U$ you're allowed to add. The only reason this process is guaranteed to stop — rather than grow forever — is that $V$ (and hence $U$) is finite dimensional: an independent set inside a finite-dimensional space can never contain more vectors than a fixed spanning set for that space (Theorem 6.4.1 below makes this precise), so the growing process runs out of room after finitely many steps. At that point, the set spans $U$ too, and — independent and spanning — it is a basis.

§5Theorem 6.4.1

Theorem 6.4.1

Let $V$ be a finite dimensional vector space spanned by $m$ vectors.

  • •1. $V$ has a finite basis, and $\dim V \leq m$.
  • •2. Every independent set of vectors in $V$ can be enlarged to a basis of $V$ by adding vectors from any fixed basis of $V$.
  • •3. If $U$ is a subspace of $V$, then: (a) $U$ is finite dimensional and $\dim U \leq \dim V$; (b) every basis of $U$ is part of a basis of $V$.
💡
Explanation — part by part

Part 1. If $m$ vectors already span $V$, no independent set inside $V$ can ever contain more than $m$ vectors — extra vectors beyond what's needed to span would necessarily create redundancy. So the "enlarging" process of Lemma 6.4.2, started from the empty set, must stabilize at some basis with at most $m$ vectors: a finite basis exists, and $\dim V\leq m$.

Part 2. This sharpens Lemma 6.4.2: you don't need to search all of $V$ for vectors to add — it's enough to check a single fixed basis you already know, and add whichever of its vectors are not yet in the span of your independent set. This is exactly the strategy Examples 6.4.1 and 6.4.2 below use: reach for the standard basis and test its vectors one at a time.

Part 3. A subspace can never have "more room" than the space containing it — (a) says this precisely: $U$ is automatically finite dimensional too, with $\dim U\leq\dim V$. And (b) says the coordinate system you build for $U$ is never wasted: it always extends to a full coordinate system for all of $V$, by the same enlarging process.

§6Enlarging a Basis in M₂₂

★ 1Example 6.4.1 — enlarge D to a basis of M₂₂

Enlarge the independent set $D = \left\{ \begin{bmatrix}1&1\\1&0\end{bmatrix}, \begin{bmatrix}0&1\\1&1\end{bmatrix}, \begin{bmatrix}1&0\\1&1\end{bmatrix} \right\}$ to a basis of $M_{22}$.

§7Enlarging a Basis in P₃

★ 2Example 6.4.2 — a basis of P₃ containing {1+x, 1+x²}

Find a basis of $P_3$ containing the independent set $\{1+x,\; 1+x^2\}$.

§8P Is Infinite Dimensional

★ 3Example 6.4.3 — the space P of all polynomials is infinite dimensional

Show that the space $P$ of all polynomials is infinite dimensional.

§9Theorem 6.4.2

Theorem 6.4.2

Let $U$ and $W$ be subspaces of the finite dimensional space $V$.

  • •1. If $U \subseteq W$, then $\dim U \leq \dim W$.
  • •2. If $U \subseteq W$ and $\dim U = \dim W$, then $U = W$.
💡
Explanation
Both parts are dimension-counting consequences of Theorem 6.4.1. Part 1 is Theorem 6.4.1(3a) applied twice: $U$ is a subspace of $W$ (since $U\subseteq W\subseteq V$), so $\dim U\leq\dim W$ directly — a smaller nested space cannot have more independent directions than the space containing it.

Part 2 is the sharp, surprising consequence: take any basis of $U$ — it is an independent subset of $W$ too (since $U\subseteq W$), with exactly $\dim U=\dim W$ vectors. By Theorem 6.4.1(2), this basis of $U$ could in principle be enlarged to a basis of $W$ by adding more vectors from $W$ — but there is no room left, since it already has $\dim W$ vectors and a basis of $W$ has exactly that many. So no vectors need to be added: the basis of $U$ already spans $W$, which forces $U=W$. In words: a subspace that fills up all the available dimension of a larger space must in fact be the whole space.

§10A Basis for {p(x) : p(a) = 0}

★ 4Example 6.4.5 — polynomials in Pₙ with a as a root

If $a$ is a number, let $W$ denote the subspace of all polynomials in $P_n$ that have $a$ as a root: $W = \{p(x) \text{ in } P_n : p(a) = 0\}$. Show that $\{(x-a),\, (x-a)^2,\, \ldots,\, (x-a)^n\}$ is a basis of $W$.

§11Lemma 6.4.3 — The Dependent Lemma

Lemma 6.4.3

A set $D = \{\mathbf{v}_1, \mathbf{v}_2, \ldots, \mathbf{v}_k\}$ of vectors in a vector space $V$ is dependent if and only if some vector in $D$ is a linear combination of the others.

💡
Explanation
This is the mirror image of the Independent Lemma, and it gives independence its most intuitive meaning: a set is dependent exactly when it contains wasted effort — some vector whose "job" could already be done by combining the rest, so it contributes nothing new to the span. If $D$ is dependent, some nontrivial combination $a_1\mathbf{v}_1+\cdots+a_k\mathbf{v}_k=\mathbf{0}$ has a nonzero coefficient, say $a_j\neq0$; dividing through by $a_j$ and solving for $\mathbf{v}_j$ expresses it as a combination of the others. Conversely, if some $\mathbf{v}_j$ is such a combination, moving everything to one side produces a nontrivial relation equal to $\mathbf{0}$ (the coefficient on $\mathbf{v}_j$ is $-1\neq0$), so $D$ is dependent. This is exactly the tool we need to shrink an oversized spanning set down to a basis: find a redundant vector, and discard it — the span doesn't change.

§12Shrinking a Spanning Set of P₃

★ 5Example 6.4.6 — find a basis inside a spanning set

Find a basis of $P_3$ in the spanning set $S = \{1,\; x+x^2,\; 2x-3x^2,\; 1+3x-2x^2,\; x^3\}$.

🧭
Two techniques, one page
This closes §6.4's toolkit: if a set is too small (independent, not yet spanning), the Independent Lemma tells you any outside vector may be added. If a set is too big (spans, not independent), the Dependent Lemma tells you to find a vector that's a combination of the others and discard it. Either direction, you arrive at a basis.

§13Row Space of a Matrix

We now turn from abstract vector spaces to the four subspaces that every matrix carries with it — the natural home of everything we did with Gaussian elimination back in Week 1, now seen through the lens of dimension.

Definition — row space

For an $m\times n$ matrix $A$, the row space of $A$, written $\operatorname{row}(A)$, is the subspace of $\mathbb{R}^n$ spanned by the rows of $A$ (treated as vectors in $\mathbb{R}^n$).

★ 6Elementary row operations don't change the row space

Prove: if $B$ is obtained from $A$ by adding a multiple of one row to another, then $\operatorname{row}(A) = \operatorname{row}(B)$.

★ 7Computing a row space and its rank

Find a basis for the row space of $A = \begin{bmatrix} 1&2&0&1 \\ 2&4&1&0 \\ 0&0&1&-2 \end{bmatrix}$, and state $\operatorname{rank}(A)$.

§14Column Space of a Matrix

Definition — column space

For an $m\times n$ matrix $A$, the column space of $A$, written $\operatorname{col}(A)$, is the subspace of $\mathbb{R}^m$ spanned by the columns of $A$.

★ 8col(A) is exactly the range of x ↦ Ax

Prove that $\operatorname{col}(A) = \{A\mathbf{x} : \mathbf{x}\in\mathbb{R}^n\}$, and that this set is a subspace of $\mathbb{R}^m$.

★ 9Computing a column space

Find a basis for $\operatorname{col}(A)$, for the same $A = \begin{bmatrix} 1&2&0&1 \\ 2&4&1&0 \\ 0&0&1&-2 \end{bmatrix}$ used above.

§15Null Space of a Matrix

Definition — null space

For an $m\times n$ matrix $A$, the null space of $A$, written $\operatorname{null}(A)$, is the solution set of the homogeneous system $A\mathbf{x}=\mathbf{0}$: $\operatorname{null}(A) = \{\mathbf{x}\in\mathbb{R}^n : A\mathbf{x}=\mathbf{0}\}$, a subspace of $\mathbb{R}^n$.

★ 10null(A) is a subspace

Prove that $\operatorname{null}(A)$ is a subspace of $\mathbb{R}^n$.

★ 11Computing a null space

Find a basis for $\operatorname{null}(A)$, again for $A = \begin{bmatrix} 1&2&0&1 \\ 2&4&1&0 \\ 0&0&1&-2 \end{bmatrix}$.

§16The Rank–Nullity Theorem

Rank–Nullity Theorem

For an $m\times n$ matrix $A$: $$\operatorname{rank}(A) + \operatorname{nullity}(A) = n,$$ where $\operatorname{rank}(A)=\dim\operatorname{row}(A)=\dim\operatorname{col}(A)$ and $\operatorname{nullity}(A)=\dim\operatorname{null}(A)$.

💡
Explanation
Row-reduce $A$ to echelon form. Every one of the $n$ columns is either a pivot column (contributes a leading variable) or a free column (contributes a free variable) — every column is exactly one or the other, so pivot columns $+$ free columns $=n$. The number of pivot columns is $\operatorname{rank}(A)$ (it's literally how rank is computed). The number of free variables is $\dim\operatorname{null}(A)$: each free variable, set to $1$ with the rest set to $0$, generates exactly one basis vector of the null space (as in Example 11 above), and these vectors are always independent because each one is the only basis vector with a $1$ in its own free-variable slot. So $\operatorname{rank}(A)+\operatorname{nullity}(A)$ counts pivot columns plus free columns — which is just $n$, the total number of columns.
Example 12Verifying rank–nullity

Verify the Rank–Nullity Theorem for $A = \begin{bmatrix} 1&2&0&1 \\ 2&4&1&0 \\ 0&0&1&-2 \end{bmatrix}$, and then use the theorem directly on a new matrix.

§17Looking Ahead

🧭
Next lecture: Orthogonality
We now have a complete toolkit for the algebraic shape of a subspace — spanning sets, independence, dimension, and the four subspaces of a matrix. What's missing is geometry: angles, lengths, and the idea of two vectors being "perpendicular." The next lecture introduces orthogonality — dot products, orthogonal sets and bases, and orthogonal projection — which will let us decompose $\mathbb{R}^n$ into perpendicular pieces built exactly from the row space, column space, and null space we computed today.

§18Exercises

Four problems to practice on your own, in the same spirit as today's examples. Hints only — try each one properly before reading further.

Exercise AEnlarging an independent set in P₂

Enlarge the independent set $\{1-x,\; x^2\}$ to a basis of $P_2$.

🧭
Hint
$\dim P_2 = 3$, and you have $2$ vectors — exactly one more is needed. Try each standard basis vector $1, x, x^2$ in turn (skip $x^2$, it's already in your set) and test independence of the resulting triple, the same way Example 6.4.2 did.
Exercise BShrinking a spanning set in R³

The set $\{(1,1,0),\,(0,1,1),\,(1,2,1),\,(1,0,-1)\}$ spans $\mathbb{R}^3$. Find a basis inside it.

🧭
Hint
Four vectors in a $3$-dimensional space must be dependent. Use the Dependent Lemma: look for one vector that's a combination of two others (try $(1,2,1)$ as a combination of the first two), discard it, then check the remaining three are independent by computing a $3\times3$ determinant.
Exercise CRow, column, and null space of a 2×3 matrix

Let $A = \begin{bmatrix} 1 & -1 & 2 \\ 2 & -2 & 5 \end{bmatrix}$. Find bases for $\operatorname{row}(A)$, $\operatorname{col}(A)$, and $\operatorname{null}(A)$, and verify the Rank–Nullity Theorem.

🧭
Hint
Row reduce first: $R_2\to R_2-2R_1$ gives a clean echelon form with pivots in columns $1$ and $3$. Read off $\operatorname{row}(A)$ from the echelon rows, $\operatorname{col}(A)$ from the original pivot columns, and solve for the one free variable to get $\operatorname{null}(A)$. You should find $\operatorname{rank}(A)=2$ and $\operatorname{nullity}(A)=1$, summing to $n=3$.
Exercise DA theorem 6.4.2 consequence

Let $U=\operatorname{null}(A)$ for a $4\times4$ matrix $A$ with $\operatorname{rank}(A)=4$. Explain, using Theorem 6.4.2, why $U=\{\mathbf{0}\}$.

🧭
Hint
Use Rank–Nullity to find $\dim U$ first. Then compare $U$ with the zero subspace $\{\mathbf{0}\}\subseteq U$ using Theorem 6.4.2(2): equal dimensions between nested subspaces force equality.
Looking back

Two lemmas — add what's missing, discard what's redundant — turn any independent or spanning set into a basis. The same two ideas, aimed at a matrix, produce its row space, column space, and null space.

Every computation today came down to the same move: row-reduce, then read the answer off the echelon form. What changes is only which piece of the echelon form you read — the nonzero rows for $\operatorname{row}(A)$, the original pivot columns for $\operatorname{col}(A)$, or the free-variable solutions for $\operatorname{null}(A)$. The Rank–Nullity Theorem is the receipt that these three counts always add up correctly.

Lecture 17 — complete
MATH-120 · Shoaib Khan · LUMS · July 2026
← Lecture 16Lecture 18 →