# missing eigenvector when using eig on defective matrix

10 views (last 30 days)
Robert Deegan on 11 Feb 2022
Commented: Robert Deegan on 11 Feb 2022
Hi,
I am puzzled by a seemingly missing eigenvector.
M=[[2, 0, 0];[-6,4,4];[3,-1,0]];
[v,e]=eig(M)
v = 3×3
0 0 0.0000 0.8944 0.8944 0.8944 -0.4472 -0.4472 -0.4472
e = 3×3
2.0000 0 0 0 2.0000 0 0 0 2.0000
Ignoring the 0.0000, eig returns three identical eigenvectors. But I find the following independent eigenvectors
e1=[2;0;3];
e2=[0;2;-1];
M*[e1,e2]-2*[e1,e2]
ans = 3×2
0 0 0 0 0 0
Is it that v[1,3] is not really zero?
v(1,3)
ans = 3.8780e-17

Christine Tobler on 11 Feb 2022
The short answer is that this is a case where a small change in the input matrix has a large effect on the eigenvectors being computed. Like a lot of numerical linear algebra, the algorithm in EIG is backward stable, meaning it gives a solution which is accurate for a matrix that is a little different from the original input.
We can see this quickly by looking at the condition of the eigenvalues of M:
M=[[2, 0, 0];[-6,4,4];[3,-1,0]];
condeig(M)
ans = 3×1
1.0e+16 * Inf 1.8014 2.5787
So what's going on inside of EIG? The first step, unless the 'nobalance' option was chosen, is that the input matrix is balanced (a similarity transformation is applied which may make it easier to solve if it's badly scaled). Not much effect on this matrix, but I'll do it so we keep matching the output of EIG:
[S,P,B] = balance(M)
S = 3×1
1.0000 1.0000 0.5000
P = 3×1
3 2 1
B = 3×3
0 -2 6 2 4 -6 0 0 2
In the next step, the Schur decomposition of B is computed. This consists of an orthogonal matrix U and a (mostly) triangular matrix T (mostly because it can have 2-by-2 blocks on its diagonal), which are equal to M up to round-off. And this is the most obviously visible place where an error on the level of round-off is introduced into M:
[U, T] = schur(B);
U*T*U' - B
ans = 3×3
1.0e+-15 * -0.3331 0.4441 0.8882 0 -0.4441 0 0 0 0
That error is fine in terms of backward error, since the original input has only been perturbed on the level of round-off. But if we now look at the exact eigenvalues (using symbolic toolbox) of M and T, we'll see they don't match up at all:
[VM, DM] = eig(sym(M, 'f'))
VM = DM = [VT, DT] = eig(sym(T, 'f'))
VT = DT = And here we find the same case you saw in the original call to EIG, where both eigenvectors of T are nearly the same numerically speaking. So that small round-off error that's introduced during the computation of EIG has a large effect on the eigenvalues and eigenvectors of M. This can be the case for some matrices, in particular ones with multiple and defective eigenvectors, and condeig is the best way to find out about it.
Robert Deegan on 11 Feb 2022
Thank you.

### Categories

Find more on Linear Algebra in Help Center and File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!