The idea: where A sends space, and what it loses

A 3×3 matrix A takes an input x in ℝ³ to an output Ax in ℝ³. The columns of A are where the unit vectors land: A·î = col 1, A·ĵ = col 2, A·k̂ = col 3. So for any x,

Ax = x1·col 1 + x2·col 2 + x3·col 3.

Two sets of vectors describe what A does. The column space C(A), in the output, is everything A can reach. The null space N(A), in the input, is everything A crushes to 0. The canvas shows the input space on the left and the output space on the right.

Left, the input space with a cube and a purple line through the origin labelled N(A) = t·(−1, −1, 1). Right, the output space where the cube has been flattened onto a teal plane labelled C(A): z = x + y. An arrow labelled A goes from left to right, and the purple line is sent to the single point 0
A rank-2 matrix flattens space onto the plane C(A) and sends the whole line N(A) to 0.

Column space: every Ax lands there

Ax is always a mix of the columns, so every output lies in the span of the columns. That span is C(A). For three columns in ℝ³ it is all of ℝ³, a plane through 0, a line through 0, or just {0}.

  • Columns (1, 0, 1), (1, 1, 0), (0, 1, 1) are independent: C(A) = ℝ³ and the cube lands on a solid box. (Demo 1: rank 3, nothing collapses)
  • Columns (1, 0, 1), (0, 1, 1), (1, 1, 2): col 3 = col 1 + col 2 adds nothing new, so C(A) is the plane spanned by the first two, z = x + y. The cube is squashed flat onto it. (Demo 2: rank 2, space flattens onto a plane)
  • Columns (1, 1, 1), (−1, −1, −1), (1, 1, 1) all point along one line, so C(A) is that line. (Demo 6: rank 1, everything on a line)

Null space: what goes to 0

N(A) is the set of all x with Ax = 0. It always holds 0, and with two of its vectors it holds every mix of them, so it is a subspace of the input: {0}, a line, a plane or all of ℝ³. For the rank-2 matrix, col 1 + col 2 − col 3 = 0, so x = (1, 1, −1) and every multiple of it goes to 0: N(A) is the line t·(−1, −1, 1). On the canvas four purple inputs on that line are sent through A and all land on the origin. (Demo 3: the null space goes to 0)

A null vector is a dependence among the columns: x1·col 1 + x2·col 2 + x3·col 3 = 0. Independent columns leave only x = 0.

Rank and nullity: pivots and free columns

Row reduction finds both. Reduce A to its reduced row echelon form (RREF). Each pivot (a leading 1, orange in the matrix panel) marks a column that is not a mix of the ones before it; each free column gives one direction of N(A) (set that free variable to 1, the others to 0, and solve for the pivots).

  • rank = number of pivots = dim C(A)
  • nullity = number of free columns = dim N(A)
  • rank + nullity = 3, the number of columns: every column is either a pivot or free.
A on the pageRREFrankC(A)N(A)det
rank 3: invertibleI3ℝ³{0}2
col 3 = col 1 + col 2[1 0 1; 0 1 1; 0 0 0]2plane z = x + yline t·(−1, −1, 1)0
columns ∥ (1, 1, 1)[1 −1 1; 0 0 0; 0 0 0]1line t·(1, 1, 1)plane x1 − x2 + x3 = 00
zero matrix00{0}ℝ³0

The rank is the number of dimensions A keeps; the nullity is the number it loses. A loses exactly as many as it fails to keep.

Solving Ax = b

Ax = b asks for a mix of the columns that gives b, so it has a solution exactly when b is in C(A). Row reduce the augmented matrix [A | b]:

  • If a row becomes 0 0 0 | c with c ≠ 0, it says 0 = c: no solution. For the rank-2 A and b = (1, 1, 1), z = 1 but x + y = 2, so b is off the plane. The closest output is the projection p = (2/3, 2/3, 4/3), and the gap |b − p| = 1/√3 ≈ 0.58. (Demo 5: b off the plane: no solution)
  • Otherwise set the free variables to 0 to get one particular solution xp. Any null vector n can be added, since A(xp + n) = b + 0 = b, and every solution has this form. So all solutions = xp + N(A): a copy of the null space moved off the origin. For b = (1, 1, 2): xp = (1, 1, 0) and the solutions are the line (1, 1, 0) + t·(−1, −1, 1). (Demo 4: Ax = b, b on the plane: a line of solutions)
Two output spaces side by side with the teal plane C(A). Left, b = (1, 1, 2) lies on the plane, marked with a check: a solution exists, and the solutions form the line (1, 1, 0) + t·(−1, −1, 1). Right, b = (1, 1, 1) floats above the plane, marked with a cross, with a dotted gap down to the closest point p = (2/3, 2/3, 4/3)
b on C(A): a whole line of solutions (xₚ + N(A)). b off C(A): no solution, only a closest point p.
rankb in C(A)b not in C(A)
3exactly one solution x = A−1b (every b)cannot happen
2a line of solutionsnone
1a plane of solutionsnone
0only b = 0, then every xnone

Invertible, rank 3, N(A) = {0}, det ≠ 0

For a square matrix these all say the same thing:

  • A is invertible (some A−1 undoes it);
  • rank 3: three pivots, C(A) = ℝ³, every Ax = b has a solution;
  • N(A) = {0}: nothing but 0 is lost, so solutions are unique;
  • det A ≠ 0: the cube keeps a nonzero volume.

When any one fails they all fail: the cube is flattened (det = 0), something nonzero goes to 0, and some b cannot be reached. Rank–nullity ties the two halves together: C(A) = ℝ³ exactly when N(A) = {0}.

Four panels for rank 3, 2, 1 and 0. The image of the cube is a solid box, a flat parallelogram, a segment and a point. Under each: C(A) is all of R3, a plane, a line, the origin; N(A) is the origin, a line, a plane, all of R3; rank plus nullity is 3 + 0, 2 + 1, 1 + 2, 0 + 3
As the rank drops, the column space shrinks and the null space grows by the same amount.

See also Linear Transformations, Gaussian Elimination for the row reduction, Determinant, Inverse Matrix, 3D Projection Matrix (a rank-2 map onto a plane), Least Squares for the closest Ax when there is no solution, Eigenvectors (N(A) is the eigenspace of λ = 0), Plane Equation, Gram–Schmidt and SVD and PCA.

What the page leaves out

The other two of the four fundamental subspaces: the row space C(Aᵀ) and the left null space N(Aᵀ). In the input, the row space is perpendicular to N(A) (every row dotted with a null vector is 0); in the output, N(Aᵀ) is perpendicular to C(A). Non-square matrices (m × n, where rank + nullity = n and C(A) lives in ℝm), bases and dimension in general, numerical rank with rounding errors (the SVD), and matrices whose entries make the row reduction need row swaps.