Linear Algebra • Matrix Decompositions & Structure

Rank & Nullity — Rank and Nullity

Discover how the rank and nullity of a matrix reveal everything about its solutions.

Linear Algebra emblem with a matrix grid, a variable, and three-dimensional axes.
Inside this lesson 10 sections 5 questions 7 figures

SECTION 1

Historical Context & Motivation

When mathematicians first started working with systems of equations — sets of equations that share the same unknowns — they needed a way to figure out how many solutions existed. Could you find exactly one answer? Infinitely many? None at all? The ideas of rank and nullity grew out of this basic question. These two numbers tell you how "powerful" a matrix is and how much freedom the solutions have.

1750s • Early Systems of Equations

Mathematicians like Gabriel Cramer developed rules for solving systems of linear equations, laying the groundwork for understanding when solutions exist.

1840s • Cayley & Matrices

Arthur Cayley formalized the idea of a matrix — a rectangular grid of numbers. This gave mathematicians a compact tool for representing entire systems of equations at once.

1879 • Sylvester Coins "Rank"

James Joseph Sylvester introduced the term rank to describe the number of truly independent rows or columns in a matrix.

1884 • Nullity Emerges

Sylvester also defined nullity as the companion to rank, capturing the dimension of the set of solutions that map to zero.

1900s–Today • The Rank–Nullity Theorem

The elegant relationship rank + nullity = number of columns became a cornerstone theorem used in computer graphics, data science, engineering, and machine learning.

The central question these mathematicians faced still drives us today: given a matrix, what information does it actually carry, and what does it lose? Rank and nullity give us a precise answer.

SECTION 2

Core Principles & Definitions

Before we dive in, let's make sure you're comfortable with a few key ideas. This lesson assumes you are familiar with vectors, systems of linear equations, and basic elementary row operations (swapping rows, scaling rows, and adding multiples of one row to another). A matrix is a rectangular grid of numbers arranged in rows (horizontal) and columns (vertical). When we talk about "solving" a matrix equation, we mean finding the values of unknowns that satisfy a system of linear equations. Rank and nullity are two numbers that describe what a matrix can and cannot do.

1

Rank

The rank of a matrix is the number of linearly independent rows (equivalently, linearly independent columns). A row is independent if it cannot be written as a combination of the other rows. Rank tells you how much "useful information" the matrix carries.
2

Nullity

The nullity counts the number of free variables — directions in which the matrix "collapses" inputs to zero. A higher nullity means more flexibility (more free parameters) in the solutions.
3

Null Space (Kernel)

The null space (also called the kernel) is the set of all vectors x satisfying Ax = 0 — every vector that the matrix sends to zero. Its dimension (the number of linearly independent vectors needed to describe it) equals the nullity.
4

Row Echelon Form

To find rank, we transform the matrix into row echelon form (REF) using elementary row operations. The result has a staircase pattern where each leading nonzero entry (called a pivot) lies to the right of the pivot in the row above. The number of nonzero rows equals the rank.
5

The Rank–Nullity Theorem

The big idea: Rank + Nullity = Number of Columns. This always holds for any matrix. If you know two of these three values, you can find the third.
✦

KEY TAKEAWAY

Think of a matrix like a highway interchange. The rank is the number of lanes that actually carry traffic to different destinations. The nullity is the number of lanes that loop back to the starting point — they carry cars but don't go anywhere new. Together, rank + nullity always equals the total number of lanes (columns).

SECTION 3

Visual Explanation

The following diagram shows how a 3×3 matrix transforms vectors. Some directions get mapped to meaningful outputs (those count toward the rank), while others get squashed to zero (those live in the null space and count toward the nullity).

How a Matrix Maps Input Space to Output SpaceInput Space (3 columns)e₁e₂e₃3 input directionsMatrix AtransformsOutput SpaceAe₁Ae₂Ae₃ = 0Rank = 2 (outputs reached)Nullity = 1 (crushed to zero)Rank + Nullity = 2 + 1 = 3= Number of columns ✓
The input space has three directions (e₁, e₂, e₃). After the matrix multiplies them, two directions produce real outputs (rank = 2), but one direction (e₃) gets squashed to the zero vector (nullity = 1). Notice that 2 + 1 = 3, the number of columns.

