Diagonalization theorem: a nxn matrix A is diagonalizable if and only if it has n linearly independent eigenvectors. If so, the matrix factors as A = PDP^{-1}, where D is diagonal and P is invertible (and its columns are the n linearly independent eigenvectors). Algorithm to diagonalize a matrix.