C- 25 For matrix A = {(2,1,1),(1,2,1),(1,1,2)} the characteristic polynomial of A is p(x) = (4-x)(1-x)^2 Find the eigenvalues and corresponding eigenspaces of A

Since here we are given the characteristic polynomial we can see the eigenvalues are λ = 4 and λ = 1 But here we are using eigen() to calcuate using R

library(pracma)
## Warning: package 'pracma' was built under R version 3.4.3
A <- matrix(c(2,1,1,1,2,1,1,1,2),nrow = 3)
A
##      [,1] [,2] [,3]
## [1,]    2    1    1
## [2,]    1    2    1
## [3,]    1    1    2
ev <- eigen(A)
value <- ev$values
value
## [1] 4 1 1

we got same results using R

Now to calculate eigenspaces for λ = 1 we need to calculate (A - 1(I))

I <- diag(3)   # I is identity matrix
Eigesp1 <- (A - (1*I))      # for calculating eigenspace for value 1
Eigesp1
##      [,1] [,2] [,3]
## [1,]    1    1    1
## [2,]    1    1    1
## [3,]    1    1    1
rref(Eigesp1) #reducing the matrix to row echelon form
##      [,1] [,2] [,3]
## [1,]    1    1    1
## [2,]    0    0    0
## [3,]    0    0    0

The system is equivalent to the single equation x+y+z=0. That means that we have two degrees of freedom, y and z. we can express x in terms of y and z and x=−y−z. So the solutions are given by: x = -s-t y=s z=t calculate the space of solutions by taking the parameters (in this case, s and t), and putting one of them equal to 1 and the rest to 0, one at a time. Setting s=1 and t=0, we get x=−1, y=1, z=0, leading to the vector (−1,1,0); setting s=0 and t=1 we get x=−1, y=0, z=1, leading to the vector (−1,0,1).

So E(1) = {(-1,1,0) (-1,0,1)}

now for value 4 we need to calculate (A - 4(I))

I <- diag(3)   # I is identity matrix
Eigesp4 <- (A - (4*I))      # for calculating eigenspace for value 4
Eigesp4
##      [,1] [,2] [,3]
## [1,]   -2    1    1
## [2,]    1   -2    1
## [3,]    1    1   -2
rref(Eigesp4) #reducing the matrix to row echelon form
##      [,1] [,2] [,3]
## [1,]    1    0   -1
## [2,]    0    1   -1
## [3,]    0    0    0

Calculating same way as above we get

E(4) = {1,1,1}