In the diagram, the left box represents all possible inputs (the domain has 3 dimensions because the matrix has 3 columns). The right box shows what the matrix produces as output. Two of the three input directions survive and produce distinct outputs — that's the rank. The third direction gets completely flattened to the origin (the zero vector). That collapsed direction belongs to the null space, and since one direction was lost, the nullity is 1.

SECTION 4

Mathematical Framework

Let's put the ideas into precise formulas. Suppose you have a matrix A with m rows and n columns. We write this as an m × n matrix.

RANK DEFINITION

rank(A)=numberofpivotcolumnsinREFofArank(A) = number of pivot columns in REF of A

A pivot column is a column that contains a leading nonzero entry (called a pivot) after you row-reduce the matrix. REF stands for Row Echelon Form.

NULLITY DEFINITION

nullity(A)=n−rank(A)nullity(A) = n − rank(A)

Here, n is the number of columns. The nullity equals the number of free variables — columns without pivots.

RANK–NULLITY THEOREM

rank(A)+nullity(A)=nrank(A) + nullity(A) = n

This always holds for any m × n matrix. The total number of columns is split between pivot columns (rank) and free columns (nullity).

To find the rank in practice, you row-reduce the matrix using elementary row operations: swapping rows, multiplying a row by a nonzero constant, or adding a multiple of one row to another. Once the matrix is in row echelon form (a staircase pattern where each leading entry is to the right of the one above it), you count the nonzero rows. That count is the rank. The leftover columns — the ones without leading entries — correspond to free variables, and their count is the nullity.

💡

Remember

Row operations do not change the rank or nullity of a matrix. You're rearranging the information, not destroying it. That's why row reduction is a reliable way to compute these values.

SECTION 5

Finding Rank & Nullity Step by Step

The best way to understand rank and nullity is to see row reduction in action. The diagram below walks through the transformation of a 3 × 4 matrix into row echelon form, highlighting pivot positions and free variables at each stage.

Row Reduction: Identifying Pivots and Free VariablesSTEP 1: Original Matrix⎡ 1 2 1 4 ⎤⎢ 2 4 3 9 ⎥⎣ 3 6 4 13 ⎦R₂−2R₁R₃−3R₁STEP 2: Eliminate below pivot 1⎡ 1 2 1 4 ⎤⎢ 0 0 1 1 ⎥⎣ 0 0 1 1 ⎦R₃−R₂STEP 3: Row Echelon Form⎡ 1 2 1 4 ⎤⎢ 0 0 1 1 ⎥⎣ 0 0 0 0 ⎦Identifying Pivots vs Free VariablesCol 1PIVOTCol 2FREECol 3PIVOTCol 4FREE2 pivot columns → Rank = 2 | 2 free columns → Nullity = 2 | 2 + 2 = 4 columns ✓Rank = 2Two nonzero rows in REFTwo pivot positions (columns 1 & 3)The matrix carries 2 independentpieces of informationNullity = 2Two free variables (columns 2 & 4)The null space is 2-dimensionalSolutions have 2 degreesof freedom
A 3 × 4 matrix is row-reduced in three steps. The final row echelon form reveals 2 pivot columns (rank = 2) and 2 free columns (nullity = 2), confirming 2 + 2 = 4 columns.

Notice how the staircase pattern in the row echelon form tells the whole story. Each step in the staircase marks a pivot, and each column that doesn't have a stair step is free. The bottom row of all zeros means that the third original row was just a linear combination of the first two — it carried no new information.

SECTION 6

Worked Example

Let's find the rank and nullity of the following matrix and verify the Rank–Nullity Theorem.

