Algebra

Counted across and counted down

A rectangular array has a number of independent rows and a number of independent columns. The two are counted in different spaces, from different objects, by computations that share nothing — and they are always the same number, which is why 'rank' is one word.

Worth reading first: What a map throws away.

What a map throws away works in two dimensions, where a matrix is square and the two ways of reading it — as rows and as columns — are hard to keep apart. Take a rectangular array and they come apart immediately.

Three rows of four. The rows are three vectors in a four-dimensional space, and asking how many are independent is a question about that space. The columns are four vectors in a three-dimensional space, and asking how many those are independent is a question about a different space of a different size, answered by a different computation.

2 independent rows and 2 independent columns. An array of 3 rows and 4 columns beside its transpose, with the independent rows of each shaded, showing the same count on both.
Fig. 1 An array of three rows and four columns, and its transpose. Eliminating down the rows leaves two that are not combinations of the others; doing it on the transpose leaves two as well. The two computations examine different objects living in different numbers of dimensions and return the same number.

There is no obvious reason for that, and it is one of the few facts in elementary linear algebra where the surprise survives knowing the proof.

Making the surprise clear

It is worth stating how little the two questions have in common before the answer makes it look inevitable.

Take an array with mm rows and nn columns. The row rank is the dimension of the span of the mm row vectors, which live in Rn\mathbb{R}^n. The column rank is the dimension of the span of the nn column vectors, which live in Rm\mathbb{R}^m.

For a three-by-four array, the first is a number between 00 and 33 computed about a subspace of four-dimensional space; the second is a number between 00 and 44 computed about a subspace of three-dimensional space. Neither number’s range even matches the other’s. That both are at most 33 is already a consequence of the theorem rather than an observation.

And the computations are genuinely separate. Eliminating down the rows adds multiples of rows to rows and never touches a column as an object; eliminating on the transpose does the reverse. The figures here run both, in exact fractions, and compare.

2 independent rows and 2 independent columns. An array of 4 rows and 2 columns beside its transpose, with the independent rows of each shaded, showing the same count on both.
Fig. 2 Four rows of two, where the bounds are the other way round: the row rank is at most two because there are only two columns to span, and the column rank is at most two because there are only two columns. Here the theorem’s content is thinner — but the rows still live in a plane and the columns in four-space, and the counts still agree.

The proof, in the shape of a factorisation

The argument that makes it inevitable is not an elimination at all; it is a statement about what a rank-rr array looks like.

Suppose the column rank is rr. Then rr of the columns span all of them, so every column is a combination of those rr. Write the chosen columns as an m×rm \times r array BB, and the coefficients as an r×nr \times n array CC; then A=BCA = BC.

Now read that product the other way. The rows of AA are combinations of the rows of CC — row ii of BCBC is kBik(row k of C)\sum_k B_{ik} \cdot (\text{row } k \text{ of } C) — and there are rr rows of CC. So the row rank is at most rr, which is the column rank.

Apply the same to the transpose and the inequality reverses. So the two are equal, and the whole proof is the observation that a factorisation through an rr-dimensional space constrains both readings symmetrically.

That is the content worth carrying: the rank is the smallest number of dimensions a map can be routed through. Rows and columns are two ways of looking at the routing, and the routing has one size.

What the number is about

Read as a map rather than an array, the three descriptions coincide and each is useful somewhere.

The dimension of the image. The map sends Rn\mathbb{R}^n somewhere in Rm\mathbb{R}^m, and what it reaches is a subspace of dimension rr — the span of the columns, since the columns are the images of the axis vectors.

The dimension of the row space. Equivalently, the number of genuinely different linear conditions the array imposes. A system Ax=bAx = b has rr independent equations in it however many rows are written.

The size of the smallest factorisation. As above.

The number of independent directions the image keeps. Which is the same reading the square case gives when a matrix is looked at as an instruction for redrawing the grid: the rank is how many dimensions the redrawn grid still spans.

And nrn - r is the nullity, the dimension of what the map kills. What a map throws away states rank plus nullity equals the source’s dimension in the square case; the rectangular statement is the same and the number to add to is the column count, not the row count — which is the one place the asymmetry of a rectangular array survives into the theorem.

Rank two, rank one, rank nothing. The unit square under three maps: one that keeps the plane, one that flattens it onto a line, and one that sends everything to the origin. The dimensions kept and lost add to two in each.
Fig. 3 The square case, where the two readings are hardest to separate: three maps of the plane, at rank two, one and nought, with what survives and what is lost adding to two each time. Everything above is that statement with the two dimensions allowed to differ.

Where the equality fails

The theorem has no exceptions over a field, and that is worth testing against the places it looks as though it might.

Over the whole numbers it is still true, because rank is about spans over the fractions and a whole-numbered array is a fraction-numbered one. What is different is the finer structure — a whole-numbered array has a Smith normal form with divisibility conditions that a field cannot see — and none of it touches the rank.

