C11. Find the characteristic polynomial of the matrix A =
\[ \begin{bmatrix} 3 & 2 & 1\\ 0 & 1 & 1\\ 1 & 2 & 0\\ \end{bmatrix} \]
From this week’s lecture:

To find eigenvalues and eigenvectors, we take the determinant of a special matrix and set it to zero:
det(A - \(\lambda\)I) = 0

This gives rise to a polynomial equation in terms of ?? called the characteristic polynomial.

To solve, using x in place of lamda:
\[ det( \begin{bmatrix} 3 & 2 & 1\\ 0 & 1 & 1\\ 1 & 2 & 0\\ \end{bmatrix} - \begin{bmatrix} x & 0 & 0\\ 0 & x & 0\\ 0 & 0 & x\\ \end{bmatrix} ) = 0 \]
\[ det( \begin{bmatrix} 3 - x & 2 & 1\\ 0 & 1 - x & 1\\ 1 & 2 & -x\\ \end{bmatrix} ) = 0 \]
\[ (3 - x) * det( \begin{bmatrix} 1 - x & 1\\ 2 & -x\\ \end{bmatrix} ) - 2 * det( \begin{bmatrix} 0 & 1\\ 1 & -x\\ \end{bmatrix} ) + det( \begin{bmatrix} 0 & 1 - x\\ 1 & 2\\ \end{bmatrix} ) \]
(3 - x)(-x + x^2 - 2) - 2(-1) + (-(1-x)) -3x + 3x^2 - 6 + x^2 - x^3 + 2x + 2 - 1 + x -x^3 + 4x^2 - 5
To verify in R.

library(pracma)
A = matrix(c(3,2,1,0,1,1,1,2,0), nrow = 3, byrow = T) 
charpoly(A)
## [1]  1 -4  0  5

Same coefficients, but opposite signs.