Finding Rank and Nullity of a 3 × 3 Matrix

  1. 1

    Step 1 — Write the Matrix

    Consider the matrix A = ⎡ 1 2 3 ⎤ ⎢ 2 4 6 ⎥ ⎣ 1 3 5 ⎦. This is a 3 × 3 matrix, so it has n = 3 columns.
  2. 2

    Step 2 — Perform Row Reduction (R₂ − 2R₁ and R₃ − R₁)

    Subtract 2 times Row 1 from Row 2, and subtract Row 1 from Row 3. This gives: ⎡ 1 2 3 ⎤ ⎢ 0 0 0 ⎥ ⎣ 0 1 2 ⎦. Notice that Row 2 became all zeros — that means the original Row 2 was exactly twice Row 1.
  3. 3

    Step 3 — Swap Rows to Get Proper Staircase

    Swap Row 2 and Row 3 to put the nonzero row higher: ⎡ 1 2 3 ⎤ ⎢ 0 1 2 ⎥ ⎣ 0 0 0 ⎦. Now the matrix is in row echelon form with a clear staircase pattern.
  4. 4

    Step 4 — Count Pivots and Free Variables

    There are 2 nonzero rows, with pivots in Column 1 and Column 2. Column 3 has no pivot, so it corresponds to a free variable.
    Rank = 2 (2 pivot columns)
  5. 5

    Step 5 — Calculate Nullity and Verify

    Nullity = n − rank = 3 − 2 = 1. There is one free variable (Column 3), meaning the null space is one-dimensional — any solution to Ax = 0 can be written as a scalar multiple of a single vector.
    Nullity = 1 and 2 + 1 = 3 = n ✓

SECTION 7

Rank vs. Nullity — What Each Tells You

Rank and nullity are two sides of the same coin. One measures what a matrix preserves, while the other measures what it destroys. Understanding both helps you predict solutions to systems of equations.

