# how to get a specific eigenvector only for a given eigenvalue of a matrix say of order 2 by 2 or 3 by 3?

Anonymous

how to get a specific eigenvector only for a given eigenvalue of a matrix say of order 2 by 2 or 3 by 3?

edit retag close merge delete

Sort by » oldest newest most voted

You should better provide concrete examples so that we understand your question.

Let us first create a 3 by 3 random matrix:

sage: m = random_matrix(QQ,3,3) ; m
[  -2    1   -2]
[   0    0   -2]
[   0    0 -1/2]


We can find its eigenvalues:

sage: L = m.eigenvalues() ; L
[0, -1/2, -2]


Then, if the interesting one is -1/2, let us find its position in the list:

sage: L.index(-1/2)
1


According to the documentatnion of m.eigenvectors_right, we can find the list of rignt eigenvectors as a list of tuples "(e,V,n) where e is the eigenvalue, V is a list of eigenvectors forming a basis for the corresponding right eigenspace, and n is the algebraic multiplicity of the eigenvalue.":

sage: m.eigenvectors_right()
[(0, [
(1, 2, 0)
], 1), (-1/2, [
(1, 3, 3/4)
], 1), (-2, [
(1, 0, 0)
], 1)]


The are ordered in the same way as with m.eigenvalues(), so we can find the tuple associated to the eigenvalue -1/2 as follows;

sage: m.eigenvectors_right()[L.index(-1/2)]
(-1/2, [
(1, 3, 3/4)
], 1)


We want an eigenvector, so the second entry (with index 1) of this tuple is interesting:

sage: m.eigenvectors_right()[L.index(-1/2)][1]
[
(1, 3, 3/4)
]


SInce we do only want one eigenvector (not the whole basis), let us pick the first entry (with index 0):

sage: m.eigenvectors_right()[L.index(-1/2)][1][0]
(1, 3, 3/4)

more

Thank you.

( 2017-08-10 11:58:06 +0100 )edit

One can go directly for the corresponding kernel. For instance:

sage: A = matrix( QQ, 3,3, [4,1,1, 1,4,1, 1,1,4] )
sage: A
[4 1 1]
[1 4 1]
[1 1 4]

sage: E = matrix.identity( A.nrows() )
sage: A.eigenvalues()
[6, 3, 3]

sage: ( A - 3*E ).kernel().basis()
[
(1, 0, -1),
(0, 1, -1)
]

more