Linear Algebra Powertool
Eigenvectors and Eigenvalues
Online 6.1
Worksheet by Russell Blyth
Goals of this worksheet:
1) Compute eigenvalues and eigenvectors for several 3 x 3 matrices.
2) Use eigenvectors and eigenvalues to simplify a matrix computation.
> restart:with(plots):with(linalg):
Warning, the name changecoords has been redefined
Warning, the protected names norm and trace have been redefined and unprotected
Computing Eigenvalues and Eigenvectors
First define a matrix and the identity of the same size.
>
A := matrix(3,3,[[-1,0,5],[0,4,0],[5,0,-1]]);
I3 := evalm(array(identity,1..3,1..3));
Compute the characteristic polynomial, which is det(A - x*I3)
> chpol := det(A - x*I3);
Set equal to zero and solve.
> AEvals := solve(chpol = 0,x);
Compute the first eigenspace.
> AEspace1 := linsolve(A-AEvals[1]*I3,[0,0,0]);
Extract the basis vector(s)
> AEbasis1 := [subs(_t[1]=1, op(AEspace1))];
Repeat for the second eigenvalue
> AEspace2 := linsolve(A-AEvals[2]*I3,[0,0,0]);
We have two parameters this time.
>
AEbasis2 := [subs(_t[1]=1,_t[2]=0, op(AEspace2)),
subs(_t[1]=0,_t[2]=1, op(AEspace2))];
Check that these eigenspace basis vectors are in fact eigenvectors of A
>
evalm(A &* AEbasis1[1]);
evalm(A &* AEbasis2[1]);
evalm(A &* AEbasis2[2]);
Note that these vectors are the correct multiples of the eigenvectors.
Exercises:
1) Follow the recipe above to find the eigenvalues and eigenvectors of the matrix B.
> B := matrix(3,3,[[0,1,1],[0,2,0],[-2,1,3]]);
2) Repeat for the matrix C.
> C := matrix(3,3,[[4,-3,1],[4,-1,0],[1,7,-4]]);
When you are done: what can you say about the matrix C?
Maple has a command for carrying out all of the above operations at once.
> eigenvectors(A);
We get a set of triples, where the first entry of each triple is an eigenvalue, the second entry is its multiplicity as a root of the characteristic polynomial, and the third entry is a basis for the eigenspace corresponding to that eigenvector. We can extract this data if we first place these two triples into a sequence.
> evA := [eigenvectors(A)];
The eigenvalues:
> evA[1][1]; evA[2][1];
The eigenvectors:
> evA[1][3][1]; evA[2][3][1]; evA[1][3][2];
If you ge an error here, it's because Maple decided to list the eigenvalues in a different order than it did when I wrote the worksheet - fix the problem by editing the command line.
>
Using eigenvalues and eigenvectors to ease computation
We'll easily compute
* X where X =
First note that the three eigenvectors which we computed earlier form a basis for
>
AEMat := augment(AEbasis1[1],AEbasis2[1],AEbasis2[2]);
rank(AEMat);
Now find the coefficients of X with respect to the basis above.
>
X := vector(3,[2,3,-1]);
Xcvec := linsolve(AEMat,X);
Now
* X is computed as follows:
>
evalm(Xcvec[1]*AEvals[1]^25*AEbasis1[1]
+ Xcvec[2]*AEvals[2]^25*AEbasis2[1]
+ Xcvec[3]*AEvals[2]^25*AEbasis2[2]);
Note that this calculation involved no matrix multiplications. What advantage might this have?
Maple will actually compute directly, so let's check.
> evalm(A^25 &* X);
Exercise:
3) Compute
* X (X as above) using eigenvalues and eigenvectors. Check by direct computation. (Note we cannot use this technique for powers of C, since we can't find a basis of eigenvectors of C.)
>
>