Find a course

Module 3: Vector Spaces and Linear TransformationsLesson 8 of 1215 min

Basis, Dimension and Rank

Find a basis and the dimension of a subspace, compute the column space and null space of a matrix, and apply the rank–nullity theorem.

Step 1 of 12Learn

Subspaces and bases

A subspace of ℝⁿ is a set of vectors that behaves like a smaller copy of space: it contains the zero vector, and it's closed under addition and scalar multiplication. If u and v are in it, so are u + v and cu. Lines and planes through the origin are subspaces of ℝ³; a plane that misses the origin is not, because it doesn't contain 0.

A basis for a subspace is a set of vectors that

  1. spans the subspace (reaches everything), and
  2. is linearly independent (has no redundancy).

It's the most efficient description possible: enough vectors to reach everything, and not one more.

The standard basis of ℝ³ is e₁ = (1, 0, 0), e₂ = (0, 1, 0), e₃ = (0, 0, 1). The vector (4, −2, 7) is 4e₁ − 2e₂ + 7e₃; its entries are its coordinates in this basis.

But bases aren't unique. (1, 0) and (1, 1) also form a basis of ℝ². In that basis, the vector (5, 3) has coordinates (2, 3), because 2(1, 0) + 3(1, 1) = (5, 3). Choosing a basis is choosing a coordinate system, and choosing a clever one can make a hard problem easy. That's the whole idea behind eigenvectors in the next module.

Here's the remarkable fact: every basis of a given subspace has the same number of vectors. That number is the dimension. A line has dimension 1, a plane dimension 2, and ℝⁿ dimension n.

Step 2 of 12Diagram

Every subspace of ℝ³, by dimension

Every subspace of ℝ³, by dimensionHierarchy diagram: Subspaces of ℝ³, Dimension 0: {0}, Dimension 1: lines, Dimension 2: planes, Dimension 3: ℝ³.Subspaces of ℝ³Dimension 0: {0}Dimension 1:linesDimension 2:planesDimension 3: ℝ³

Tap a shape with to see more.

Lines and planes that miss the origin are not subspaces: they do not contain 0.
Subspaces of ℝ³
Dimension 0: {0}

Basis: the empty set.

Dimension 1: lines

Lines through the origin; a basis has 1 vector.

Dimension 2: planes

Planes through the origin; a basis has 2 vectors.

Dimension 3: ℝ³

Any 3 independent vectors form a basis.

Step 3 of 12Practice · Fill in the blanks

Fill in the blanks

In the basis {(1, 0), (1, 1)} of ℝ², the vector (7, 4) has coordinates (, ).

Step 4 of 12Learn

Column space, null space and rank

Every matrix A comes with two important subspaces.

The column space, Col A, is the span of the columns of A. It's the set of all outputs Ax, so it answers the question which b make Ax = b solvable?

The null space, Nul A, is the set of all solutions of Ax = 0. It answers which inputs does A send to zero?

Finding bases. Row reduce A to echelon form.

  • The pivot columns of the original A form a basis for Col A. (Use the original columns, not the reduced ones: row operations change the column space.)
  • For Nul A, solve Ax = 0 in terms of the free variables. Each free variable contributes one basis vector.

Example. A = [1 2 1; 2 4 3] reduces to [1 2 1; 0 0 1], then to [1 2 0; 0 0 1]. Pivots are in columns 1 and 3, so Col A has basis (1, 2) and (1, 3), and since these are two independent vectors in ℝ², Col A is all of ℝ².

For the null space, x₂ is free; call it t. The reduced rows say x₁ + 2x₂ = 0 and x₃ = 0, so x = t(−2, 1, 0). Nul A is a line with basis (−2, 1, 0). Check: A(−2, 1, 0) = (−2 + 2 + 0, −4 + 4 + 0) = (0, 0).

The rank of A is the dimension of its column space, which equals the number of pivots. Here rank A = 2. Rank measures how much of the output space A actually reaches, the number of genuinely independent directions in its columns.

Step 5 of 12Practice · Work it out

A 4 × 6 matrix has 3 pivots after row reduction. What is the dimension of its null space?

Step 6 of 12Learn

The rank–nullity theorem

The example above had 3 columns, rank 2 and a 1-dimensional null space, and 2 + 1 = 3. That always happens:

rank A + dim Nul A = n, the number of columns of A.

The reason is simple bookkeeping. Each column of the echelon form either has a pivot (counted in the rank) or corresponds to a free variable (each one adds a dimension to the null space). Every column is one or the other.

The theorem has a satisfying interpretation: the n dimensions of input space split into the directions A keeps (rank) and the directions A crushes to zero (nullity).

Consequences you can use:

  • A 5 × 7 matrix has rank at most 5, so its null space has dimension at least 2. Ax = 0 always has nontrivial solutions.
  • A 7 × 5 matrix with rank 5 has a trivial null space, so Ax = b has at most one solution for each b. But its column space is only 5-dimensional inside ℝ⁷, so most b have no solution at all.
  • An n × n matrix is invertible exactly when its rank is n, which happens exactly when its null space is just {0}.

Row rank equals column rank. The number of independent rows always equals the number of independent columns, a fact that's not obvious at all. So rank A = rank Aᵀ. A 3 × 100 matrix can have rank at most 3, however many columns it has.

Step 7 of 12Practice · Match the pairs

Match each matrix description with its null space dimension.

Tap an answer, then tap the place where it belongs (or drag it there).

  1. 3 × 3, invertible
  2. 3 × 5, rank 3
  3. 4 × 4, rank 1
  4. 2 × 6, rank 2

Step 8 of 12Practice · Chart

Rank + nullity = number of columns

Tap the matrix with the largest null space.

Tap the bar that answers the question, then press Check.

Rank + nullity = number of columnsStacked bar chart with 4 categories: 3 × 5, rank 3: Rank (pivot columns) 3, Nullity (free columns) 2; 4 × 6, rank 3: Rank (pivot columns) 3, Nullity (free columns) 3; 5 × 5, rank 2: Rank (pivot columns) 2, Nullity (free columns) 3; 2 × 7, rank 2: Rank (pivot columns) 2, Nullity (free columns) 5.02468Columns3 × 5, rank 34 × 6, rank 35 × 5, rank 22 × 7, rank 25657
Rank + nullity = number of columns
ItemRank (pivot columns)Nullity (free columns)
3 × 5, rank 332
4 × 6, rank 333
5 × 5, rank 223
2 × 7, rank 225

Step 9 of 12Compare

Column space vs. null space

AspectColumn space Col ANull space Nul A
DefinitionAll combinations of A's columnsAll solutions of Ax = 0
Lives inℝᵐ (output space, m = rows)ℝⁿ (input space, n = columns)
AnswersFor which b is Ax = b solvable?Which inputs does A send to 0?
Basis fromPivot columns of the original AOne vector per free variable
Dimensionrank An − rank A

Step 10 of 12Note

Step 11 of 12Practice · Spot the mistake

A student found a basis for the column space of A = [1 2; 2 4; 0 1]. Which step is wrong?

Step 12 of 12Practice · Choose one

A is a 6 × 4 matrix whose columns are linearly independent. What is the rank of A?