Ma · Mathematics

Difference Between the Dimension and Rank of a Matrix

Published By the 9to5Science editorial team

At a glance

  1. 1. Identify matrix size

    An m×n matrix has m rows and n columns; this is its shape, not usually called its dimension.

  2. 2. Interpret rank

    Rank is the dimension of the matrix’s row space or column space.

  3. 3. Reduce the matrix

    Use Gaussian elimination to count the pivot positions; that count is the rank.

  4. 4. Apply rank–nullity

    For an m×n matrix, rank plus nullity equals n, the number of columns.

A matrix’s size and its rank describe different things. If a matrix has mm rows and nn columns, it is an m×nm \times n matrix. Its rank measures how many independent rows or columns it contains.

The word “dimension” can be confusing here because it is used in two related ways. The matrix itself has a shape, while spaces associated with the matrix—such as its column space, row space, null space, or domain—have mathematical dimensions.

Matrix size: rows and columns

For example,

A=[123456]A=\begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6 \end{bmatrix}

has 2 rows and 3 columns, so its size is 2×32 \times 3.

Some texts informally call this the “dimension” of the matrix. More precisely, a matrix is an array with mm rows and nn columns, or an element of the matrix space Fm×n\mathbb{F}^{m\times n}, where F\mathbb{F} is usually R\mathbb{R} or C\mathbb{C}.

The numbers mm and nn do not tell you the rank. They only tell you the largest rank that could be possible:

rank⁡(A)≤min⁡(m,n).\operatorname{rank}(A)\leq \min(m,n).

For the matrix above, the rank can be at most 2, because there are only two rows.

Rank is a dimension

Let AA be an m×nm \times n matrix. It defines a linear transformation

A:Fn→Fm.A:\mathbb{F}^n\to\mathbb{F}^m.

The column space of AA, denoted Col⁡(A)\operatorname{Col}(A), is the subspace of Fm\mathbb{F}^m spanned by the columns of AA. The rank is defined by

rank⁡(A)=dim⁡(Col⁡(A)).\operatorname{rank}(A)=\dim\bigl(\operatorname{Col}(A)\bigr).

A fundamental theorem says that the row space and column space always have the same dimension. Therefore,

rank⁡(A)=dim⁡(Col⁡(A))=dim⁡(Row⁡(A)).\operatorname{rank}(A) =\dim\bigl(\operatorname{Col}(A)\bigr) =\dim\bigl(\operatorname{Row}(A)\bigr).

So rank is itself a dimension—but it is the dimension of a particular vector space associated with the matrix, not the number of rows and columns.

How to calculate rank

You can find the rank by reducing the matrix to row-echelon form. The number of nonzero rows, or equivalently the number of pivot positions, is the rank.

Consider

A=[123246112].A=\begin{bmatrix} 1 & 2 & 3\\ 2 & 4 & 6\\ 1 & 1 & 2 \end{bmatrix}.

Use row operations:

[123246112]→R2←R2−2R1,  R3←R3−R1[1230000−1−1]→R2↔R3[1230−1−1000].\begin{aligned} \begin{bmatrix} 1 & 2 & 3\\ 2 & 4 & 6\\ 1 & 1 & 2 \end{bmatrix} &\xrightarrow{R_2\leftarrow R_2-2R_1,\;R_3\leftarrow R_3-R_1} \begin{bmatrix} 1 & 2 & 3\\ 0 & 0 & 0\\ 0 & -1 & -1 \end{bmatrix}\\[6pt] &\xrightarrow{R_2\leftrightarrow R_3} \begin{bmatrix} 1 & 2 & 3\\ 0 & -1 & -1\\ 0 & 0 & 0 \end{bmatrix}. \end{aligned}

There are two nonzero rows and two pivots. Hence

rank⁡(A)=2.\operatorname{rank}(A)=2.

This is a 3×33 \times 3 matrix, but its rank is 2. Its three columns do not provide three independent directions: one of them can be expressed as a linear combination of the others.

Rank and the four fundamental spaces

For an m×nm \times n matrix, four spaces are commonly associated with it:

SpaceWhere it liesIts dimension
Column space Col⁡(A)\operatorname{Col}(A)Fm\mathbb{F}^mrr
Row space Row⁡(A)\operatorname{Row}(A)Fn\mathbb{F}^nrr
Null space Null⁡(A)\operatorname{Null}(A)Fn\mathbb{F}^nn−rn-r
Left null space Null⁡(AT)\operatorname{Null}(A^T)Fm\mathbb{F}^mm−rm-r

Here r=rank⁡(A)r=\operatorname{rank}(A). The dimensions of the column and row spaces are equal to the rank, while the null-space dimensions are determined by the rank–nullity theorem. The table uses the algebraic convention for the left null space. Over C\mathbb{C}, some authors instead define it using the conjugate transpose A∗A^*, in which case it is Null⁡(A∗)\operatorname{Null}(A^*); its dimension is still m−rm-r. Over R\mathbb{R}, A∗=ATA^*=A^T.

For the 3×33 \times 3 example, m=n=3m=n=3 and r=2r=2. Therefore the nullity—the dimension of the solution space of Ax=0A\mathbf{x}=\mathbf{0}—is

nullity⁡(A)=n−r=3−2=1.\operatorname{nullity}(A)=n-r=3-2=1.

The rank–nullity theorem in general is

rank⁡(A)+nullity⁡(A)=n,\operatorname{rank}(A)+\operatorname{nullity}(A)=n,

where nn is the number of columns, or equivalently the dimension of the domain of the associated linear transformation.

Important examples

A 4×34 \times 3 matrix can have rank at most 3. If its rank is 3, all three columns are independent, even though there are four rows. If its rank is 1, all columns are scalar multiples of one nonzero column.

A zero matrix of any size has rank 0. For example, a 5×25 \times 2 zero matrix has size 5×25 \times 2 but rank 0.

An n×nn \times n matrix has rank nn exactly when it is invertible. Such a matrix is called full rank. A square matrix with rank less than nn is singular and has no inverse.

Common mistakes

Treating “dimension” as a standard matrix invariant

There is no single universally standard number called “the dimension of a matrix.” In elementary settings, “dimension” often means the matrix size, such as m×nm \times n. In linear algebra, dimension usually refers to a vector space, such as the column space or null space.

Assuming rank equals the number of rows

Rank equals the number of independent rows, not necessarily the total number of rows. Dependent rows do not increase rank.

Counting nonzero entries

Rank is not the number of nonzero entries. A matrix can contain many nonzero entries but have rank 1. For example,

[1224]\begin{bmatrix} 1&2\\ 2&4 \end{bmatrix}

has four nonzero entries but rank 1, because its second row is twice its first row.

Using the original columns after row reduction

Row reduction preserves rank, but the columns of the reduced matrix are not generally the original column-space basis. To select a basis for the original column space, identify pivot columns in the reduced matrix and take the corresponding columns from the original matrix.

The concise distinction is therefore: matrix size tells you how many rows and columns the array has; rank tells you how many independent directions its rows or columns contain.

References

  1. Linear Algebra Done Right, Sheldon Axler
  2. Introduction to Linear Algebra, Gilbert Strang

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.