Post · 8 min read· pp. 704–708

Matrix Rank Relations

Matrix rank is an important concept in linear algebra. While rank deficiency can be a sign of an incompletely or improperly specified problem (a singular system of linear equations, for example), in some problems low rank of a matrix is a desired property or outcome. Here we present some fundamental rank relations in a concise form useful for reference. These are all immediate consequences of the singular value decomposition (SVD), but we give elementary (albeit not entirely self-contained) proofs of them.

The rank of a matrix A∈Rm×nA\in\mathbb{R}^{m\times n} is the maximum number of linearly independent columns, which is the dimension of the range space of AA, range(A)={ Ax:x∈Rn }\mathrm{range}(A) = \{\, Ax: x \in\mathbb{R}^n \,\}. An important but non-obvious fact is that this is the same as the maximum number of linearly independent rows (see (5) below).

A rank-11 matrix has the form xy∗xy^*, where xx and yy are nonzero vectors. Every column is a multiple of xx and every row is a multiple of y∗y^*. A sum of kk rank-11 matrices has the form

A=∑i=1kxiyi∗=[x1x2…xk][y1∗y2∗⋮yk∗]≡XY∗.(0)\notag A = \displaystyle\sum_{i=1}^{k} x_iy_i^* = \begin{bmatrix} x_1 & x_2 & \dots & x_k \end{bmatrix} \begin{bmatrix} y_1^* \\ y_2^* \\ \vdots\\ y_k^* \end{bmatrix} \equiv XY^*. \qquad (0)

Each column of AA is a linear combination of the vectors x1x_1, x2x_2, …, xkx_k, so AA has at most kk linearly independent columns, that is, AA has rank at most kk. In fact, rank(A)=k\mathrm{rank}(A) = k if XX and YY have rank kk, as follows from (4) below. Any rank-kk matrix can be written in the form (0)(0) with XX and YY of rank kk; indeed this is the full-rank factorization below.

Here are some fundamental rank equalities and inequalities.

Rank-Nullity Theorem

The rank-nullity theorem says that

rank(A)+dim(null(A))=n,A∈Rm×n,\notag \boxed{ \mathrm{rank}(A) + \mathrm{dim}( \mathrm{null}(A) ) = n, \quad A\in\mathbb{R}^{m\times n},}

where null(A)={ x∈Rn:Ax=0 }\mathrm{null}(A) = \{\, x \in\mathbb{R}^n: Ax = 0 \,\} is the null space of AA.

Rank Bound

The rank cannot exceed the number of columns, or, by (5) below, the number of rows:

rank(A)≤min⁡(m,n),A∈Cm×n.\notag \boxed{ \mathrm{rank}(A) \le \min(m,n), \quad A\in\mathbb{C}^{m\times n}. }

Rank of a Sum

For any AA and BB of the same dimension,

∣rank(A)−rank(B)∣≤rank(A+B)≤rank(A)+rank(B).(1)\notag \boxed{|\mathrm{rank}(A) - \mathrm{rank}(B)| \le \mathrm{rank}(A+B) \le \mathrm{rank}(A) + \mathrm{rank}(B).} \qquad (1)

The upper bound follows from the fact that the dimension of the sum of two subspaces cannot exceed the sum of the dimensions of the subspaces. Interestingly, the upper bound is also a corollary of the bound (3) for the rank of a matrix product, because

rank(A+B)=rank([AB][II])≤min⁡(rank([AB]),rank([II]))≤rank([AB])≤rank(A)+rank(B).\notag \begin{aligned} \mathrm{rank}(A+B) &= \mathrm{rank}\biggl( \begin{bmatrix} A & B \end{bmatrix} \begin{bmatrix} I \\ I \end{bmatrix} \biggr)\\ &\le \min\biggl(\mathrm{rank}\bigl(\begin{bmatrix} A & B \end{bmatrix}\bigr), \mathrm{rank}\biggl(\begin{bmatrix} I \\ I \end{bmatrix} \biggr)\biggr)\\ &\le \mathrm{rank}\bigl(\begin{bmatrix} A & B \end{bmatrix}\bigr)\\ &\le \mathrm{rank}(A) + \mathrm{rank}(B). \end{aligned}

For the lower bound, writing A=−B+A+BA = -B + A+B and applying the upper bound gives rank(A)≤rank(−B)+rank(A+B)=rank(B)+rank(A+B)\mathrm{rank}(A) \le \mathrm{rank}(-B) + \mathrm{rank}(A+B) = \mathrm{rank}(B) + \mathrm{rank}(A+B), and likewise with the roles of AA and BB interchanged.

Rank of AA and A∗AA^*A

For any AA,

