# Matrix diagonalization depending on the eigenvalues and eigenvectors

I'm trying to do an app that can give the eigenvalues and vectors for a given square matrix. I have already found how to compute and display the eigenvalues and vectors, but I don't know in which case return that the matrix can't be diagonalize and that there isn't any eigenvalue or eigenvector.

So can you tell me how to determine if the matrix has eigenvalues or eigenvectors (is diagonalizable in fact?) depending on the eigenvalues and eigenvectors computed by the algorithm?

I explain you my algorithm:

For each REAL eigenvalue, it puts the related NON NULL eigenvectors in a column of an "eigenvectors matrix" containing as many columns as the number of eigenvalues. For the first real eigenvalue, it puts the non null eigenvectors in the first column of the "eigenvector matrix". For the second real eigenvalue, it puts the non null eigenvectors in the second column of the "eigenvector matrix". ... If an eigenvalue isn't real, then no eigenvector is added int the column corresponding to the eigenvalue and it goes to the next eigenvalue.

• Maybe you find this answer helpful. – thanasissdr Jan 12 '16 at 10:53
• I don't manage the complex values, just the real, so I think your answer can't help me. I've explained my algorithm in the question – Jey10 Jan 12 '16 at 11:05
• numerically non diagonalizable matrices are : complex eigenvectors / eigenvalues, ill-conditionned or nilpotent matrices. in general, making the difference between those shouldn't be so easy. in a first time, working only on symmetric matrices would be much easier. – reuns Jan 12 '16 at 11:25
• ok thanks. Because a symmetric matrix is the only form for which it's sure that it's diagonalizable? – Jey10 Jan 12 '16 at 12:47