library (pracma)
## Warning: package 'pracma' was built under R version 4.2.2
Sample <- matrix( c( 1, 2, 3, 0, 4, 5, 0, 0, 6 ), nrow=3, byrow=TRUE )
eigenValue <- eigen(Sample)
eigenValue$values
## [1] 6 4 1
The Eigenvalues are 6, 4, and 1
eigenValue$vectors
## [,1] [,2] [,3]
## [1,] 0.5108407 0.5547002 1
## [2,] 0.7981886 0.8320503 0
## [3,] 0.3192754 0.0000000 0
polynomial = charpoly(Sample)
polynomial
## [1] 1 -11 34 -24
The characteristic polynomial is:
X3-11x2+34x-24