C20: Consider the matrix A below. First, show that A is diagonalizable by computing the geometric multiplicities of the eigenvalues and quoting the relevant theorem. Second, and a diagonal matrix, D, and a nonsingular matrix, S, so that S-􀀀1AS = D. (See Exercise EE.C20 for some of the necessary computations.)

\[A = \begin{bmatrix} 18 & -15 & 33 & -15\\ -4 & 8 & -6 & 6\\ -9 & 9 & -16 & 9\\ 5 & -6 & 9 & -4\\ \end{bmatrix}\]

I’ll start by finding the eigenvalues that exist for this matrix.

matrixA <- matrix(c(18, -15, 33, -15, -4, 8, -6, 6, -9, 9, -16, 9, 5, -6, 9, -4), 4, 4)

ev_a <- eigen(matrixA)
print(ev_a)
## eigen() decomposition
## $values
## [1]  3  2  2 -1
## 
## $vectors
##            [,1]       [,2]       [,3]       [,4]
## [1,]  0.3592106 -0.4099344 -0.0130612 -0.3779645
## [2,] -0.5388159  0.4276055  0.4369139  0.3779645
## [3,]  0.5388159 -0.6714434  0.2607998 -0.7559289
## [4,] -0.5388159  0.4452765  0.8607666  0.3779645

The eigen function in R finds three distinct eigenvalues, 3, 2, and -1. The eigenvalue 2 has algebraic multiplicity of 2, while the other values have multiplicity of one. To find the geometric multiplicities, I solved for the nullspace of matrix A - lambda * I for lambda = 2, which I needed to determine had a geometric multiplicity different than its algebraic one.

eig2 <- matrixA - 2 * diag(4)

print(rref(eig2))
##      [,1] [,2]  [,3]       [,4]
## [1,]    1    0 -0.50  0.1666667
## [2,]    0    1  0.25 -0.5833333
## [3,]    0    0  0.00  0.0000000
## [4,]    0    0  0.00  0.0000000

With two free variables, the geometric multiplicity of 2 is also equal to 2. Basedo on theorem DMFE (page 410), matrix A is diagonalizable if each arithmetic multiplicity is equal to its geometric multiplicity. I calculated the rest of the eigenspaces to form matrix S. Matrix D is a diagonal matrix with eigenvalues. I found these values using theorem BNS, Basis for Null Spaces, on page 131.

eig3 <- matrixA - 3 * diag(4)

print(rref(eig3))
##      [,1] [,2] [,3]       [,4]
## [1,]    1    0    0  0.6666667
## [2,]    0    1    0 -1.0000000
## [3,]    0    0    1  1.0000000
## [4,]    0    0    0  0.0000000
eigneg1 <- matrixA - (-1) * diag(4)

print(rref(eigneg1))
##      [,1] [,2] [,3] [,4]
## [1,]    1    0    0    1
## [2,]    0    1    0   -1
## [3,]    0    0    1    2
## [4,]    0    0    0    0
vs3 <- matrix(c(-2/3, 1, -1, 1), 4,1)
vs2 <- matrix(c(1/2, -1/4, 1, 0, -1/6, 7/12, 0, 1), 4,2) 
vsneg1 <- matrix(c(-1, 1, -2, 1),4,1)
matA_eigenspace <- cbind(vs3, vs2)
matA_eigenspace <- cbind(matA_eigenspace, vsneg1)
print(matA_eigenspace)
##            [,1]  [,2]       [,3] [,4]
## [1,] -0.6666667  0.50 -0.1666667   -1
## [2,]  1.0000000 -0.25  0.5833333    1
## [3,] -1.0000000  1.00  0.0000000   -2
## [4,]  1.0000000  0.00  1.0000000    1

I checked the math by multiplying the orignal matrix A by the inverse matrix of the eigenspace and eigenspace to see if it equaled the diagonal matrix.

D <- diag(4)
D[1,1] <- ev_a[[1]][1]
D[2,2] <- ev_a[[1]][2]
D[3,3] <- ev_a[[1]][3]
D[4,4] <- ev_a[[1]][4]

eigen_sol <- round(inv(matA_eigenspace) %*% matrixA %*% matA_eigenspace,2)


print(eigen_sol)
##      [,1] [,2] [,3] [,4]
## [1,]    3    0    0    0
## [2,]    0    2    0    0
## [3,]    0    0    2    0
## [4,]    0    0    0   -1