I have a matrix 100x100 and I found it's biggest eigenvalue. Now I need to find eigenvector corresponding to this eigenvalue. How can I do this?
Asked
Active
Viewed 1.4k times
7
-
Solutions provided here return you all eigenvalues and all eigenvectors, which is an overkill, as you stated that you have already found the largest eigenvalue and just want the eigenvector for that. See section "How to find eigenvectors using textbook method" in [my this answer](https://stackoverflow.com/a/52458862/4891738). – Zheyuan Li Oct 16 '18 at 22:33
2 Answers
11
eigen
function doesn't give you what you are looking for?
> B <- matrix(1:9, 3)
> eigen(B)
$values
[1] 1.611684e+01 -1.116844e+00 -4.054214e-16
$vectors
[,1] [,2] [,3]
[1,] -0.4645473 -0.8829060 0.4082483
[2,] -0.5707955 -0.2395204 -0.8164966
[3,] -0.6770438 0.4038651 0.4082483

Jilber Urbina
- 58,147
- 10
- 114
- 138
-
no, I think not. For example, for your matrix, I know eigenvalue 1.611684e+01 and I what to find eigenvector for this eigenvalue, not all the three – user2080209 May 20 '13 at 14:35
-
3@user2080209: What makes you think the eigenvectors are not in the same order as the eigenvalues? – IRTFM May 20 '13 at 14:50
-
@user2080209, `eig <- eigen(B); eig$vectors[eig$values == 1.611684e+01]` will select the appropriate eigenvector – huon May 20 '13 at 14:52
3
Reading the actual help of the eigen function state that the $vectors
is a :
"a p*p matrix whose columns contain the eigenvectors of x."
The actual vector corresponding to the biggest eigen value is the 1st column of $vectors
.
To directly get it:
> B <- matrix(1:9, 3)
> eig <- eigen(B)
> eig$vectors[,which.max(eig$values)]
[1] -0.4645473 -0.5707955 -0.6770438
# equivalent to:
> eig$vectors[,1]
[1] -0.4645473 -0.5707955 -0.6770438
Note that the answer of @user2080209 does not work: it would return the first row.

zetieum
- 151
- 4