Over a finite field it is true, and the proof above goes through unchanged, since it used nothing but linear combination. That matters in practice rather than as a curiosity: an error-correcting code is a subspace over a two-element field, its dimension is a rank, and the parity-check matrix’s rank is what says how many errors such a code can locate.

Over a ring with zero divisors it can fail, and that is the honest limit. The proof needs to choose rr spanning columns and express the others in terms of them, which requires dividing; in a ring where division is unavailable, several competing notions of rank appear and they disagree.

And in floating point it is meaningless. A rank is a count of exactly-zero rows, and after elimination in doubles nothing is exactly zero. Numerical practice replaces the question with a different one — how many singular values exceed a threshold — which is a genuinely different quantity with a tolerance in it, and it answers a question about how close the array is to one of lower rank rather than what its rank is. That is why every computation on this page is done in exact fractions, and it is not fussiness: the same array eliminated in doubles reports rank three about as often as rank two, depending on the order of operations.

1 independent rows and 1 independent columns. An array of 2 rows and 3 columns beside its transpose, with the independent rows of each shaded, showing the same count on both.
Fig. 4 The smallest interesting case: two rows of three, the second exactly twice the first. One independent row, and one independent column — the three columns are all multiples of the same two-dimensional vector. An array of six numbers whose rank is one, in both readings.
3 independent rows and 3 independent columns. An array of 3 rows and 3 columns beside its transpose, with the independent rows of each shaded, showing the same count on both.
Fig. 5 A three-by-three array with nothing dependent in it: rank three both ways, which is the case where the theorem says least and is the case that matters most in practice — a square array of full rank is an invertible map, and the determinant is the one number that detects it.

The other half of the count is the part the square case draws directly, and it is worth seeing once before the rectangular version separates the two spaces it lives in.

A whole line arrives at the origin. A linear map whose determinant is zero, drawn before and after. One line of the plane is sent to the origin and the whole plane is sent onto another line; the dimension lost and the dimension kept add to two.
Fig. 6 What the nullity is, drawn: the line a singular map of the plane collapses to nothing. Everything above generalises this picture to arrays whose two dimensions differ, where the collapsed subspace lives in the source and the image lives in the target and the two are not in the same space at all.

The elimination, and why it is allowed

There is a step every computation above takes without comment and it is the one the theorem’s usual proof turns on.

Row operations do not change the row space, since each replaces a row by a combination of rows and is reversible. So the row rank is unchanged.

Row operations do not change the column rank either, and this is less obvious. What they preserve is the set of dependencies among the columns: if some combination of columns is zero, the same combination of the reduced array’s columns is zero, because the operation acted on each column identically. So the columns’ independence pattern is untouched, and with it their rank.

Put those together and row reduction changes neither count. Reduce until the array is in echelon form, where the row rank is the number of non-zero rows and the column rank is the number of pivot columns — and those are the same number by inspection, since each non-zero row has exactly one pivot.

That is the standard proof and it is shorter than the factorisation argument. What it is not is explanatory: it establishes the equality by transporting both quantities to a form where they coincide, and gives no account of what they are both measuring. Both proofs are worth having and they answer different questions — one says yes, and the other says because the map factors through a space of that size.

The same fact in three other places

The equality shows up under other names, and recognising them is worth more than the theorem.

The dimension of a space of solutions. A homogeneous system with nn unknowns and rank rr has a solution space of dimension nrn - r, whichever way the equations were written down. Adding a redundant equation changes the row count and not the rank, so it changes nothing — which is the statement that the count of equations is not a meaningful quantity and the rank is.

The size of a minimal generating set. The row space and the column space have the same dimension, so the smallest number of vectors needed to generate the image equals the smallest number of conditions needed to define it. Generating and constraining are dual descriptions of the same subspace, and they have the same complexity.

A decomposition into simple pieces. The factorisation A=BCA = BC writes the array as a sum of rr products of a column by a row, each of which is an array of rank one. So the rank is the fewest rank-one arrays that add to it — and rank-one arrays are exactly the ones that are a single outer product, which is the smallest non-trivial thing an array can be. That reading is what the singular value decomposition sharpens into a graded list rather than a count.

And a bilinear form’s rank. A function f(x,y)f(x, y) linear in each argument is given by an array; its rank is the least number of terms kgk(x)hk(y)\sum_k g_k(x) h_k(y) needed to write it. That number is symmetric in xx and yy by inspection of the expression, and the row-equals-column theorem is exactly that symmetry translated back.

The last reading is the one that makes the theorem look obvious, and it is worth noticing that it does so by moving to a description in which the two variables are visibly on the same footing. The surprise in the matrix version is an artefact of writing rows above columns, which is a fact about notation.

A rank is a distance, not only a count

There is a reading of the number that the counting version hides, and it is the one that makes rank useful for anything approximate.

An array of rank rr lies in the set of arrays of rank at most rr, which is a subset of all arrays — not a subspace, but a set with dimension and shape. Arrays of rank at most one form a surface; those of rank at most two a larger one; and the full-rank arrays are everything else, which is almost everything.

