I have two examples of matrices that undergo a similarity transformation: a random matrix, and an exclusion-process inspired matrix. The similarity transformation $\sigma$ is given by an $L \times L$ unit anti-diagonal matrix

L = 50; (*linear size of matrices; precise value irrelevant*)
e = 0.9; (*parameter to define matrices; precise value irrelevant*)
sigma = Table[If[j == L - i + 1, 1., 0.], {i, L}, {j, L}];

That $\sigma$ generates a unitary transformation is checked by $\sigma^2 = 1$, and $|\textrm{det}(\sigma)| = 1$. The random-matrix is created by

CreateRandomMatrix[h_, L_] := Module[{m},
m = Table[RandomReal[{-h, h}], {i, L}, {j, L}];

whereas the second matrix is created by

CreateMatrix[h_, L_] := Module[{m},
m = SparseArray[{Band[{1, 1}] -> -1, Band[{1, 2}] -> 1. - h, Band[{2, 1}] -> h}, {L, L}];
m[[1, 1]] = -h;
m[[L, L]] = -1 + h;

Now I want to test that the similarity transformation induced by $\sigma$ preserves eigenvalues, as expected for a similarity transformation. For this I first sort the real and imaginary components of the eigenvalues (before and after the transformation), and then find the absolute maximum differences:

MyMat = CreateRandomMatrix[e, L];
evals1 = Eigenvalues[sigma.MyMat.sigma];(*after transformation*)
evals2 = Eigenvalues[MyMat];(*before transformation*)

Max[Abs[Sort[Im[evals1]] - Sort[Im[evals2]]]] (*imaginary part*)
Max[Abs[Sort[Re[evals1]] - Sort[Re[evals2]]]](*real part*)

For the case of random-matrix as printed above, I get both above numbers to be $\mathcal{O}(10^{-14})$; however if I replace CreateRandomMatrix by CreateMatrix, the differences come out:


These differences get worse as $L$ increases, and, therefore, better as $L$ decreases; I just chose a value of $L$ where the differences are first appreciably apparent.

Any idea why the similarity transformation preserves the eigenvalues for a random matrix but not for the particular one that I have?

  • 2
    $\begingroup$ The matrix you construct with CreateMatrix has Det = 0, so the eigenspaces are not guaranteed to be orthogonal. In contrast, the random matrix has nonzero Det. $\endgroup$ – bill s May 30 '18 at 0:30
  • $\begingroup$ I get differences on the order of 10^-14. For L = 500, I get differences on the order of 10^-13. (V11.2, MacOS) $\endgroup$ – Michael E2 May 30 '18 at 1:39
  • $\begingroup$ I also cannot reproduce the problem (version 11.3 for macOS). $\endgroup$ – Henrik Schumacher May 30 '18 at 6:11
  • $\begingroup$ @bills I suspected something of the sort (based on getting different numbers for those differences from different Mathematica versions, but never a zero as the others got), but could not fully pin down why . Any further explanations as to why the similarity transformation fails when eigenspaces are nonorthogonal? Possibly related: How do updated versions get it right? $\endgroup$ – MvP May 30 '18 at 21:03

Your Answer

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

Browse other questions tagged or ask your own question.