# Eigenvalue function finds real eigenvalues for antihermitian matrix

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

• 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. Jun 15, 2023 at 8:13
• 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. &] Jun 15, 2023 at 8:16
• @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. Jun 15, 2023 at 8:21
• 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? Jun 15, 2023 at 8:23
• @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. Jun 21, 2023 at 9:57