javaeigenvalueeigenvectorjama

Different eigenvectors from Wolfram, Octave, Jama


I have the following matrix

M = 
       1  -3   3
       3  -5   3
       6  -6   4

WolframAlpha command eigenvalues {{1,-3, 3}, {3, -5, 3}, {6, -6, 4}} produces the following eigenvalues:

lambda_1 = 4
lambda_2 = -2
lambda_3 = -2

And the following eigenvectors:

v_1 = (1, 1, 2)
v_2 = (-1, 0, 1)
v_3 = (1, 1, 0)

However, Octave command [V,D]= eig(M) gives me the following eigenvalues and eigenvectors:

    V =
      -0.40825 + 0.00000i   0.24400 - 0.40702i   0.24400 + 0.40702i
      -0.40825 + 0.00000i  -0.41622 - 0.40702i  -0.41622 + 0.40702i
      -0.81650 + 0.00000i  -0.66022 + 0.00000i  -0.66022 - 0.00000i

    D =
    Diagonal Matrix
       4.0000 + 0.0000i                  0                  0
                      0  -2.0000 + 0.0000i                  0
                      0                  0  -2.0000 - 0.0000i

And, Jama gives me the following for eigenvalues:

    4   0   0
    0  -2   0
    0   0  -2

And the following eigenvectors:

      -0.408248  -0.856787  -0.072040
      -0.408248  -0.650770  -1.484180
      -0.816497   0.206017  -1.412140

The Octave and Jama results appear to be different from each other and from the Wolfram results -- Octave even producing complex eigenvectors, while eigenvalues agree in all three methods.

Any explanation on the discrepancies, and as to how to interpret the Octave and Jame results to match with Wolfram result?

Please note that the hand calculation given at http://algebra.math.ust.hk/eigen/01_definition/lecture2.shtml agrees with the Wolfram result.

Thank a lot for your help.


Solution

  • All 3 answers are correct.

    The eigenvector corresponding to 4 can be any multiple of (1, 1, 2). In other words, as long as the first two values are the same and the third number is twice as big, it's an eigenvector.

    Both

    (-0.40825 + 0.00000i, -0.40825 + 0.00000i, -0.81650 + 0.00000i)
    

    and

    (-0.408248, -0.408248, -0.816497)
    

    are of this form.

    The eigenvalue -2 is repeated. Therefore the eigenspace corresponding to the eigenvalue -2 is two-dimensional. This means that it is far harder to see that the answers are equivalent.

    The simplest way to describe the 2D space generated by the two eigenvectors (1, 1, 0) and (1, 0, -1) is the set of all vectors (a, b, c) satisfying

    a - b + c = 0
    

    It is easy to check that all 6 eigenvectors found for -2 are of this form.

    It is a bit pathetic that Octave gave the answers as complex numbers, when a real solution exists, but it is not actually wrong.