To solve this problem, I will utilize the charpoly (Characteristic Polynomial) function provided by R’s pracma (Practical Numerical Math Functions) package - https://www.rdocumentation.org/packages/pracma/versions/1.9.9/topics/charpoly.
# Create the 4 x 4 matrix A.
A <- matrix(c(1, 2, 1, 0, 1, 0, 1, 0, 2, 1, 1, 0, 3, 1, 0, 1), 4, 4)
# Find the characteristic polynomial of matrix A.
matrix_a_char_poly <- charpoly(A, info = TRUE)
## Error term: 4
# Output the result.
matrix_a_char_poly
## $cp
## [1] 1 -3 -2 2 2
##
## $det
## [1] 2
##
## $inv
## [,1] [,2] [,3] [,4]
## [1,] -0.5 0.5 0.5 1
## [2,] -0.5 -0.5 1.5 2
## [3,] 1.0 0.0 -1.0 -3
## [4,] 0.0 0.0 0.0 1
Answer: The characteristic polynomial of matrix A is \(\lambda^4 -3\lambda^3 - 2\lambda^2 + 2\lambda + 2\)