rank(A∗A)=rank(A).(2)\notag \boxed{\mathrm{rank}(A^*A) = \mathrm{rank}(A).} \qquad (2)

Indeed Ax=0Ax = 0 implies A∗Ax=0A^*Ax = 0, and A∗Ax=0A^*Ax = 0 implies 0=x∗A∗Ax=(Ax)∗(Ax)0 = x^*A^*Ax = (Ax)^*(Ax), which implies Ax=0Ax = 0. Hence the null spaces of AA and A∗AA^*A are the same. The equality (2) follows from the rank-nullity theorem.

Rank of a General Product

For any AA and BB for which the product ABAB is defined,

rank(AB)≤min⁡(rank(A),rank(B)).(3)\notag \boxed{\mathrm{rank}(AB) \le \min\bigl( \mathrm{rank}(A), \mathrm{rank}(B) \bigr).} \qquad (3)

If B=[b1,…,bn]B = [b_1,\dots,b_n] then AB=[Ab1,…,Abn]AB = [Ab_1,\dots,Ab_n], so the columns of ABAB are linear combinations of those of AA and so ABAB cannot have more linearly independent columns than AA, that is, rank(AB)≤rank(A)\mathrm{rank}(AB) \le \mathrm{rank}(A). Using (5) below, we then have

rank(AB)=rank(B∗A∗)≤rank(B∗)=rank(B).\notag \mathrm{rank}(AB) = \mathrm{rank}(B^*A^*) \le \mathrm{rank}(B^*) = \mathrm{rank}(B).

The latter inequality can be proved without using (5) (our proof of which uses (3)), as follows. Suppose rank(B)<rank(AB)=r\mathrm{rank}(B) < \mathrm{rank}(AB) = r. Let the columns of YY span range(AB)\mathrm{range}(AB), so that YY has rr columns and Y=ABZY = ABZ for some matrix ZZ with rr columns. Now rank(BZ)≤rank(B)<r\mathrm{rank}(BZ) \le \mathrm{rank}(B) < r by the first part, so BZg=0BZg = 0 for some nonzero gg. But then Yg=ABZg=0Yg = ABZg = 0, which contradicts the linear independence of the columns of YY, so we must have rank(B)≥rank(AB)\mathrm{rank}(B) \ge \mathrm{rank}(AB).

Rank of a Product of Full-Rank Matrices

We have

rank(AB)=r,A∈Cm×r,  B∈Cr×n,  rank(A)=rank(B)=r.(4)\notag \boxed{ \mathrm{rank}(AB) = r, \quad A\in\mathbb{C}^{m\times r}, \; B\in\mathbb{C}^{r\times n}, \; \mathrm{rank}(A) = \mathrm{rank}(B) = r .} \qquad (4)

We note that A∗AA^*A and BB∗BB^* are both nonsingular r×rr\times r matrices by (2), so their product has rank rr. Using (3),

r=rank(A∗ABB∗)≤rank(AB)≤r,\notag r = \mathrm{rank}(A^*A BB^*) \le \mathrm{rank}(A B) \le r,

and hence rank(AB)=r\mathrm{rank}(A B) = r.

Another important relation is

rank(XAY)=rank(A),X∈Cm×m  and  Y∈Cn×n  nonsingular.\notag \boxed{ \mathrm{rank}(XAY ) = \mathrm{rank}(A), \quad X\in\mathbb{C}^{m\times m} \;\mathrm{and}\; Y\in\mathbb{C}^{n\times n}\; \mathrm{nonsingular}. }

This is a consequence of the equality range(XAY)=Xrange(A)Y\mathrm{range}(XAY) = X\mathrm{range}(A)Y for nonsingular XX and YY.

Ranks of AA and A∗A^*

By (2) and (3) we have rank(A)=rank(A∗A)≤rank(A∗)\mathrm{rank}(A) = \mathrm{rank}(A^*A) \le \mathrm{rank}(A^*). Interchanging the roles of AA and A∗A^* gives rank(A∗)≤rank(A)\mathrm{rank}(A^*) \le \mathrm{rank}(A) and so

rank(A∗)=rank(A).(5)\notag \boxed{ \mathrm{rank}(A^*) = \mathrm{rank}(A). } \qquad (5)

In other words, the rank of AA is equal to the maximum number of linearly independent rows as well as the maximum number of linearly independent columns.

Full-Rank Factorization

