Obtain eigenvalue from matrix and known eigenvector
2 views (last 30 days)
Show older comments
Henry Shackleton
on 9 Jun 2019
Edited: John D'Errico
on 10 Jun 2019
I have a matrix A and a known eigenvector x. I am struggling to come up with an way of obtaining the eigenvalue of x with a relatively simple operation. One option is the following code:
A*x./x
However, this has problems when x contains any 0 entries. Is there any easy way of accomplishing this?
0 Comments
Accepted Answer
John D'Errico
on 10 Jun 2019
Edited: John D'Errico
on 10 Jun 2019
The simple answer, as long as the vector x IS an eigenvector. is just:
val = norm(A*x)/norm(x);
You should see that this is not a problem if x has some zero entries, as long as x is not the vector that is entirely zero.
If x is not an eigenvector, then of course it won't work, but we are told that x is an eigenvector so there is no problem. Ok, it does assume that the eigenvalue in question is real. If that is an issue, then a simple solution is still available. For example:
A = rand(5);
[V,D] = eig(A);
diag(D)
ans =
2.80100746971912 + 0i
0.396075677494192 + 0.0659443099214011i
0.396075677494192 - 0.0659443099214011i
-0.322864111476007 + 0i
-0.285307095833035 + 0i
Now, can we recover the first eigenvalue? It is real.
norm(A*V(:,1))/norm(V(:,1))
ans =
2.80100746971912
Of course, that will fail for the second eigenvalue. But only you know if the eigenvalues and eigenvectors are real in your problem.
Just pick the largest element in magnitude of the corresponding eigenvector.
V2 = V(:,2);
[~,ind] = max(abs(V2));
Av2 = A*V2;
val = Av2(ind)/V2(ind)
val =
0.396075677494192 + 0.0659443099214012i
Indeed, we have recovered the eigenvalue. Again, this is not a problem if the eigenvector has SOME zero elements, because I picked a specific element that is known to be non-zero.
0 Comments
More Answers (1)
David Goodmanson
on 10 Jun 2019
Edited: David Goodmanson
on 10 Jun 2019
Hi Henry,
you can find the indices where x = 0 and cast those entries out of both x and the corresponding rows and columns of A.
x1 = x; % temporary copies
A1 = A;
ind = x1==0;
x1(ind) = [];
A1(:,ind) = [];
A1(ind,:) = [];
(A1*x1)./x1
In practice, the zero check might have to be something like ind = abs(x) < 1e-6 or whatever an appropriate tolerance would be.
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!