Tutorials › Linear Algebra › Matrix Rank From Nonzero Singular Values

Singular Value Decomposition · Tutorial 796 of 1000

Matrix Rank From Nonzero Singular Values

Learn why counting the nonzero diagonal singular values gives the rank, and practise reading that count from rectangular SVDs.

Advanced 11 min read

What You'll Learn

  • State the full SVD shape for a rectangular matrix.
  • Distinguish the singular values from structural zeros in a rectangular diagonal factor.
  • Prove that unitary factors preserve rank.
  • Prove that a rectangular diagonal factor has rank equal to its nonzero diagonal entries.
  • Determine rank from SVDs of tall, wide, and rank-deficient matrices.
  • Avoid confusing nonzero columns with linearly independent columns.

Rank as a Count of Active Directions

The singular value decomposition separates a matrix into changes of coordinates and a diagonal scaling. The unitary factors change the input and output coordinates, while the diagonal factor records which directions are scaled by a nonzero amount. This makes the diagonal factor a natural place to read off rank. The key is to justify why changing coordinates does not alter rank, and then to account carefully for the rectangular shape of the diagonal factor.

Let \(\mathbb{F}\) be \(\mathbb{R}\) or \(\mathbb{C}\), and let \(\mathbf{A}\in\mathbb{F}^{m\times n}\). The rank of \(\mathbf{A}\), written \(\operatorname{rank}\mathbf{A}\), is the dimension of its column space \(\operatorname{Col}\mathbf{A}\), the subspace spanned by its columns. A square matrix \(\mathbf{Q}\in\mathbb{F}^{k\times k}\) is unitary if \(\mathbf{Q}^{*}\mathbf{Q}=\mathbf{I}_k\). In the real case, this condition is \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{I}_k\), and \(\mathbf{Q}\) is called orthogonal. The square-shape condition matters: a rectangular matrix with orthonormal columns need not be unitary.

Definition: A full singular value decomposition (SVD) of \(\mathbf{A}\in\mathbb{F}^{m\times n}\) is a factorization \(\mathbf{A}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{*}\), where \(\mathbf{U}\in\mathbb{F}^{m\times m}\) and \(\mathbf{V}\in\mathbb{F}^{n\times n}\) are unitary, and \(\boldsymbol{\Sigma}\in\mathbb{R}^{m\times n}\) has nonnegative entries \(\sigma_1\ge\cdots\ge\sigma_k\ge0\), \(k=\min(m,n)\), on its main diagonal and zeros elsewhere. The numbers \(\sigma_1,\dots,\sigma_k\) are the singular values of \(\mathbf{A}\).

For a rectangular \(\boldsymbol{\Sigma}\), the main diagonal has \(k=\min(m,n)\) positions. If \(m<n\), columns after column \(m\) are structurally zero; if \(m>n\), rows after row \(n\) are structurally zero. These extra positions are not additional singular values under the convention above. Whether or not a convention appends extra zeros to a singular-value list, the number of nonzero singular values is unchanged.

Why the SVD Diagonal Gives the Rank

Theorem: For \(\mathbf{A}\in\mathbb{F}^{m\times n}\), the number of nonzero singular values of \(\mathbf{A}\) equals \(\operatorname{rank}\mathbf{A}\).

Proof. Write a full SVD \(\mathbf{A}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{*}\), with \(\mathbf{U}\) and \(\mathbf{V}\) square and unitary. Since \(\mathbf{V}^{*}\mathbf{V}=\mathbf{I}_n\), the map \(\mathbf{V}^{*}\) is onto: for any \(\mathbf{x}\in\mathbb{F}^n\), \(\mathbf{x}=\mathbf{V}^{*}(\mathbf{V}\mathbf{x})\). Therefore \(\operatorname{Col}(\boldsymbol{\Sigma}\mathbf{V}^{*})=\operatorname{Col}\boldsymbol{\Sigma}\): every output of \(\boldsymbol{\Sigma}\mathbf{V}^{*}\) is an output of \(\boldsymbol{\Sigma}\), and, by surjectivity, every output of \(\boldsymbol{\Sigma}\) is attained. Multiplication on the left by \(\mathbf{U}\) maps \(\operatorname{Col}\boldsymbol{\Sigma}\) bijectively onto \(\operatorname{Col}\mathbf{A}\), since \(\mathbf{U}\) is invertible with inverse \(\mathbf{U}^{*}\). A bijective linear map sends a basis to a basis, so the two column spaces have the same dimension. Hence \(\operatorname{rank}\mathbf{A}=\dim\operatorname{Col}\boldsymbol{\Sigma}\). Let \(J=\{i: \sigma_i\ne0\}\). For any \(\mathbf{x}\in\mathbb{F}^n\), the \(i\)-th coordinate of \(\boldsymbol{\Sigma}\mathbf{x}\), for \(1\le i\le k\), is \(\sigma_i x_i\), and any remaining output coordinates are zero. Thus every output belongs to the span of the standard coordinate vectors \(\mathbf{e}_i\) for \(i\in J\). Conversely, for each \(i\in J\), \(\boldsymbol{\Sigma}(\mathbf{e}_i/\sigma_i)=\mathbf{e}_i\), using the input coordinate vector in \(\mathbb{F}^n\) and the output coordinate vector in \(\mathbb{F}^m\). Therefore the column space of \(\boldsymbol{\Sigma}\) is exactly the span of those \(\mathbf{e}_i\). They are distinct standard coordinate vectors and hence linearly independent, so \(\dim\operatorname{Col}\boldsymbol{\Sigma}=|J|\), the number of nonzero singular values. This proves the claim. \(\square\)

