Getting an eigenvector from a particular matrix using an RREF algorithm

62 Views Asked by At

Using Wolfram's software, I have been debugging some code that returns the eigenvalues of a matrix and the eigenvector corresponding to the largest of them. My code works by using a QR algorithm (similar to the one used by JAMA) to produce the eigenvalues and then a simple RREF with back-substitution algorithm to solve $(A-\lambda_{1} I) x=0$. My goal is to create an algorithm that can find the eigenvalues/vectors of any real matrix, if possible.

The code I wrote works flawlessly for every sample matrix I've tried except for one. My program calculated all of the correct eigenvalues, but did not produce the correct RREF matrix. Can anyone tell me what properties make this specific matrix different from the rest and if there is some other process that I should be using instead? If there are multiple procedures for doing this, is there a list of conditions that a computer can use to decide which to perform? (Note: I am very new to this field, so please be patient if I am not familiar with the vocabulary).

Matrices that work:

[  1.00   2.00   3.00 ]
[  3.00   2.00   1.00 ]
[  2.00   1.00   3.00 ]

[  4.00   5.00   0.00 ]
[  1.00   5.00   7.00 ]
[  6.00   2.00   9.00 ]

[  2.00   3.00   4.00 ]
[  4.00   3.00   2.00 ]
[  3.00   2.00   4.00 ]

[  52.00   30.00   49.00   28.00 ]
[  30.00   50.00   8.00   44.00 ]
[  49.00   8.00   46.00   16.00 ]
[  28.00   44.00   16.00   22.00 ]

[  1.00   2.00   1.00 ]
[  0.00   2.00   2.00 ]
[ -3.00   2.00   5.00 ]

The one that doesn't work:

[  9.00  -1.00   2.00 ]
[ -2.00   8.00   4.00 ]
[  1.00   1.00   8.00 ]

Incorrect RREF matrix generated by code:

[  1.00   1.00  -2.00  -0.00 ]
[  0.00   0.00  -0.00   0.00 ]
[  0.00  -0.00  -0.00   0.00 ]

Incorrect eigenvector generated by code:

[ -2.00 ]
[  3.00 ]
[  1.00 ]

If requested, I can provide the steps that the algorithm took to get the answer, but I believe this must be due to some property of the matrix that I am not familiar with.

1

There are 1 best solutions below

3
On BEST ANSWER

The RREF is in fact correct. It looks like you haven’t taken into account that an eigenspace might not be one-dimensional. From this RREF we can read that every eigenvector of $10.0$ is a nonzero linear combination of $(1.00,-1.00,0.00)^T$ and $(-2.00,0.00,-1.00)^T$.