# eigenvector bug?

Bug introduced in 7.0.1 or earlier and fixed in 10.0.0

I have a fairly simple $3\times3$ complex matrix, $$M=\left( \begin{array}{ccc} \frac{7}{2}-\frac{i}{2} & -1+i & \frac{1}{2}+\frac{5 i}{2} \\ -1+i & 5+i & -1+i \\ \frac{1}{2}+\frac{5 i}{2} & -1+i & \frac{7}{2}-\frac{i}{2} \\ \end{array} \right)$$ Solving for the eigenvalues and eigenvectors:

mat = {{7/2 - I/2, -1 + I, 1/2 + 5 I/2}, {-1 + I,
5 + I, -1 + I}, {1/2 + 5 I/2, -1 + I, 7/2 - I/2}};
{vals, vecs} = Eigensystem[mat]


gives (Mathematica 9.0.1)

\begin{array}{ccc} 6 & 3+3 i & 3-3 i \\ \{1,-2,1\} & \left\{\frac{17}{13}+\frac{6 i}{13},0,1\right\} & \{-1,0,1\} \\ \end{array}

But that 2nd eigenvector is not right; it should be $(1,1,1)$. Is there a bug, or am I being incredibly obtuse?

-
Pretty shocking, this one. Are you going to report it to Wolfram? http://www.wolfram.com/support/contact/email/?topic=Feedback –  Jens Aug 13 '13 at 6:03
Yup, this is clearly a bug as can be confirmed with the following: M.Transpose[{Eigenvectors[M][[2]]}] == Eigenvalues[M][[2]] Transpose[{Eigenvectors[M][[2]]}]. Which gives False indicating that this is not a true eigenvalue equation. Indeed replacing this eigenvector with {1,1,1} satisfies the equation. –  RunnyKine Aug 13 '13 at 6:12
I've pasted the matrix to WolframAlpha. It also gives the wrong answer. –  luyuwuli Aug 13 '13 at 6:30
Thanks for the confirmation. It's nice to know I'm not crazy. I've reported it to Wolfram. –  gilonik Aug 13 '13 at 6:58
This has been fixed for a future release. –  Daniel Lichtblau Aug 19 '13 at 16:31

This appears to be a genuine bug with exact arithmetic in Eigensystem. Here is a comparison to the same calculation with real numbers, for which I use the matrix mat//N:

mat = {{7/2 - I/2, -1 + I, 1/2 + 5 I/2}, {-1 + I,
5 + I, -1 + I}, {1/2 + 5 I/2, -1 + I, 7/2 - I/2}};

{vals, vecs} = Eigensystem[mat]

(*
==> {{6, 3 + 3 I,
3 - 3 I}, {{1, -2, 1}, {17/13 + (6 I)/13, 0, 1}, {-1, 0, 1}}}
*)

{numericvals, numericvecs} = Eigensystem[mat // N] // Chop

(*
==> {{6., 3. - 3. I,
3. + 3. I}, {{-0.408248, 0.816497, -0.408248}, {-0.707107, 0,
0.707107}, {0.57735, 0.57735, 0.57735}}}
*)


The results are not equivalent, and I can test which of them gives correct eigenvalues as follows:

Table[Chop[mat.vecs[[i]] - vals[[i]] vecs[[i]]], {i, 3}]

(*
==> {{0, 0, 0}, {36/13 - (24 I)/13, -(36/13) + (24 I)/13, 0}, {0,
0, 0}}
*)

Table[
Chop[N[mat].numericvecs[[i]] -
numericvals[[i]] numericvecs[[i]]], {i, 3}]

(* ==> {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}} *)


Clearly, the floating-point result is correct and the exact arithmetic result (using mat without N) is incorrect.

This then also indicates how to work around this bug: use only numerical matrices with N[...].

-
It's good to know that the numerical result is correct. I'm saved. –  xslittlegrass Mar 13 '14 at 3:54
@xslittlegrass Sadly, the "future version" that was supposed to fix this bug hasn't materialized yet... –  Jens Mar 13 '14 at 4:04

This bug has been fixed in V10

mat = {{7/2 - I/2, -1 + I, 1/2 + 5 I/2}, {-1 + I,
5 + I, -1 + I}, {1/2 + 5 I/2, -1 + I, 7/2 - I/2}};

Eigensystem[mat]


Gives:

{{6, 3 + 3 I, 3 - 3 I}, {{1, -2, 1}, {1, 1, 1}, {-1, 0, 1}}}


\begin{array}{ccc} 6 & 3+3 i & 3-3 i \\ \{1,-2,1\} & \left\{1,1,1\right\} & \{-1,0,1\} \\ \end{array}

-