If given a (large) antihermitian matrix, Mathematica occasionally finds real eigenvalues although the in-build function AntihermitianMatrixQ confirms it to be antihermitian. The matrices for which I see this problem are of the form:

$$ M=\begin{pmatrix}0&-x_1&0&0&\dots\\x_1&0&-x_2&0&\dots\\0&x_2&0&-x_3&\dots\\\vdots\end{pmatrix}, $$

with all $x_j \in \mathbb{R}_{>0}$.

My way to cope with this was to observe the hermitian matrix $i M$ for which Mathematica correctly finds solely real eigenvalues $\lambda_j$ and get the eigenvalues of $M$ simply as $i \lambda_j$ (which are then completely imaginary as expected).

Anyhow I am still curious why Mathematica struggles to find the eigenvalues of $M$ in the first place and why it works much better with the hermitian matrix $iM$.

Many thanks for any answer or insight of what happens when eigenvalues are computed!

An explicit matrix at which this problem can be seen can be found at: https://drive.google.com/file/d/1TOPQzQxRp9rtRKvOHPcXdTZZXUnoOasX/view?usp=sharing

  • $\begingroup$ I can't give the full matrix as it is too large are you saying a small matrix can not be antihermitian? Or do you mean this problem you describe only shows up when the matrix is very large as you have? If so it could indicate another problem. $\endgroup$
    – Nasser
    Jun 15, 2023 at 8:13
  • $\begingroup$ I tried with 30000 blocks and could never see what you describe. bl := {{0, t = RandomReal[{-1, 1}]}, {-t, 0}} m = BlockDiagonalMatrix[Table[bl, 30000]]; AllTrue[Re@Eigenvalues[m], # == 0. &] $\endgroup$ Jun 15, 2023 at 8:16
  • $\begingroup$ @Nasser I sketched a small matrix that is antihermitian so that's not what I said. But yes, the problem happens at larger sizes like 700x700 and upwards. But again, turning it hermitian as described above finds all real eigenvalues. So I suspect the problem to have something to do with the eigenvalues being imaginary. $\endgroup$
    – qising
    Jun 15, 2023 at 8:21
  • $\begingroup$ Could you post an example of one such matrix that shows this problem? If too large, may be put the notebook at external link and post the link only? $\endgroup$
    – Nasser
    Jun 15, 2023 at 8:23
  • $\begingroup$ @lbnz99 do you mean how to post link to your notebook? I meant if the input is too large to post here, you can always put a link to your notebook which shows the problem., At any site you have access to and put the link in your question. It is better ofcourse to put everything in the question itself, but you say the input is very large. $\endgroup$
    – Nasser
    Jun 21, 2023 at 9:57

1 Answer 1


I got in touch with Wolfram's support team and they stated that the problem sketched above is an artifact of Mathematica 12 and resolved in version 13.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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