Recommended resources
The freely available resources this lesson will direct you to.
Welcome back! In our previous lesson, we developed a robust algorithm, Gaussian elimination, for solving systems of linear equations. We saw that the structure of the solution depended on the number of pivots (leading variables) and free variables. A unique solution existed when there were no free variables, while infinite solutions arose when free variables were present.
Today, we will formalize these concepts. The number of pivots is directly related to a matrix's rank, and the number of free variables is related to its nullity. Our goal is to compute the rank and nullity of a matrix and apply the rank-nullity theorem, a fundamental result that elegantly connects these two quantities to the dimensions of the matrix itself. This theorem provides a deep insight into the structure of linear transformations.
1. Defining Rank and Nullity
Let's begin by formally defining our key terms. The rank and nullity of a matrix are dimensions of two of its "fundamental subspaces": the column space and the null space.
4.8 Rank, Nullity, and the Fundamental Matrix Spaces
This section from a linear algebra textbook provides the formal definitions of rank and nullity. It connects them directly to the concepts of column space and null space, which we have discussed previously.
Read the section titled 'Rank and Nullity', starting with Definition 1. Pay close attention to how rank is defined as the dimension of the column space (and row space), and nullity is defined as the dimension of the null space.
To summarize the definitions for an matrix :
- Column Space, : The span of the columns of . This is a subspace of .
- Rank, : The dimension of the column space of . So, .
- Null Space, : The set of all solutions to the homogeneous equation . This is a subspace of .
- Nullity, : The dimension of the null space of . So, .
The video below offers another perspective on these definitions, framing them in the context of a linear map.
Linear Algebra 35 | Rank-Nullity Theorem
This video provides a concise visual explanation of rank and nullity. It defines rank as the dimension of the range (which is the column space) and nullity as the dimension of the kernel (which is the null space).
Watch the two segments from 00:39 to 03:03 and 05:38 to 06:40. The first part defines rank, and the second defines nullity. Notice the synonymous terms: range for column space and kernel for null space.
2. Computing Rank and Nullity
While the definitions are based on the dimensions of subspaces, the most practical way to compute rank and nullity is through the process we already know: Gaussian elimination.
-
To find the rank: Reduce the matrix to its row-echelon form. The number of pivots (or, equivalently, the number of non-zero rows) is the rank of . This works because elementary row operations do not change the dimension of the row space, and the non-zero rows of an echelon matrix form a basis for that space. A crucial theorem states that the dimension of the row space and the column space are always equal.
-
To find the nullity: Find the general solution to . The number of free variables in this solution is the nullity of . Each free variable corresponds to a basis vector for the null space.
Let's see this in action.
4.8 Rank, Nullity, and the Fundamental Matrix Spaces
The textbook section you just read continues with a detailed example. Follow it to see how reducing a matrix to its reduced row-echelon form (RREF) directly reveals both its rank and nullity.
Refer back to the same resource, this time focusing on 'EXAMPLE 1 Rank and Nullity of a 4 x 6 Matrix'. Follow the steps: the matrix is reduced, the rank is found by counting pivots, and the nullity is found by determining the number of basis vectors for the null space (which corresponds to the number of free variables).
3. The Rank-Nullity Theorem
In the example you just studied, you might have noticed a relationship: for the matrix , and . Note that , which is the number of columns. This is no coincidence; it is the essence of the Rank-Nullity Theorem.
Theorem (Rank-Nullity): If is an matrix, then
An Intuitive Proof
From our work with Gaussian elimination, we can construct a straightforward proof. For a system with variables (i.e., has columns):
- The number of pivots in the row-echelon form of gives the number of leading variables. By definition, this is the rank of .
- The number of non-pivot columns gives the number of free variables. This is the number of parameters in the general solution to , which by definition is the nullity of .
- The total number of variables is the sum of the leading and free variables. Therefore,
(number of leading variables) + (number of free variables) = n, which directly impliesrank(A) + nullity(A) = n.
A Formal Proof
While the argument above is correct and intuitive, a more rigorous proof relies on constructing bases for the null space and column space. Given your interest in formal derivations, the following proof is highly valuable. It builds a basis for the entire domain starting from a basis for the null space.
Linear Algebra 35 | Rank-Nullity Theorem
This video presents a complete, formal proof of the Rank-Nullity Theorem. It is a classic proof in linear algebra that demonstrates a powerful technique involving basis extension.
Watch the proof from 08:02 to 14:00. Follow the argument step-by-step: Start with a basis for the kernel (null space) of size k. Extend this to a basis for the entire domain R^n by adding r = n-k vectors. The core of the proof is to show that the images of these r new vectors under the transformation A form a basis for the range (column space). This establishes that the dimension of the range is r, leading to k + r = n.
Test your understanding!
A matrix defines a linear transformation from to . If the dimension of the null space of is 3, what is the dimension of its column space?
Show answer
Here, (the number of columns, dimension of the domain). We are given that .
Using the Rank-Nullity Theorem:
The dimension of the column space, which is the rank, is 7. This also implies that the transformation is surjective (onto), as its image spans all of .
4. The Full Picture: The Four Fundamental Subspaces
The rank and nullity are dimensions of two of the four fundamental subspaces associated with any matrix. Understanding all four provides a complete geometric picture of how a linear transformation acts. For an matrix with rank :
- Column Space : A subspace of with dimension .
- Null Space : A subspace of with dimension .
- Row Space : A subspace of with dimension .
- Left Null Space : A subspace of with dimension .
The Rank-Nullity theorem, rank(A) + nullity(A) = n, describes the dimensional trade-off within the domain . A corresponding theorem applies to the transpose, giving rank(A^T) + nullity(A^T) = m. Since , this becomes r + (m-r) = m, describing the trade-off within the codomain .
The following lecture excerpt from Prof. Gilbert Strang, who popularized this framework, masterfully explains these relationships.
10. The Four Fundamental Subspaces
In this classic MIT lecture, Professor Strang explains the dimensions of all four fundamental subspaces. This will put the rank-nullity theorem into its broader context.
Watch from 11:58 to 20:22. Prof. Strang outlines the dimensions of the four subspaces in terms of m, n, and the rank r. He explicitly shows how the dimensions of the row space (r) and null space (n-r) sum to n.
This famous diagram provides a powerful visual summary of everything we've discussed.

Conclusion
In this lesson, we attached formal meaning to the pivot and free variable counts from Gaussian elimination.
Key Takeaways:
- The rank of a matrix is the dimension of its column space (and row space). It is computed as the number of pivots in its row-echelon form.
- The nullity of a matrix is the dimension of its null space. It is computed as the number of free variables in the solution to .
- The Rank-Nullity Theorem states that for any matrix , . This represents a fundamental conservation law: every dimension of the input space is either "crushed" into the null space or mapped to a dimension in the column space.
In our next lesson, we will move on to another central concept in linear algebra: the determinant of a square matrix. We will see that the determinant provides a single-number summary of many of the matrix's properties, including a powerful test for invertibility, which itself is directly connected to the rank. An matrix is invertible if and only if its rank is , a fact we are now equipped to understand means its nullity must be 0.