MATLAB Answers

Why isn't eig returning all eigenvectors?

44 views (last 30 days)
Tobias
Tobias on 27 Oct 2020 at 10:52
Edited: Bruno Luong on 27 Oct 2020 at 13:13
I have a matrix in Matlab, that can be created by the following commands
c = 3; t = 3; l = 4;
A = [l*ones(c), -ones(c,t*l); -l*ones(t*l,c), kron(eye(l), l*ones(t))];
By the special block structure of A and for given parameter values c,t,l, the eigenvalue 0 should appear with multiplicity 11. This is also what I get when I compute the dimension of the nullspace of A:
size(null(A))
ans =
15 11
Now, I use eig to calculate all eigenvalues and eigenvectors of A. The eigenvalue 0 appears with multiplicity 11, too:
[V,D] = eig(A);
d = diag(D); [d,I] = sort(d); V = V(:,I); %sort eigenvalues in ascending order and rearrange eigenfunctions accordingly
transpose(d)
ans =
-0.0000 -0.0000 0 0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.0000 12.0000 12.0000 24.0000
That means that the first 11 columns of V are now the eigenvectors of the eigenvalue 0. However, my problem is that the eigenfunctions of the eigenvalue 0 are linearly dependent, i.e.
rank(V(:,1:11))
ans =
8
So why did eig only return 8 linearly independent vectors, even though there are 11? Of course I could just use null(A), to obtain all eigenvectors, but I try to understand the behavior of eig.

  0 Comments

Sign in to comment.

Accepted Answer

Bruno Luong
Bruno Luong on 27 Oct 2020 at 11:42
Edited: Bruno Luong on 27 Oct 2020 at 11:44
When you have multiple-order eigen value(s), the number of eigen vectors is not necessary equal to the order.
Much simpler example is:
A=[0 1;
0 0]
Only [1; 0] is eigen vector .
You can read about Jordan-form to better understand about the "eigen-classification" of matrices.
Caveat: Jordan form calculation is unstable wrt numerical errors, so the result might vary when you do numerical calculation such as RANK, EIG, etc... But it explains why the number of eigen vectors returned are some time dependent when the matrix has multiple-order eigen value(s).

  2 Comments

Tobias
Tobias on 27 Oct 2020 at 11:55
I cannot accept your example, because for your example
>> A=[0 1; 0 0];
null(A)
ans =
-1
0
So I agree that the dimension of the nullspace is only one-dimensional here.
But in my example, the multiple-order of the eigenvalue 0 does equal the number of eigenvectors. The multiple order is 11, simply because 0 appears 11 times in the vector d. The number of eigenvectors is also 11, as I have proved by calculating the nullspace of the matrix A. It is 11-dimensional, meaning that there exist 11 linearly independent vectors.
Bruno Luong
Bruno Luong on 27 Oct 2020 at 12:18
Read again "Caveat...". You can't hardly "prove" anything robust using numerical calculation.
Here is another example more complicated
A=[1 0 0;
0 0 1e-16;
0 0 0]
>> null(A)
ans =
0 0
0 -1
1 0
>> [V,D]=eig(A)
V =
1.0000 0 0
0 1.0000 -1.0000
0 0 0.0000
D =
1 0 0
0 0 0
0 0 0
>> rank(V(:, abs(diag(D)) < eps))
ans =
1
The first vector of NULL(A) is incorrect theoretically (in infinity precision calculation). But EIG somehow manages to catch it.
Which one is correct? EIG. Because it due to the fact that A(2:3,2:3) has a Jordan form similar to my previous example. (I scale it down in order to fool NULL)
You can argue EIG catches by chance, and prefer NULL result. But nonetheless Jordan form explains such discrepency of the results, and not any bug as you seem to imply.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!