How to find a characteristic polynomial of 5x5 matrix From an example that I am looking at, the characteristic polynomial of 
$\begin{bmatrix}
-1&4&0&0&0 \\
0&3&0&0&0 \\
0&-4&-1&0&0 \\ 
3&-8&-4&2&1 \\
1&5&4&1&4
\end{bmatrix}$ 
is $(x-3)^3(x+1)^2$. I understand how to find the characteristic polynomial of 2x2 and 3x3 matrices but anything nxn beyond that I'm not sure what to do. Could someone walk me through the steps of the calculation to find the characteristic polynomial for this matrix? 
 A: The characteristic polynomial is (up to sign) the determinant of $A - \lambda I$, in this case
$\begin{bmatrix}
-\lambda-1&4&0&0&0 \\
0&-\lambda+3&0&0&0 \\
0&-4&-\lambda-1&0&0 \\ 
3&-8&-4&-\lambda+2&1 \\
1&5&4&1&-\lambda+4
\end{bmatrix}$
The most common definition of determinant is based on an expansion to minors (see https://en.wikipedia.org/wiki/Determinant#Definition), but using that directly for the calculation is horribly inefficient. In general, finding the determinant of a matrix if based on a form of Gaussian Elimination using the following rules:


*

*The determinant of a triangular matrix is the product of entries on the diagonal.

*Multiplying a single row by a scalar multiples the determinant by the same scalar.

*Switching two rows negates the determinant.

*Adding a scalar multiple of a row to another row leaves the determinant unchanged.


However, in this particular case the calculation is much easier because $A$ is block triangular. That is, it can be written in the form
$A = \begin{bmatrix}
B&0&0\\C&D&0\\E&F&G
\end{bmatrix}$
Where $B=\begin{bmatrix}-1&4\\0&3\end{bmatrix}$, $D = \begin{bmatrix}-1\end{bmatrix}$ and $G = \begin{bmatrix}2&1\\1&4\end{bmatrix}$.
In such a case, the determinant of $A$ is the product of the determinants of $B$,$D$ and $G$, and the characteristic polynomial of $A$ is the product of the characteristic polynomials of $B$,$D$ and $G$. Since each of these is up to $2\times2$, you should find the result easily. The result is $(\lambda-3)(\lambda+1)(\lambda+1)(\lambda^2-6\lambda+7)$ (and not as you wrote).
A: Directly using elementary operations that don't change the value of the determinant. Develop by the second row twice:
$$\begin{vmatrix}
x+1&-4&0&0&0 \\
0&x-3&0&0&0 \\
0&4&x+1&0&0 \\ 
-3&8&4&x-2&-1 \\
-1&-5&-4&-1&x-4
\end{vmatrix}=(x-3)\begin{vmatrix}
x+1&0&0&0 \\
0&x+1&0&0 \\ 
-3&4&x-2&-1 \\
-1&-4&-1&x-4
\end{vmatrix}=$$$${}$$
$$=(x-3)(x+1)\begin{vmatrix}
x+1&0&0 \\ 
-3&x-2&-1 \\
-1&-1&x-4
\end{vmatrix}\stackrel{\text{1st row}}
=(x-3)(x+1)^2\begin{vmatrix}x-2&-1\\-1&x-4\end{vmatrix}=$$$${}$$
$$=(x-3)(x+1)^2(x^2-6x+7)$$
As you can see, the above isn't $\;(x-3)^3(x+1)^2\;$, so at least one of you or I is wrong...but I already checked mine with this program
