Factorize matrix determinant When trying to diagonalize a matrix, say :
$$\left(\begin{matrix}
  0 & 2 & -1 \\
  3 & -2 & 0 \\
  -2 & 2 & 1
 \end{matrix}\right)$$
to find the eigenvalues, I have to find the determinant :
$$\left|\begin{matrix}
  -\lambda & 2 & -1 \\
  3 & -2-\lambda & 0 \\
  -2 & 2 & 1-\lambda
 \end{matrix}\right|$$
I often see people doing some voodoo manipulations on lines and columns to end up with an already factorized polynomial.
So how do they do this exactly ? 
I've looked at some examples but the manipulations seem random to me, I can't figure out a pattern except maybe trying to make zeros appear on the first line...
I need some advice on how to look at this.
 A: $\left|\begin{matrix}
  -\lambda & 2 & -1 \\
  3 & -2-\lambda & 0 \\
  -2 & 2 & 1-\lambda
 \end{matrix}\right| = 
\left|\begin{matrix}
  1-\lambda & 2 & -1 \\
  1-\lambda & -2-\lambda & 0 \\
  1-\lambda & 2 & 1-\lambda
 \end{matrix}\right|$ with $C_1 \leftarrow C_1 + C_2 + C_3$.
$ = (1-\lambda)\left|\begin{matrix}
  1 & 2 & -1 \\
  1 & -2-\lambda & 0 \\
  1 & 2 & 1-\lambda
 \end{matrix}\right|$
$ = (1-\lambda)\left|\begin{matrix}
  1 & 2 & -1 \\
  0 & -4-\lambda & 1 \\
  0 & 0 & 2-\lambda
 \end{matrix}\right|$
with $L_2 \leftarrow -L_1 + L_2$ and $L_3 \leftarrow -L_1 + L_3$.
$ = (1-\lambda)(-4-\lambda)(2-\lambda)$ because the determinant of a triangular matrix is the product of the elements of its diagonal.
The eigenvalues are then $-4, 1$ and $2$.
Note that even without the triangular matrix trick, we could have transformed the last $3\times3$ determinant in a $2\times2$ because the first column has $0$ everywhere except once. Then we could have developped it and compute the roots with a classical second degree polynomial problem. 