FeatureRankNullity
What it countsLinearly independent rows/columns (pivot columns)Free variables (non-pivot columns)
MeaningHow much information the matrix carriesHow much freedom the solutions have
If it equals n (columns)Matrix has full column rank; Ax = b has at most one solutionNot possible (nullity can't exceed n)
If it equals 0Matrix is the zero matrixOnly the trivial solution x = 0 exists
High value means…The matrix is "powerful" — maps to many directionsMany solutions — lots of inputs get crushed to zero

Comparing the roles of rank and nullity

🔑

WHY THIS MATTERS

When you solve a system of equations Ax = b, the rank tells you whether a solution exists, and the nullity tells you how many solutions there are. If the nullity is 0, there's at most one unique solution. If the nullity is greater than 0, there are infinitely many solutions (a whole family of them). Think of it like a lock: rank 0 nullity means one key fits, but positive nullity means a master key exists.

SECTION 8

Connections to Advanced Ideas

Rank and nullity are foundational ideas that connect to many advanced topics in linear algebra and beyond. The table below shows how these concepts extend into more powerful tools you will encounter in college-level courses. Each advanced topic requires additional prerequisites — the table is a preview of where these ideas lead, not an expectation that you master them now.

Concept You KnowAdvanced ExtensionWhat Changes
Rank (number of pivots)Dimension of Column Space (image)Same count, but now interpreted as the dimension of the subspace spanned by the columns of A in the output
Nullity (free variables)Dimension of the Kernel (null space)Studied as a vector subspace; a basis for it gives all solutions to Ax = 0
Rank–Nullity TheoremFundamental Theorem of Linear AlgebraFour subspaces are linked: column space, null space, row space, and left null space
Row echelon formSingular Value Decomposition (SVD)A more powerful factorization that reveals not just rank but how much each independent direction is scaled by the matrix

From basics to advanced linear algebra

In data science and machine learning, rank tells you how many truly independent features your dataset contains, which helps reduce complexity. In computer graphics, rank determines whether a transformation (like a rotation or projection) preserves all three dimensions or flattens objects. The Rank–Nullity Theorem is one of those ideas that keeps showing up everywhere once you know where to look.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

A 4 × 6 matrix has rank 3. What is its nullity? Explain in your own words what the nullity tells you about the solutions to the system Ax = 0.
Show answer
By the Rank–Nullity Theorem, nullity = n − rank = 6 − 3 = 3. This means the system Ax = 0 has 3 free variables, so its solution set is a three-dimensional space. In other words, there are infinitely many solutions, and you need three parameters to describe them all. Three of the six input directions get "crushed" to zero by the matrix.

Question 2: BASIC CALCULATION

Find the rank and nullity of the matrix A = ⎡ 1 0 2 ⎤ ⎢ 0 1 3 ⎥ ⎣ 0 0 0 ⎦. (This matrix is already in row echelon form.)
Show answer
Since the matrix is already in row echelon form, we can count directly. There are 2 nonzero rows, with pivots in columns 1 and 2. Column 3 has no pivot, so it is a free variable. Therefore, rank = 2 and nullity = 3 − 2 = 1. We can verify: 2 + 1 = 3, which equals the number of columns.

Question 3: INTERMEDIATE

Row-reduce the matrix B = ⎡ 1 3 5 7 ⎤ ⎢ 2 6 10 14 ⎥ ⎣ 0 1 2 3 ⎦ and find its rank and nullity.
Show answer
First, apply R₂ − 2R₁ to get Row 2 = [0, 0, 0, 0]. The matrix becomes ⎡ 1 3 5 7 ⎤ ⎢ 0 0 0 0 ⎥ ⎣ 0 1 2 3 ⎦. Now swap R₂ and R₃: ⎡ 1 3 5 7 ⎤ ⎢ 0 1 2 3 ⎥ ⎣ 0 0 0 0 ⎦. There are 2 nonzero rows with pivots in columns 1 and 2. Columns 3 and 4 are free. So rank = 2 and nullity = 4 − 2 = 2. The original Row 2 was exactly 2 times Row 1, so it contributed no new information.

Question 4: APPLIED

A network of three sensors monitors temperature, humidity, and wind speed. Their readings over four time periods produce the data matrix D (3 × 4). After row reduction, you find rank(D) = 2. What does this tell you about the sensors? How many independent pieces of data do the four time periods really provide?
Show answer
A rank of 2 means that only 2 of the 3 sensor readings are truly independent — one sensor's data can be predicted from the other two. Perhaps humidity is always a fixed linear combination of temperature and wind speed in this dataset. The nullity is 4 − 2 = 2, which means 2 of the 4 time periods don't add genuinely new information (they follow patterns already captured by the other periods). In real-world data science, this tells us the data could be compressed to 2 essential features without losing information.

Question 5: CRITICAL THINKING

Can a 5 × 3 matrix have rank 4? Can it have nullity 4? Explain your reasoning for each case using the Rank–Nullity Theorem.
Show answer
No to both. For any m × n matrix, the rank cannot exceed min(m, n). Since n = 3, the rank can be at most 3, so rank 4 is impossible. For nullity: by the Rank–Nullity Theorem, nullity = n − rank = 3 − rank. Since rank ≥ 0, the maximum nullity is 3. Therefore nullity 4 is also impossible. The key insight is that both rank and nullity are constrained by the number of columns. They must be non-negative integers that sum to exactly n = 3, so the only possibilities are (rank, nullity) pairs: (0,3), (1,2), (2,1), or (3,0).

SUMMARY

Lesson Summary

Summary

The rank of a matrix is the number of pivot columns (or nonzero rows) in its row echelon form, representing how many linearly independent pieces of information the matrix contains. The nullity counts the free variables — columns without pivots — telling you how many dimensions get "crushed" to zero and how much freedom the solutions to Ax = 0 have.

The Rank–Nullity Theorem ties everything together: rank + nullity = n (the number of columns). To find these values, row-reduce the matrix, count the pivots for rank, and subtract from n for nullity. This theorem connects to the Fundamental Theorem of Linear Algebra and appears throughout data science, engineering, and computer graphics whenever we need to understand how transformations preserve or destroy information.

Varsity Tutors • Linear Algebra • Rank & Nullity