I am trying to figure out how to determine the diagonalizability of the following two matrices. For the first matrix

$$\left[\begin{matrix} 0 & 1 & 0\\0 & 0 & 1\\2 & -5 & 4\end{matrix}\right]$$

There are two distinct eigenvalues, $\lambda_1 = \lambda_2 = 1$ and $\lambda_3 = 2$.

According to the theorem, If $A$ is an $n \times n$ matrix with $n$ distinct eigenvalues, then $A$ is diagonalizable.

For the next one $3 \times 3$ matrix

$$\left[\begin{matrix} -1 & 0 & 1\\3 & 0 & -3\\1 & 0 & -1\end{matrix}\right]$$

We also have two eigenvalues $\lambda_1 = \lambda_2 = 0$ and $\lambda_3 = -2$.

For the first matrix, the algebraic multiplicity of the $\lambda_1$ is $2$ and the geometric multiplicity is $1$. So according to the theorem, this would not be diagonalizable since the geometric multiplicity is not equal to the algebraic multiplicity.

For the second matrix, the algebraic multiplicity and the geometric multiplicity of both lambdas are equal, so this is diagonalizable according to my textbook. But there are still only two distinct eigenvalues in $3 \times 3$ matrix, so why is this diagonalizable if we are to accept the first theorem?

Also, how to determine the geometric multiplicity of a matrix?