# Mathematica computes wrong eigenvectors? [closed]

I have a matrix

 M = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, b}, {0, 0, -b, 0}}


that I want to diagonalize. So far, I always used the following and it worked, but for

 U = Eigenvectors[M]
FullSimplify[U.M.Transpose[U]] // MatrixForm


I get $$\left( \begin{array}{cccc} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 2 i b \\ 0 & 0 & -2 i b & 0 \\ \end{array} \right)$$

In contrast for a different matrix like

M2= {{0, 0, 0, 0}, {0, 0, A, 0}, {0, A, 0, 0}, {0, 0, 0, 0}}


I get from

 U2 = Eigenvectors[M2]
FullSimplify[U2.M2.Transpose[U2]] // MatrixForm


the result

$$\left( \begin{array}{cccc} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & -2 A & 0 \\ 0 & 0 & 0 & 2 A \\ \end{array} \right)$$ as it should be.

What's the problem here? Why isn't

 FullSimplify[U.M.Transpose[U]] // MatrixForm


diagonal as it should be?

EDIT: For

 FullSimplify[U.M.Inverse[U]] // MatrixForm


I get a diagonal matrix, but then

 M3=M+M2
U3 = Eigenvectors[M3]
FullSimplify[U3.M3.Inverse[U3]] // MatrixForm


isn't diagonal.

## closed as off-topic by MarcoB, Bob Hanlon, dr.blochwave, Daniel Lichtblau, Oleksandr R.Jun 30 '15 at 0:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, Bob Hanlon, dr.blochwave, Daniel Lichtblau, Oleksandr R.
If this question can be reworded to fit the rules in the help center, please edit the question.

• M is not symmetric, so the correct check exploiting the antisymmetry is U.M.ConjugateTranspose[U]. – J. M. is away Jun 29 '15 at 12:13
• @J. M. Thanks for your comment. This works for M, but if I define a new matrix as the sum of the two other matrices this does not yield a diagonal matrix. The result is then $$\left( \begin{array}{cccc} 0 & 0 & -\frac{b^2}{\sqrt{(A-b) (A+b)}} & \frac{b^2}{\sqrt{(A-b) (A+b)}} \\ 0 & 0 & 0 & 0 \\ \frac{2 A^2}{\sqrt{(A-b) (A+b)}} & 0 & -\frac{A^2+b^2}{\sqrt{(A-b) (A+b)}} & 0 \\ -\frac{2 A^2}{\sqrt{(A-b) (A+b)}} & 0 & 0 & \frac{A^2+b^2}{\sqrt{(A-b) (A+b)}} \\ \end{array} \right)$$ – jak Jun 29 '15 at 12:17
• That would be because the eigenvectors are returned as rows. Transpose[] before checking. – J. M. is away Jun 29 '15 at 12:22
• @J. M. oh... yes of course. Thank you so much! – jak Jun 29 '15 at 12:24
• Okay, read the docs for Eigensystem[], and then try answering your own question. – J. M. is away Jun 29 '15 at 12:26

m = RandomReal[1, {5, 5}];

So, in order to diagonalize the matrix m, we have to evaluate Inverse[u].m.u with u=Tranpose@Eigenvectors@m.