How to find eigenvectors?

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

回答(4 个)

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 个评论

Why do the values of V are decimal? i'm confused by that, I tried to do it by hand but got stuck at some point.
Why not? Eigenvectors are seldom integers, and you are proceeding numerically so you are going to get numeric values with decimal points.
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.

请先登录,再进行评论。

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 个评论

I tried this method https://www.mathsisfun.com/algebra/eigenvalue.html but the results aren't same with matlab
Did you end up with different eigenvalues?
A = [
-2 0 2
2 -1 5
0 0 1 ]
A = 3×3
-2 0 2 2 -1 5 0 0 1
syms x
EV = solve(det(A - x*eye(3)))
EV = 
No, I found the same eigenvalues.
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 = 
By the way, the V returned by matlab has the property that norm() of each column is 1.

请先登录,再进行评论。

RoBoTBoY
RoBoTBoY 2021-1-7

0 个投票

Thanks for your answers! they helped me

11 个评论

I think that I know how to answer your question. As I myself do, you are probably wondering why on earth does Matlab need to normalize the eigenvectors. I really don't have any clue. But one should expect to find the true eigenvalues (say lambda's) and the corresponding eigenvectors (say v's).
To solve your current problem with the given matrix A, one should find that lambda={-2,-1,1} and the corresponding eigenvectors would be v1=[-1 2 0]', v2=[0 1 0]' and v3=[4 19 6]' to form V=[v1 v2 v3].
we can check the answer: A*V-V*D=0, where the diagonal matrix D=[-2 0 0;0 -1 0;0 0 1].
Why does MATLAB need to normalize the eigenvectors? Actually, that does have a good answer.
Normalization makes many computations simpler, IF you can assume the vectors are constructed to have unit norm, so dot(V,V)==1. And since any eigenvector is not unique, we might as well choose a scaling that makes life easy. After all, why would you choose a representation that makes things even slightly more difficult?
Thanks. I can accept your answer but you should admit that the way Matlab does things does not help students to understand how such eigenvectors are found.
No. I'm sorry, but I won't be willing to agree to that. Not even close.
If you are using eigenvectors and eigenvalues, a good idea is to learn about them, but the documentation for eig should not be a complete self contained course in linear algebra. For that, a good course in linear algebra really is probably the best place to start. Or spend some time reading any basic text on linear algebra/numerical linear algebra. There is just no way to answer every possible question a student might have in the documentation to eig.
From the alternative point of view, suppose MathWorks DID write a complete, self contained in-depth course on linear algebra in the help? Surely most users (certainly me, as well as most professionals in the field) would find that a complete waste of time, and not something we would want to dive into just to find the answer to a simple question about the code.
For the student, I'm sorry, but if you don't know how an eigenvector is computed, or why it is normalized in one way or another, there are many sources of that information. Or talk to your teachers, etc. You can even ask questions in an online forum. In fact, that is a common thing on Answers, where we can try to answer a question in a way that is targeted at the problem a student actually had, so much like my own answer on this question.
Mathematica solves this kind of problems just like I did. The output of the command Eigensystem[A] is the list of the eigenvalues along with the corresponding eigenvectors without any scaling factor. If you ever need to normalize anything, you are free to.
Regards.
And, so? How is that relevant? Mathematica scales the eigenvectors as it chooses to scale them. A lack of scaling is STILL an implicit scaling. And it teaches you nothing about eigenvectors. An eigenvector can be scaled in any way you choose.
What does Mathemetica return for this matrix? Make sure to enter exactly as shown with -2.0 in the (1,1) element.
A =[ -2.0 0 2
2 -1 5
0 0 1];
That's a good point. Thanks to both of you @Paul @John D'Errico
Yet what is your point? That a different language produces something different for a result that is completely ambiguous? When ANY scaling would have been as correct? And that if you call the code in subtly different ways, you will get results that appear completely different?
Gosh, I wonder why you are not asking (on a Mathematica forum) why is it that Mathematica produces completely different results, based on nothing more than a decimal point and a zero added to the end of a number.
No matter what you say, normalization is COMPLETELY irrelevant when that normalization is arbitrary. What is the point of your argument?
Why am I wasting any more of my time here? Answer? No reason, so I am done wasting time.
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.
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.

请先登录,再进行评论。

Nirodha Sampath
Nirodha Sampath 2022-9-24

0 个投票

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.

1 个评论

Hi

To compute the frame operator for the given collection of vectors in R3, you will first need to construct the frame operator matrix. Which is defined as the sum of the outer products of the vectors in the collection. So, I will denote the vectors as v1, v2, v3, v4, v5, and v6: v1 = [0, 1, 1] v2 = [1, 1, 2] v3 = [1, -1, 0] v4 = [1, -2, -1] v5 = [-1, 3, 2] v6 = [-2, 4, 2] and then calculate frame operator based on its formula, bear in mind that ‘vi' represents the transpose of vector vi and then after obtaining the frame operator matrix, I can proceed to find its eigenvalues using eig(), for more information on this function, please refer to https://www.mathworks.com/help/matlab/ref/eig.html. So, let me illustrate computing frame operator matrix like this

% Define the vectors

v1 = [0, 1, 1];

v2 = [1, 1, 2];

v3 = [1, -1, 0];

v4 = [1, -2, -1];

v5 = [-1, 3, 2];

v6 = [-2, 4, 2];

% Compute the frame operator matrix

F = zeros(3,3);

for i = 1:6

    vi = eval(['v', num2str(i)]);
    F = F + vi' * vi;

end

disp('Frame Operator Matrix:');

disp(F);

After obtaining the frame operator matrix, proceed to final steps to find its eigenvalues.

% Compute the eigenvalues of the frame operator

eigenvalues = eig(F);

disp('Eigenvalues of the Frame Operator:');

disp(eigenvalues);

Hope this answers your question.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Linear Algebra 的更多信息

提问:

2021-1-6

评论:

2024-8-3

Community Treasure Hunt

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

Start Hunting!

Translated by