A∈Cm×nA\in\mathbb{C}^{m \times n} has rank rr if and only if A=GHA = GH for some G∈Cm×rG\in\mathbb{C}^{m \times r} and H∈Cr×nH\in\mathbb{C}^{r \times n}, both of rank rr, and this is called a full-rank factorization. The existence of such a factorization implies that rank(A)=r\mathrm{rank}(A) = r by (4). Conversely, suppose that AA has rank rr. Let the columns of X∈Cm×rX\in\mathbb{C}^{m \times r} form a basis for the range space of AA. Then there are rr-vectors yjy_j such that aj=Xyja_j = Xy_j, j=1 ⁣:nj = 1\colon n, and with Y=[y1,y2,…,yn]Y = [y_1,y_2,\dots, y_n] we have A=XYA = XY. Finally, r=rank(A)=rank(XY)≤rank(Y)r = \mathrm{rank}(A) = \mathrm{rank}(XY) \le \mathrm{rank}(Y) by (3), and since rank(Y)≤r\mathrm{rank}(Y) \le r we have rank(Y)=r\mathrm{rank}(Y) = r.

Rank and Minors

A characterization of rank that is sometimes used as the definition is that it is the size of the largest nonsingular square submatrix. Equivalently, the rank is the size of the largest nonzero minor, where a minor of size kk is the determinant of a k×kk\times k submatrix.

rank(AB) and rank(BA)

Although ABAB and BABA have some properties in common when both products are defined (notably they have the same nonzero eigenvalues), rank(AB)\mathrm{rank}(AB) is not always equal to rank(BA)\mathrm{rank}(BA). A simple example is A=xA = x and B=y∗B = y^* with xx and yy orthogonal vectors: AB=xy∗AB = xy^* but BA=y∗x=0BA = y^*x = 0. An example with square AA and BB is

A=[0100],B=[1000],rank(AB)=rank([0000])=0,rank(BA)=rank([0100])=1.\notag \begin{gathered} A = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, \quad B = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}, \\ \mathrm{rank}(AB) = \mathrm{rank}\biggl( \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix} \biggr) = 0, \quad \mathrm{rank}(BA) = \mathrm{rank}\biggl( \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} \biggr) = 1. \end{gathered}

Note that A=e1e2TA = e_1e_2^T and B=e1e1TB = e_1e_1^T, where eie_i has 11 in the iith position and zeros everywhere else. Such matrices are easy to manipulate in this form (e.g., AB=e1(e2Te1)e1T=0AB = e_1 (e_2^Te_1)e_1^T = 0) and are useful for constructing examples.

How to Find Rank

If we have a full-rank factorization of AA then we can read off the rank from the dimensions of the factors. But finding a full-rank factorization is a nontrivial task. The ultimate full-rank factorization is the SVD

A=UΣVT,\notag A = U\Sigma V^T,

where U∈Rm×mU\in\mathbb{R}^{m\times m} and V∈Rn×nV\in\mathbb{R}^{n\times n} are orthogonal, Σ=diag(σ1,…,σp)∈Rm×n\Sigma = \mathrm{diag}(\sigma_1,\dots, \sigma_p)\in\mathbb{R}^{m\times n}, where p=min⁡(m,n)p = \min(m,n), and σ1≥σ2≥⋯≥σr>0=σr+1=⋯=σp=0\sigma_1\ge \sigma_2\ge \cdots \ge \sigma_r > 0 = \sigma_{r+1} = \cdots = \sigma_p = 0. The rank of AA is rr, the number of nonzero singular values.

In floating-point arithmetic, the standard algorithms for computing the SVD are numerically stable, that is, the computed singular values are the exact singular values of a matrix A+ΔAA + \Delta A with ∥ΔA∥2≤cm,nu∥A∥\|\Delta A\|_2 \le c_{m,n}u\|A\|, where cm,nc_{m,n} is a constant and uu is the unit roundoff. Unfortunately, A+ΔAA + \Delta A will typically be full rank when AA is rank deficient. For example, consider this computation.

text
>> n = 4; A = zeros(n); A(:) = 1:n^2, svd(A)
A =
     1     5     9    13
     2     6    10    14
     3     7    11    15
     4     8    12    16
ans =
   3.8623e+01
   2.0713e+00
   1.5326e-15
   1.3459e-16

The matrix has rank 22 and the two zero singular values are approximated by computed singular values of order 10−1510^{-15}. In general, we have no way to know whether tiny computed singular values signify exactly zero singular values. In practice, one typically defines a numerical rank based on a threshold and regards computed singular values less than the threshold as zero. Indeed the MATLAB rank function computes the rank as the number of singular values exceeding 2umax⁡(m,n)σ^12u \max(m,n)\widehat{\sigma}_1, where σ^1\widehat{\sigma}_1 is the largest computed singular value. If the data from which the matrix is constructed is uncertain then the definition of numerical rank should take into account the level of uncertainty in the data. Dealing with rank deficiency in the presence of data errors and in finite precision arithmetic is a tricky business.

References

An excellent reference for further rank relations is Horn and Johnson. Stewart describes some of the issues associated with rank-deficient matrices in practical computation.