When is a Matrix Diafonalizable

A matrix  
\[A\]
  is diagonalizable if the minimal polynomial for  
\[A\]
  has no repeated roots.
Example: Let  
\[A= \left( \begin{array}{ccc} 1 & 5 & 7 \\ 0 & 4 & 3 \\ 0 & 0 & 1 \end{array} \right)\]

The characteristic polynomial for  
\[A\]
  is  
\[f(\lambda )=(\lambda -1 )^2( \lambda -4 )\]

If this is also the minimal polynomial, then the minimal polynomial has repeated roots and  
\[A\]
  is not diagonalizable.
\[\begin{equation} \begin{aligned}(A-I)(A-4I) &= \left( \begin{array}{ccc} 0 & 5 & 7 \\ 0 & 3 & 3 \\ 0 & 0 & 0 \end{array} \right) \left( \begin{array}{ccc} -3 & 5 & 7 \\ 0 & 0 & 3 \\ 0 & 0 & -3 \end{array} \right) \\ &= \left( \begin{array}{ccc} 0 & 0 & 6 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array} \right)\end{aligned} \end{equation}\]

\[(A-I)(A-4I)\]
  is not the minimum polynomial, so the minimal polynomial has repeated roots and the matrix is not diagonalizable.
Example: Let  
\[A= \left( \begin{array}{ccc} 1 & 5 & 7 \\ 0 & 4 & 3 \\ 0 & 0 & 2 \end{array} \right)\]

The characteristic polynomial is  
\[(1- \lambda )(4- \lambda )(2- \lambda)\]

The is the characteristic polynomial. Since the minimum polynomial divides the characteristic polynomial, the minimum polynomial is equal to the characteristic polynomial, and has no repeated roots, and the matrix is diagonalizable.