Singular Value Decomposition - Properties of Symmetric Matrices 2


matrix

Geometrical interpretation of eigendecomposition

In the previous post, we showed how to express a symmetric matrix as the product of three matrices, a process known as eigendecomposition. In this post, we revisit this procedure, but from a geometrical perspective.

To begin, let’s assume that a symmetric matrix A has n eigenvectors, and each eigenvector ui is an n×1 column vector

ui=[ui1ui2uin]

then the transpose of ui is a 1×n row vector

uiT=[ui1ui2uin]

and their multiplication

uiuiT=[ui1ui2uin][ui1ui2uin]=[ui1ui1ui1ui2uinuinui2ui1ui2ui2ui2uinuinui1uinui2uinuin]

becomes an n×n matrix.

Let’s return to A=PDP. First, we calculate DP to simplify the eigendecomposition equation:

[λ1000λ2000λn][u1u2un]=[λ1000λ2000λn][u11u12u1nu21u22u2nun1un2unn]=[λ1u11λ1u12λ1u1nλ2u21λ2u22λ2u2nλnun1λnun2λnunn]=[λ1u1λ2u2λnun]

Now the eigendecomposition becomes:

A=[u1u2un][λ1u1λ2u2λnun]=λ1u1u1+λ2u2u2++λnunun

Therefore, the n×n matrix A can be broken into n matrices with the same shape (n×n), and each of these matrices has a multiplier which is equal to the corresponding eigenvalue λi. Each of the matrices uiui is called a projection matrix.

Imagine that we have a vector x and a unit vector v. The inner product of v and x which is equal to vx=vx gives the scalar projection of x onto v, which is the length of the vector projection of x into v. If we multiply vx by v again, vvx gives a vector which is called the orthogonal projection of x onto v. This is shown in Figure 1.

eigendecomposition: projecting and scaling (left) then vectorizing (right).
Multiplying a vector with a projection matrix.

Therefore, when v is a unit vector, multiplying vv by x will give the orthogonal projection of x onto v, and that is why vv is called the projection matrix. Multiplying uiui by x, we get the orthogonal projection of x onto ui.

Now let’s use R to calculate the projection matrices of matrix A mentioned before.

A=[3112]

We had already calculated the eigenvalues and eigenvectors of A.

mat_a <- matrix(c(3, 1, 1, 2), 2)
eigen_a <- eigen(mat_a)
eigen_a
eigen() decomposition
$values
[1] 3.618034 1.381966

$vectors
           [,1]       [,2]
[1,] -0.8506508  0.5257311
[2,] -0.5257311 -0.8506508

The next chunk will apply eigendecomposition to A and print the first term, namely A1.

u_a <- eigen_a$vectors # an orthogonal matrix made of A's eigenvectors
lambda_a <- eigen_a$values # a vector of A's eigenvalues
mat_a1 <- lambda_a[1] * u_a[,1] %*% t(u_a[,1])
mat_a1 |> round(3)
      [,1]  [,2]
[1,] 2.618 1.618
[2,] 1.618 1.000

A1=λ1u1u1=3.618[0.8510.526][0.8510.526]=[2.6181.6181.6181]

As you can see, A1 is also a symmetric matrix. In fact, it can be shown that all projection matrices λiuiui in the eigendecomposition equation are symmetric.

Other than being symmetric, projection matrices have some interesting properties. Let’s continue with A1 as an example. We can calculate its eigenvalues and eigenvectors:

eigen_a1 <- eigen(mat_a1)
cat("eigenvalues: ", "\n")
ifelse(round(eigen_a1$values, 3) < 0.001, 0, round(eigen_a1$values, 3))
cat("eigenvectors: ", "\n")
eigen_a1$vectors |> round(3)
eigenvalues:  
[1] 3.618 0.000
eigenvectors:  
       [,1]   [,2]
[1,] -0.851  0.526
[2,] -0.526 -0.851

A1 has two eigenvalues. One is 0. The other one is equal to λ1 of the orignal matrix A. In addition, its eigenvectors are identical to that of A. This is not a coincidence. To see why, suppose we multiple A1 by u1:

A1u1=(λ1u1u1)u1=λ1u1(u1u1)

We know that u1 is an eigenvector and it is normalized. Therefore, its length is equal to 1, so is its inner product with itself. Thus we have:

A1u1=(λ1u1u1)u1=λ1u1

Thus, u1 is an eigenvector of A1, and the corresponding eigenvalue is λ1.

Furthermore,

A1u2=(λ1u1u1)u2=λ1u1(u1u2)

Because A is symmetric, its eigenvectors u1 and u2 are orthogonal, or perpendicular. Given that the inner product of two perpendicular vectors is zero, the inner product of u1 and u2 is zero. Thus we have

A1u2=(λ1u1u1)u2=λ1u1(u1u2)=0=0×u2

which means that u2 is also an eigenvector of A1 and its corresponding eigenvalue is 0, matching the output of eigen_a1$values[2] = 0.

In general, eigendecomposition decomposes a symmetric matrix into n of n×n projection matrices, λiuiui.

Each projection matrix is also symmetric, which shares the same eigenvectors as the original matrix. For a particular project matrix λkukuk, the corresponding eigenvalue of eigenvector uk is the k-th eigenvalue of A, λk, whereas all the remaining eigenvalues are zero.

Recall that a symmetric matrix scales a vector along its eigenvectors, proportionally to the corresponding eigenvalue. Therefore, a projection matrix λiuiui stretches/shrinks a vector along ui by λi, but shrinks the vector to zero in all other directions. Let’s illustrate this with A and one of its projection matrix A1 in Figure 2.

projection: Original vectors (left) and transformed vectors (right).
Original vectors (left) and transformed vectors by a projection matrix (right).

All vectors in X are transformed by A1, namely, stretched along u1 and shrunk to zero along u2. As a result, the initial circle became a straight line.

Previously, matrix A transformed vectors in X into an ellipse, another 2-D shape. And yet, matrix A1 transformed vectors in X into a line, a 1-D shape. Both A and A1 are symmetric. How come one preserves whereas the other reduces the dimension? In the next post, we will discuss the reason by introducing the concept of rank.