#install.packages("pracma")
library(pracma)
Eigenvalues and Eigenvectors Page 402 Exercise T10 â Suppose that A is a square matrix. Prove that the constant term of the characteristic polynomial of A is equal to the determinant of A. # Make the matrix
A <- matrix(c(
-2,6,12,9,
4,9,11,10,
7,12,0,2,
31,6,1,3
), 4, 4)
A
## [,1] [,2] [,3] [,4]
## [1,] -2 4 7 31
## [2,] 6 9 12 6
## [3,] 12 11 0 1
## [4,] 9 10 2 3
A_cp <- charpoly(A, info = TRUE)
## Error term: 7938
A_cp$cp
## [1] 1 -10 -578 -502 -3969
The constant term of the characteristic polynomial is -3969. # Find determinant
det(A)
## [1] -3969
From the above result we can prove that the constant term of the characteristic polynomial of A is equal to the determinant of A.