Singular Value Decomposition - Rank


matrix

Recall that the basis of a vector space V, v1,v2,,vn, are linearly independent and span V. The number of basis vectors for vector space V is the dimension of V.

A specific type of vector space, column space of matrix A, is written as col(A). It is defined as the set of all linear combinations of the columns of A, also written as Ax.

Let A be an m×n matrix, with column vectors v1, v2, , vn.

A=[v1v2vn]

A linear combination of theses vectors is therefore

c1v1+c2v2++cnvn,

where c1,c2,,cn are scalars. That is, the columns space of A col(A) is the span of the vectors v1, v2, , vn.

We also have

c1v1+c2v2++cnvn=[v1v2vn][c1c2cn]=Ax,

where x is an n×1 vector, [c1c2cn].

Therefore, column space col(A) consists of all vectors in the form of Ax. Like any other vector space, a column space also has basis vectors. The number of basis vectors for col(A), or the dimension of col(A) is called the rank of A. In other words, the rank of A is the dimension of column space Ax.

The rank of A is also the maximum number of linearly independent columns in A. This is because we can write all the dependent columns as a linear combination of these linearly independent columns. Given that Ax consists of all possible linear combination of columns in A, any member in Ax can also be written as a linear combination of these linearly independent columns. These linearly independent columns span Ax and form a basis for col(A), and the number of these vectors becomes the dimension of col(A) or rank of A.

In the previous post on eigendecomposition, the rank of each projection matrix λiuiuiT is 1. Recall that each projection matrix only have one non-zero eigenvalue. This is not a coincidence. It can be shown that the rank of a symmetric matrix is equal to the number of its non-zero eigenvalues.

Let’s return to the eigendecomposition equation. Suppose that we apply our symmetric matrix A to an arbitrary vector x. Now the eigendecomposition equation becomes:

Ax=λ1u1u1x+λ2u2u2x++λnununx


Recall the important property of symmetrix matrices in the last post. An n×n symmetric matrix has n real eigenvalues, as well as n linear independent and orthogonal eigenvectors. These eigenvectors can be used as a new basis of a n×1 vector x. In other words, a n×1 vector x can be uniquely written as a linear combination of the eigenvectors of A

x=a1u1+a2u2++anun,

[x]B=[a1a2an]

Recall that all the eigenvectors of a symmetric matrix are orthogonal. To find each coordinate ai, we just need to draw a line perpendicular to an axis of ui through point x and see where they intersect. Therefore, each coordinate ai is equal to the dot product of x and ui, and x can be re-written as

x=(u1x)u1+(u2x)u2++(unx)un

Now if we multiply A by x, we get:

Ax=(u1x)Au1+(u2x)Au2++(unx)Aun

and since the ui vectors are eigenvectors of A, the last equation simplies to:

Ax=(u1x)λ1u1+(u2x)λ2u2++(unx)λnun=λ1u1u1x+λ2u2u2x++λnununx

which is the eigendecomposition equation.


Each of the eigenvectors ui is normalized, so they are unit vectors. In each term of the eigendecomposition equation, uiuiTx gives a new vector which is the orthogonal projection of x onto ui. Then this vector is scaled by λi. Finally all the n vectors λiuiuix are summed together to give Ax. This process is shown in Figure 1.

transform: Multiplying a vector by matrix A is equivalent to scaling it along eigenvectors of A.
Transforming a vector along eigenvectors of matrix A.

The eigendecomposition mathematically explains an important property of symmetric matrices that we have seen in the plots before. A symmetric matrix transforms a vector by stretching or shrinking it along its eigenvectors, and the amount of stretching or shrinking along each eigenvector is proportional to the corresponding eigenvalue.

In addition, the eigendecomposition can break an n×n symmetric matrix into n matrices with the same shape (n×n) multiplied by one of the eigenvalues. The eigenvalues play an important role here since they can be thought of as a multiplier. The projection matrix only projects x onto each ui, and the eigenvalue scales the length of the vector projection (uiuix). The bigger the eigenvalue, the bigger the length of the resulting vector (λiuiuix) is, and the more weight is given to its corresponding matrix (uiui).

We can approximate the original symmetric matrix A by summing the terms which have the highest eigenvalues. For example, if we assume the eigenvalues λi have been sorted in descending order,

A=λ1u1u1+λ2u2u2++λnunun,

λ1λ2λn

then we can take only the first k terms in the eigendecomposition equation to have a good approximation for the original matrix:

AAk=λ1u1u1+λ2u2u2++λkukuk

where Ak is an approximation of A with the first k terms.

If in the original matrix A, the other (nk) eigenvalues that we left out are very small and close to zero, then the approximated matrix in a very similar to the original matrix, and we have a good approximation.

Matrix

C=[5110.35]

with

λ1=5.206, λ2=0.144

u1=[0.9790.202], u2=[0.2020.979]

is an example. Here λ2 is very small compared to λ1. We could approximate C with its first term in eigendecomposition corresponding to eigenvalue λ1. Let’s visualize this by applying C to vectors on a unit circle.

approximate: Approximate a matrix with its first projection matrix.
Approximate a matrix with its first projection matrix.

Multiplying x by C results in a very similar shape compared to multiplying x by λ1u1u1.

Keep in mind that a symmetric matrix is required for the eigendecomposition equation to hold. Suppose that you have a non-symmetric matrix:

[3112]

the eigenvectors are not linear independent, and the eigenvalues have both real and imaginary parts. Without real eigenvalues, we cannot properly scale projected vectors.

Or consider another non-symmetric matrix:

[3202]

Here the eigenvectors are linearly independent, but are not orthogonal, and they do not show the correct direction of stretching after transformation.

The eigendecoposition method is very useful, but only works for a symmetric matrix. A symmetric matrix is always a square matrix. If you have a non-square matrix, or a square but non-symmetric matrix, then you cannot use the eigendecomposition method to approximate it with other matrices. Singular Value Decomposition overcomes this problem, which will the topic of our next post.