We know \(A - \lambda I \ \) should work.
\[ A - \lambda I \ = \begin{bmatrix} 1 & 2 & 1 & 0 \\ 1 & 0 & 1 & 0 \\ 2 & 1 & 1 & 0 \\ 3 & 1 & 0 & 1 \end{bmatrix} - \begin{bmatrix} \lambda & 0 & 0 & 0 \\ 0 & \lambda & 0 & 0 \\ 0 & 0 & \lambda & 0 \\ 0 & 0 & 0 & \lambda \end{bmatrix} = \begin{bmatrix} 1 - \lambda & 2 & 1 & 0\\ 1 & - \lambda & 1 & 0 \\ 2 & 1 & 1 - \lambda & 0\\ 3 & 1 & 0 & 1 - \lambda\\ \end{bmatrix} \] We need to calculate the determinant of \(A - \lambda I\ \) and then simplify equation. If it was 2 x 2, it would be easy but 4 x 4 is very complicated matrix to calculate. We will use charpoly function to do this calculation.
library(pracma)
## Warning: package 'pracma' was built under R version 3.4.4
A <- matrix(c(1, 2, 1, 0,
1, 0, 1, 0,
2, 1, 1, 0,
3, 1, 0, 1), nrow=4, byrow=TRUE)
charpoly(A)
## [1] 1 -3 -2 2 2
So it means the characteristic polynomial is, \(\lambda^4 - 3\lambda^3 - 2\lambda^2 + 2\lambda +2 = 0\).