2
$\begingroup$

As we know, $$H=U^{-1}\Lambda U $$ where $\Lambda $ is the diagonal matrix and $H$ is the original matrix, $U$ is the eigenvector matrix. Also, we can restore the original matrix via: $$\Lambda=UHU^{-1}$$ However, I find such relation sometimes right in Mathematica and sometimes failure:

a = ( {
    {2, -1, 0, 0},
    {-1, 1, -1, 0},
    {0, -1, -1, -1},
    {0, 0, -1, -2}
   } );
Da = N[DiagonalMatrix[Eigenvalues[a]]];
Sa = N[Eigenvectors[a]] // Transpose;
Sa.Da.Inverse[Sa] // MatrixForm

The result breaks this relation, i.e. different from the original matrix: enter image description here

But, if I change another original matrix:

a = ( {
    {1, -1, 0, 0},
    {-1, 1, -1, 0},
    {0, -1, 1, -1},
    {0, 0, -1, -1}
   } );
Da = N[DiagonalMatrix[Eigenvalues[a]]]
Sa = N[Eigenvectors[a]] // Transpose;
Sa.Da.Inverse[Sa] // MatrixForm

The result follow the relation above. enter image description here

I am confused of such problem.

$\endgroup$
  • $\begingroup$ I just pasted the first block of code into a notebook and I got the exact same matrix a back. In addition: not every matrix can be diagonalized this way, so you can't expect this to work for every matrix. en.wikipedia.org/wiki/Eigendecomposition_of_a_matrix $\endgroup$ – Sjoerd Smit Aug 6 at 8:03
  • $\begingroup$ @SjoerdSmit Thanks for your comments! I change another computer and still obtain the "wrong" result, it seems strange. I will check whether it is the exception as you said. $\endgroup$ – Merlin Zhang Aug 6 at 8:17
4
$\begingroup$

Works fine for me:

a = {{1, -1, 0, 0}, {-1, 1, -1, 0}, {0, -1, 1, -1}, {0, 0, -1, -1}};

{Da, Sa} = Eigensystem[a];

Inverse[Transpose[Sa]].a.Transpose[Sa] == DiagonalMatrix[Da] // FullSimplify
(*    True    *)

Transpose[Sa].DiagonalMatrix[Da].Inverse[Transpose[Sa]] == a // FullSimplify
(*    True    *)
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks for your answer! By comparing with your code, I find the key problem is that we must use "Eigensystem", rather than use "Eigenvalues" and "Eigenvectors" respectively. $\endgroup$ – Merlin Zhang Aug 6 at 9:02
  • $\begingroup$ @Merlin, a more fundamental error that you made is that you did not transpose the result of Eigenvectors[]. $\endgroup$ – J. M.'s discontentment Aug 6 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.