The proof separates the argument into two parts. The unitary factors preserve the dimension of the column space because they make invertible coordinate changes. The rectangular diagonal factor contributes one independent output direction for each nonzero diagonal entry, and no direction for a zero entry.

Reading Rank from Rectangular SVDs

Worked Example: A Tall Matrix with Two Nonzero Singular Values

Consider the \(3\times2\) matrix \(\mathbf{A}=\begin{bmatrix}0&3\\4&0\\0&0\end{bmatrix}\). Its SVD factors are

$$ \mathbf{U}= \begin{bmatrix} 0&1&0\\ 1&0&0\\ 0&0&1 \end{bmatrix}, \qquad \boldsymbol{\Sigma}= \begin{bmatrix} 4&0\\ 0&3\\ 0&0 \end{bmatrix}, \qquad \mathbf{V}= \begin{bmatrix} 1&0\\ 0&1 \end{bmatrix}. $$

The columns of \(\mathbf{U}\) are the standard coordinate vectors in a different order, so they are orthonormal and \(\mathbf{U}\) is a square orthogonal matrix. The identity matrix \(\mathbf{V}\) is also square and orthogonal. Multiplication gives

$$ \mathbf{U}\boldsymbol{\Sigma} = \begin{bmatrix} 0&3\\ 4&0\\ 0&0 \end{bmatrix}, \qquad \mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top} = \begin{bmatrix} 0&3\\ 4&0\\ 0&0 \end{bmatrix} =\mathbf{A}. $$

The diagonal entries of \(\boldsymbol{\Sigma}\) are \(4\) and \(3\), both nonzero. Therefore \(\operatorname{rank}\mathbf{A}=2\). The extra third row of \(\boldsymbol{\Sigma}\) is zero because \(\mathbf{A}\) is tall; it does not add another singular value.

Worked Example: A Wide Matrix with Full Row Rank

For the \(2\times3\) matrix \(\mathbf{A}=\begin{bmatrix}1&1&0\\1&-1&0\end{bmatrix}\), take

$$ \mathbf{U}= \begin{bmatrix} 1&0\\ 0&1 \end{bmatrix}, \qquad \boldsymbol{\Sigma}= \begin{bmatrix} \sqrt{2}&0&0\\ 0&\sqrt{2}&0 \end{bmatrix}, \qquad \mathbf{V}= \begin{bmatrix} \frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}}&0\\ \frac{1}{\sqrt{2}}&-\frac{1}{\sqrt{2}}&0\\ 0&0&1 \end{bmatrix}. $$

The columns of \(\mathbf{V}\) each have length \(1\). The inner product of its first two columns is \(\tfrac12-\tfrac12=0\), and each of those columns has inner product \(0\) with the third. Thus \(\mathbf{V}\) is square and orthogonal. To check the factorization, its transpose is

$$ \mathbf{V}^{\top}= \begin{bmatrix} \frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}}&0\\ \frac{1}{\sqrt{2}}&-\frac{1}{\sqrt{2}}&0\\ 0&0&1 \end{bmatrix}, \qquad \boldsymbol{\Sigma}\mathbf{V}^{\top} = \begin{bmatrix} 1&1&0\\ 1&-1&0 \end{bmatrix}. $$

