How to find eigenvectors?

1,025 views (last 30 days)
RoBoTBoY
RoBoTBoY on 6 Jan 2021
Answered: Nirodha Sampath on 24 Sep 2022
Hello!!
I have this matrix:
A =
-2 0 2
2 -1 5
0 0 1
I have found the eigenvalues and I want to find the eigenvectors
The eigenvalues are -2 -1 and 1.
How to find eigenvectors?
I used this function [V,D] = eig(A) but the results of V seem strange to me.
Thanks in advance

Answers (4)

John D'Errico
John D'Errico on 6 Jan 2021
Edited: John D'Errico on 6 Jan 2021
Why does V seem strange?
A = [-2 0 2
2 -1 5
0 0 1 ];
[V,D] = eig(A)
V = 3×3
0 0.4472 0.1968 1.0000 -0.8944 0.9349 0 0 0.2952
D = 3×3
-1 0 0 0 -2 0 0 0 1
The columns of V are eigenvectors. They are normalized to have unit 2-norm. So I'm not sure what you are asking.
If you multiply them with A, as in
A*V(:,2)
ans = 3×1
-0.8944 1.7889 0
How does that compare to
D(2,2)*V(:,2)
ans = 3×1
-0.8944 1.7889 0
norm(A*V - V*D)
ans = 2.2204e-16
Ah, now I know what bothers you. You were expecting an orthogonal set of vectors...
  3 Comments
Walter Roberson
Walter Roberson on 6 Jan 2021
Why not? Eigenvectors are seldom integers, and you are proceeding numerically so you are going to get numeric values with decimal points.
John D'Errico
John D'Errico on 7 Jan 2021
Why would you expect that all numbers are always going to be integers? Probably because in your class, your teacher showed you only simple integer vectors and arrays. But real world problems are rarely simply composed of integers.
In fact, eigenvectors from eig are normalized (as I said in my answer) to have a Euclidean norm of 1. That means unless the eigenvector is a very rare case, it will NEVER be entirely composed of integers as it is returned by eig. Consider this matrix, and its eigenvectors.
A = [-2 0 2
2 -1 5
0 0 1];
[V,D] = eig(A);
V(:,2)
ans = 3×1
0.4472 -0.8944 0
I said the columns of V are eigenvectors. Is that true?
V2 = V(:,2)
V2 = 3×1
0.4472 -0.8944 0
A*V2
ans = 3×1
-0.8944 1.7889 0
Since when I multiply by V2, it multiplies V2 by 2, this is an eigenvector. Can we scale V2 arbitrarily, so that it is composed of integers? In this case, we may be able to do that.
V2new = V2/V2(1)
V2new = 3×1
1 -2 0
Is it still true that V2 is an eigenvector? Yes, in the sense that A*V2new=2*V2new is still true. V2new is not normalized to have unit norm though.
A*V2new
ans = 3×1
-2 4 0
And since eig returns UNIT normalized eigenvectors, you will almost always see numbers that are not whole numbers. Only in the rare case like the first eigenvector, where we saw this:
V(:,1)
ans = 3×1
0 1 0
will an eigenvector happen to be composed of purely integers.

Sign in to comment.


Walter Roberson
Walter Roberson on 6 Jan 2021
format long g
A = [
-2 0 2
2 -1 5
0 0 1 ]
A = 3×3
-2 0 2 2 -1 5 0 0 1
[V, D] = eig(A)
V = 3×3
0 0.447213595499958 0.196827132522049 1 -0.894427190999916 0.934928879479734 0 0 0.295240698783074
D = 3×3
-1 0 0 0 -2 0 0 0 1
A*V
ans = 3×3
0 -0.894427190999916 0.196827132522049 -1 1.78885438199983 0.934928879479734 0 0 0.295240698783074
V*D
ans = 3×3
0 -0.894427190999916 0.196827132522049 -1 1.78885438199983 0.934928879479734 0 0 0.295240698783074
A*V - V*D
ans = 3×3
0 0 0 0 0 2.22044604925031e-16 0 0 0
So the values do satisfy the required conditions. But perhaps you would prefer a different normalization?
Vnorm = V ./ max(abs(V),[],1)
Vnorm = 3×3
0 0.5 0.210526315789474 1 -1 1 0 0 0.315789473684211
A*Vnorm - Vnorm * D
ans = 3×3
0 0 2.77555756156289e-17 0 0 2.22044604925031e-16 0 0 0
You might prefer a different normalization yet. Note that the columns are in a different order than above.
[V,D] = eig(sym(A))
V = 
D = 
  5 Comments
Walter Roberson
Walter Roberson on 6 Jan 2021
Are you aware that eigenvectors are not unique? Multiplying them or dividing them by any constant gives another eigenvector of the same class?
format long g
A = [
-2 0 2
2 -1 5
0 0 1 ]
A = 3×3
-2 0 2 2 -1 5 0 0 1
[V, D] = eig(A)
V = 3×3
0 0.447213595499958 0.196827132522049 1 -0.894427190999916 0.934928879479734 0 0 0.295240698783074
D = 3×3
-1 0 0 0 -2 0 0 0 1
v = V(:,3);
sym(v./v(3) * 6)/6
ans = 
sym(v./v(2) * 57)/57
ans = 
sym(v./v(1) * 3)/3
ans = 
Walter Roberson
Walter Roberson on 6 Jan 2021
By the way, the V returned by matlab has the property that norm() of each column is 1.

Sign in to comment.


RoBoTBoY
RoBoTBoY on 7 Jan 2021
Thanks for your answers! they helped me
  11 Comments
Paul
Paul on 13 Aug 2022
As we can see, Mathematica has some internal logic to determine how Eigensystem should proceed based on the type of the input. Matlab basically pushes that logic onto the user. That is, if a "nice" solution is desired, then use a sym input, as @Walter Roberson showed in this answer. For what Mathematica calls the exact or symbolic case, It looks like it takes the extra step of multiplying each eigenvector by the gcd (at least for this example), which the user can do in Matlab as well if using sym. So Matlab does provide the same functionality as Mathematica, but because there will always be an arbitrary scale factor floating around for each eigenvector, it is always up to the user to scale the results as may be desired, for either double or sym inputs. The same is true for Mathematica as well.
m tikhemine
m tikhemine on 13 Aug 2022
Thank you very much @Paul
As regards to you @John D'Errico, please don't ever answer any of my future questions until you would change your mood and get quiet.

Sign in to comment.


Nirodha Sampath
Nirodha Sampath on 24 Sep 2022
Compute the frame operator for the collection {0,1,1}, {1,1,2}, {1,-1,0}, {1,-2,-1}, {-1,3,2}, {-2,4,2} in R3. Use matlab to find its eigenvalues.

Community Treasure Hunt

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

Start Hunting!