So asking for an array’s rank is asking which of these nested sets it sits in, and asking how far it is from the next one down is a meaningful question with a numerical answer. That answer is the smallest singular value, and it is what a numerical library computes when it is asked about rank — a distance rather than a count.

The counting version and the distance version answer different questions and the distance version is the robust one. An array of rank two that is perturbed by one part in a million has rank three and is a millionth of the way from rank two, and only the second statement is useful. The theorem of this essay is about the first, and everything in it is exact because the first is the only version that is exact.

Where it stops being true one dimension up

The pleasant symmetry ends immediately if the array gains an index, and that is the sharpest available evidence that it was not obvious.

A three-dimensional array — entries TijkT_{ijk} — has three ways of being sliced and therefore three ranks, one per direction. They can all be different. And the factorisation reading, the smallest rr with T=k=1rakbkckT = \sum_{k=1}^{r} a_k \otimes b_k \otimes c_k, gives a fourth number, which is not any of the three and is in general not computable: deciding a three-dimensional array’s rank is NP-hard, proved in 1990. It is not an idle question: the rank of one particular three-dimensional array is the number of multiplications matrix multiplication needs, which is why the exponent in that problem is still unknown.

Worse, the rank can depend on the field. A specific three-by-three-by-two array has rank three over the reals and rank two over the complex numbers, so a question with a whole-numbered answer changes its answer depending on which numbers are allowed — something no matrix does.

So everything comfortable about rank is a two-index phenomenon, and the essay’s theorem is the thing that makes it comfortable. That is the right way to hold it: not as an obvious symmetry, but as a coincidence of small dimension that the whole subject is built on.

The four subspaces, and the two right angles

Once the two counts are one number, four subspaces come with it and their relations are worth setting out, because the picture they make is the one that explains what a rectangular map does.

An m×nm \times n array gives a map from Rn\mathbb{R}^n to Rm\mathbb{R}^m, and four subspaces:

  • in the source: the row space, of dimension rr, and the kernel, of dimension nrn - r;
  • in the target: the column space, of dimension rr, and the kernel of the transpose, of dimension mrm - r.

In each space the two dimensions add to that space’s dimension, which is rank–nullity applied twice — once to the map and once to its transpose. And in each space the two subspaces are at right angles: a vector in the kernel has zero dot product with every row by definition, so the kernel is exactly the orthogonal complement of the row space.

So the map’s whole behaviour is: the source splits into two perpendicular pieces, one of which is crushed to nothing and the other of which is carried one-to-one onto the column space; and the target splits into two perpendicular pieces, one of which is reached and the other of which is not.

That is the structure everything practical rests on. A system Ax=bAx = b has a solution exactly when bb is in the column space; when it is not, the nearest thing to a solution is obtained by projecting bb onto the column space, which is least squares and is the reason the perpendicularity matters rather than being decoration. And when a solution exists it is unique modulo the kernel, so the solution set is a translate of a subspace of dimension nrn - r.

Every one of those statements needs the two counts to be the same number, since each involves an rr measured in the source and an rr measured in the target.

Two subspaces nobody can see

Both grids show a finished elimination and neither shows one happening. The shaded rows are the independent ones after reduction; the process that found them — which row was subtracted from which — is not on the page, and the claim being made is about the final count rather than about the route to it.

The exactness is invisible. Every number in both grids is a small integer, which makes the arrays look easy; the point of computing in fractions is that the intermediate values are not integers and a rank computed in doubles would be untrustworthy. Nothing in the drawing shows an intermediate value at all.

And four dimensions is not drawn. The rows of the hero’s array are four vectors in four-dimensional space and the claim is about their span. What is drawn is the numbers; the span is a subspace nobody can see, and that the theorem is about two subspaces in two different unvisualisable spaces is what makes it worth proving.

Still open: the same count on a matrix nobody built

The rank-nullity count is a statement about arrays and it does not care where the array came from. Apply it to a matrix built from a graph — a row for every edge, a column for every vertex — and the same arithmetic says that a graph’s independent cycles and its independent cuts add to its number of edges.

Nothing in that statement mentions a matrix, and neither of the two quantities in it is obviously a dimension. That is the cycles and the cuts.

Two counts and one quantity

The habit is to notice when two apparently independent measurements are forced to agree, and to ask what they are both measurements of.

Row rank and column rank are two counts of two different collections in two different spaces, and their agreement is a theorem with a one-paragraph proof. What the proof supplies is a third object neither count mentioned: the smallest space the map factors through. Both counts were measuring that, and once it is named the agreement stops being a coincidence.

That move is available more often than it is used. When two quantities agree unexpectedly, the productive question is not why are these equal but what third thing are they both the size of — and the answer is usually the object the subject should have been about.

What links here

Computed from the collection, not written here: the essays that point at this one.

Reads more easily once this is understood

Essays that name this one as worth reading first.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A dashed tag is an object no other essay names yet.

BasisCounting two waysDimensionKernelLinearityMatrixRank