Since \(\mathbf{U}=\mathbf{I}_2\), this product is \(\mathbf{A}\). The two singular values are \(\sqrt{2}\) and \(\sqrt{2}\), so the rank is \(2\). The third column of \(\boldsymbol{\Sigma}\) is zero because the factor has three columns but only two rows; that structural zero is not a third singular value.

Worked Example: A Rank-Deficient Tall Matrix

Consider \(\mathbf{A}=\begin{bmatrix}1&2\\2&4\\0&0\end{bmatrix}\). Use the factors

$$ \mathbf{U}= \begin{bmatrix} \frac{1}{\sqrt{5}}&\frac{2}{\sqrt{5}}&0\\ \frac{2}{\sqrt{5}}&-\frac{1}{\sqrt{5}}&0\\ 0&0&1 \end{bmatrix}, \qquad \boldsymbol{\Sigma}= \begin{bmatrix} 5&0\\ 0&0\\ 0&0 \end{bmatrix}, \qquad \mathbf{V}= \begin{bmatrix} \frac{1}{\sqrt{5}}&\frac{2}{\sqrt{5}}\\ \frac{2}{\sqrt{5}}&-\frac{1}{\sqrt{5}} \end{bmatrix}. $$

The columns of \(\mathbf{U}\) have length \(1\); the first two have inner product \(\tfrac{2}{5}-\tfrac{2}{5}=0\), and the third is perpendicular to both. The columns of \(\mathbf{V}\) have length \(1\) and inner product \(\tfrac{2}{5}-\tfrac{2}{5}=0\). Hence both square factors are orthogonal. Multiplying the first two factors gives

$$ \mathbf{U}\boldsymbol{\Sigma} = \begin{bmatrix} \sqrt{5}&0\\ 2\sqrt{5}&0\\ 0&0 \end{bmatrix}. $$

Multiplication by \(\mathbf{V}^{\top}\) then gives

$$ \mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top} = \begin{bmatrix} \sqrt{5}&0\\ 2\sqrt{5}&0\\ 0&0 \end{bmatrix} \begin{bmatrix} \frac{1}{\sqrt{5}}&\frac{2}{\sqrt{5}}\\ \frac{2}{\sqrt{5}}&-\frac{1}{\sqrt{5}} \end{bmatrix} = \begin{bmatrix} 1&2\\ 2&4\\ 0&0 \end{bmatrix} =\mathbf{A}. $$

The singular values are \(5\) and \(0\), so \(\operatorname{rank}\mathbf{A}=1\). In particular, the zero singular value corresponds to one diagonal position that contributes no output direction.

Common Mistake: Counting Nonzero Columns

A nonzero column does not necessarily contribute a new independent direction. In the last example, both columns of \(\mathbf{A}\) are nonzero. The incorrect calculation “there are two nonzero columns, so the rank is \(2\)” counts columns without checking whether they are independent. In fact, the second column is twice the first:

$$ \begin{bmatrix}2\\4\\0\end{bmatrix} = 2\begin{bmatrix}1\\2\\0\end{bmatrix}. $$

Thus the column space is spanned by just one nonzero vector, in agreement with the single nonzero singular value \(5\). Count the nonzero diagonal singular values, not the nonzero entries or nonzero columns of the original matrix. Also keep the factor’s shape in view: a zero column forced by a wide rectangular shape is not an extra singular value under the convention that lists \(\min(m,n)\) values.

This rank test is useful because it reads the number of independent output directions directly from an SVD, even when a matrix is rectangular. The diagonal factor also indicates which singular-vector directions are active: a positive diagonal entry maps its corresponding direction to a nonzero output, whereas a zero entry contributes nothing. The rank conclusion itself depends only on how many such diagonal entries are nonzero, not on the particular singular vectors chosen.

Check Your Understanding

Use the dimensions and diagonal entries of each factor carefully; for each item, explain which positions count as singular values.

  1. A \(4\times2\) matrix has singular values \(7\) and \(0\). What is its rank?
  2. A \(2\times4\) matrix has diagonal factor \(\begin{bmatrix}3&0&0&0\\0&0&0&0\end{bmatrix}\). How many singular values are listed under the \(\min(m,n)\) convention, and what is the rank?
  3. For a \(3\times3\) matrix, the singular values are \(6,2,0\). What is its rank?
  4. Explain why multiplying a matrix on the left by a square unitary matrix does not change its rank.
  5. Give a reason that the number of nonzero columns of a matrix need not equal its rank.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon