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 (000000000002ib00−2ib0) \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

(0000000000−2A00002A) \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.

=================

=================

1 Answer
1

=================

In general, the relation between an original matrix and the eigenvalue decomposition is the following:

m = RandomReal[1, {5, 5}];
{eval, evec} = Eigensystem[m];
Norm[Transpose[evec].DiagonalMatrix[eval].Inverse@Transpose[evec]-m]

which outputs 0.

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