How to obtain right eigenvectors of matrix in R?

Qbik picture Qbik · Feb 16, 2013 · Viewed 11.1k times · Source

Edition : the problem in my question was I've tried to find matrix S from equation 8 but this equation have error.

How to directly obtain right eigenvectors of matrix in R ? 'eigen()' gives only left eigenvectors

Really last edition, I've made big mess here, but this question is really important for me :

eigen() provides some matrix of eigenvectors, from function help :

" If ‘r <- eigen(A)’, and ‘V <- r$vectors; lam <- r$values’, then

                      A = V Lmbd V^(-1)                         

(up to numerical fuzz), where Lmbd =diag(lam)"

that is A V = V Lmbd, where V is matrix now we check it :

set.seed(1)
A<-matrix(rnorm(16),4,4)
Lmbd=diag(eigen(A)$values)
V=eigen(A)$vectors
A%*%V

> A%*%V
                      [,1]                  [,2]          [,3]           [,4]
[1,]  0.0479968+0.5065111i  0.0479968-0.5065111i  0.2000725+0i  0.30290103+0i
[2,] -0.2150354+1.1746298i -0.2150354-1.1746298i -0.4751152+0i -0.76691563+0i
[3,] -0.2536875-0.2877404i -0.2536875+0.2877404i  1.3564475+0i  0.27756026+0i
[4,]  0.9537141-0.0371259i  0.9537141+0.0371259i  0.3245555+0i -0.03050335+0i
> V%*%Lmbd
                      [,1]                  [,2]          [,3]           [,4]
[1,]  0.0479968+0.5065111i  0.0479968-0.5065111i  0.2000725+0i  0.30290103+0i
[2,] -0.2150354+1.1746298i -0.2150354-1.1746298i -0.4751152+0i -0.76691563+0i
[3,] -0.2536875-0.2877404i -0.2536875+0.2877404i  1.3564475+0i  0.27756026+0i
[4,]  0.9537141-0.0371259i  0.9537141+0.0371259i  0.3245555+0i -0.03050335+0i

and I would like to find matrix of right eigenvectors R,
equation which define matrix of left eigenvectors L is :

L A  = LambdaM L

equation which define matrix of right eigenvectors R is :

A R = LambdaM R

and eigen() provides only matrix V:

A V = V Lmbd

I would like to obtain matrix R and LambdaM for real matrix A which may be negative-definite.

Answer

Ben Bolker picture Ben Bolker · Feb 16, 2013

A worked example.

Default (= right eigenvectors):

m <- matrix(1:9,nrow=3)
e <- eigen(m)
e1 <- e$vectors
zapsmall((m %*% e1)/e1) ## right e'vec
##          [,1]      [,2] [,3]
## [1,] 16.11684 -1.116844    0
## [2,] 16.11684 -1.116844    0
## [3,] 16.11684 -1.116844    0

Left eigenvectors:

eL <- eigen(t(m))    
eL1 <- eL$vectors

(We have to go to a little more effort since we need to be multiplying by row vectors on the left; if we extracted just a single eigenvector, R's ignorance of row/column vector distinctions would make it "do the right thing" (i.e. (eL1[,1] %*% m)/eL1[,1] just works).)

zapsmall(t(eL1) %*% m/(t(eL1)))
##          [,1]      [,2]      [,3]
## [1,] 16.116844 16.116844 16.116844
## [2,] -1.116844 -1.116844 -1.116844
## [3,]  0.000000  0.000000  0.000000