As we’ve seen in Chapter 5.1 and Chapter 5.2, the outputs of a matrix form a set of vectors called its column space, .
We’ve seen that the column space of a matrix with 2 rows might be a line or all of , and that the column space of a matrix with 3 rows might be a line, a plane, or all of . But how do we describe the column space of a matrix with more than 3 rows?
Subspaces¶
Lines and planes are both “flat” objects that extend infinitely, without edges, in their directions. A line, whether it is in , , or for that matter, is 1-dimensional in some sense and can be thought of as a “slice” of space. Similarly, a plane in is a 2-dimensional “slice.”
The general notion of a “flat slice” through the origin is more precisely referred to as a subspace.
Imagine a subspace as a gated community of vectors, where linear combinations cannot escape the community. These conditions must hold for every vector in the set and every real scalar. One counterexample is enough to show that a set is not a subspace.

Examples and non-examples¶
Below, we’ve shown 4 examples of subsets of in blue. Orange vectors belong to the set, while pink vectors (for the sets that are not subspaces) show a violation of one of the subspace properties. The pink cross marks the missing zero vector.

The line is a subspace. Its vectors have the form . It contains , and
are still on the line.
The first quadrant, where and , is not a subspace. It contains but not . It fails closure under scalar multiplication.
The line is not a subspace. It misses the origin: . It is an affine subspace—a shifted subspace. Being flat is not enough.
The parabola , written in set-builder notation as
is not a subspace. It contains , but doubling this vector gives , which is not on the parabola. This fails closure under both scalar multiplication and addition. Passing through the origin is not enough either.
The possible subspaces in and are:
| Space | All possible types of subspaces |
|---|---|
| , lines through the origin, all of | |
| , lines through the origin, planes through the origin, all of |
Spans and column spaces¶
Subspaces generalize lines and planes through the origin, which we already know how to describe as spans of one or two vectors. Here’s the key connection: Every span of vectors in is a subspace of . In particular, for an matrix is a subspace of .
For example, revisit the matrices from Chapter 5.1:
For , is a subspace of : the plane .
Adding the redundant column in leaves that plane unchanged, so is the same subspace.
The three independent columns of span all of , which is itself a subspace of .
Bases¶
Consider the matrix
Its column space is a subspace of , since its columns have four entries. But we don’t need all three columns to describe , because its third column is redundant:
Removing leaves the column space unchanged. Indeed,
and every combination of is an output by choosing . These two columns span the column space and are independent, since neither is a scalar multiple of the other.
We say form a basis for .
The plural of basis is bases. Every nonzero subspace has infinitely many bases. Here are some examples and non-examples of bases for , where
| Collection | Is it a basis of ? |
|---|---|
| No: independent, but spans only a line. | |
| Yes: independent and spans the whole column space. | |
| No: dependent and spans only a line. | |
| Yes: independent, and recovers the remaining column. | |
| No: spans the column space, but is dependent. | |
| Yes: independent, and subtracting its first vector from its second recovers . |
The last collection shows that a basis need not use the original matrix’s columns.
Dimension¶
Different bases of a subspace can use different vectors, but they always contain the same number of vectors.
For our matrix
the basis contains two vectors. Thus : its column space is a plane through the origin in .
These are three different counts: 4 rows tell us that outputs have four entries; 3 columns tell us that inputs have three entries; dimension 2 tells us how many vectors a basis contains.
A line has dimension 1, regardless of how many entries its vectors have. For example,
is a line in , with the displayed nonzero vector as a basis.
The columns of form the standard basis of : they are independent, and any vector is their linear combination with its entries as coefficients. Hence . By convention, the empty collection is a basis of , which has dimension zero.
For example, 3 linearly independent vectors in must form a basis of and span all of . Since has dimension 3, an independent collection of 3 vectors already has as many vectors as a basis; it cannot span a smaller subspace.
Example: A basis from equations¶
Consider the set
What does this set look like? The equations force and . Choose and . Then
Every vector in has this form, and every choice of satisfies both equations. Thus is the span of the two displayed vectors, so it is a subspace. Neither vector is a scalar multiple of the other, so they form a basis. Therefore : it is a plane through the origin in .
Rank and solvability¶
Equivalently, rank is the maximum number of linearly independent columns. Our matrix has rank 2.
Here are several examples of matrices and their ranks; we have already seen many of these matrices in this chapter.
| Matrix | Rank | Explanation |
|---|---|---|
| 2 | The first two columns are independent; the third is the first minus three times the second. | |
| 2 | Its two columns are independent. | |
| 2 | The third column is twice the first minus the second; the first two are independent. | |
| 3 | The first two columns span ; the third lies outside that plane. | |
| 3 | Its first three columns already span ; the fourth cannot enlarge that span. | |
| 4 | Its columns point along four different coordinate directions. | |
| 3 | Columns 1, 2, and 4 are independent; column 3 is a combination of columns 1 and 2. | |
| 1 | The first column is nonzero and the second is -2 times the first. |
As a thought experiment, consider a matrix. Its smallest possible rank is 0, achieved by the zero matrix. The largest is 7: its column space is a subspace of , so it cannot have dimension larger than 7.
More generally, a basis chosen from the columns of an matrix cannot contain more than vectors, and a subspace of cannot have dimension larger than . Therefore,
Invertibility¶
An matrix is invertible exactly when its columns are independent, or equivalently, when its rank is . Those columns then form a basis of .
Solvability¶
The equation has a solution exactly when . If we want a solution for every , the column space must be all of :
We compare rank to the number of rows when asking whether every output is possible. A rectangular matrix can produce every output without being invertible: for example, has rank 2, but its third input entry can be anything.
As another example, consider
The first two columns are independent. The third is their sum, and the fourth is three times the second minus the first. Thus the first two columns form a basis of , and .
A general combination of the basis vectors is
So is the plane . This tells us exactly which outputs are possible. For instance,
but is impossible. The columns are dependent, so every possible output has infinitely many inputs. Rank 2 describes the dimension of the output set; the plane equation tells us whether a particular vector belongs to it.