tags:

views:

57

answers:

1

How does R represent complex eigenvectors? For example:

> eigen(matrix(c(2,1,0,2),2,2))
$values
[1] 2 2
$vectors
[,1]          [,2] 
[1,]    0  4.440892e-16
[2,]    1 -1.000000e+00

This does not indicate that eigenvector is complex. So how can I determine if eigenvector returned by R is real or not?

+3  A: 

In your example matrix, the eigenvectors/eigenvalues are all real. Here's an example of complex numbers:

R> eigen(matrix(runif(16),4,4))
$values
[1]  1.5121+0.0000i -0.3047+0.2981i -0.3047-0.2981i -0.1300+0.0000i

$vectors
          [,1]            [,2]            [,3]       [,4]
[1,] 0.4991+0i -0.5511+0.0000i -0.5511+0.0000i -0.2186+0i
[2,] 0.6880+0i  0.2158+0.4949i  0.2158-0.4949i -0.8228+0i
[3,] 0.4389+0i  0.4253+0.1411i  0.4253-0.1411i  0.5096+0i
[4,] 0.2914+0i -0.0639-0.4471i -0.0639+0.4471i  0.1249+0i

You can always check for complex number using:

R> is.complex(1+2i)
[1] TRUE
Amro
@saminny: given `det(A-lambda*I)=0` we find `lambda=2`. Substitute it in `A*X=lambda*X` and you get `x=0 y=?`. Since the eigenvectors are scaled to have norm=1, you get `y=1/-1`. I'm assuming that because of rounding error you get that small epsilon value close to zero. BTW the eigen-decomposition is usually implemented using the QR algorithm, not the way you're suggesting..In any case, we can verify the result by checking if A*X = lambda*X: `A <- matrix(c(2,1,0,2),2,2)` `ev <- eigen(A)` `A%*%ev$vectors - ev$values*ev$vectors`
Amro