Session 09
More linear algebra: eigenvalues, eigenvectors, and diagonalization
There are a variety of ways to compute eigenvalues and eigenvectors. The thing to keep in mind is that the shortest “built–in” commands do not always work. You may need to write your own commands to perform the calculation.
> with(linalg):
> A:=matrix([[3,2],[2,0]]);
We obtain the characteristic polynomial of A.
> Al:=charmat(A,lambda); # construct the characteristic matrix
> det(Al);
Here is a more direct method.
> charpoly(A, lambda);
We now find the eigenvalues of A.
> evals:=solve(%=0,lambda);
Here's a quicker way to find the eigenvalues. Be aware that this command may not always return all the eigenvalues.
> eigenvals(A);
We now find the corresponding eigenvectors. The answer is given as a basis for the eigenspace.
> nullspace(evals[1]-A); # compute a basis for the nullspace (kernel) of a Matrix
> nullspace(evals[2]-A);
Here we summarize our results.
> for i from 1 to 2 do
print(evals[i],nullspace(evals[i]-A)) od;
There is a quick and dirty way to get the same result. Again, it should be noted that this command will not always give a satisfactory answer.
> eigenvects(A);
Another example.
> B:=matrix([[2,2],[2,0]]);
> eigenvects(B);
> cvals:=eigenvals(B);
> for i from 1 to 2 do
print(cvals[i], nullspace(cvals[i]-B)) od;
Recall that an n x n matrix S is diagonalizable if and only if there are n linearly independent eigenvectors. If we place the eigenvectors in the columns of the matrix P, then inv(P) S P is a diagonal matrix with entries the eigenvalues of S. The next few commands illustrate how one may construct P.
> S:=matrix([[ 4,-1,1],[-1,4,-1],[1,-1,4]]);
> evals:=eigenvals(S);
> for i from 1 to 3 do
evec[i]:=nullspace((evals[i]-S))
od;
> P:=augment(op(evec[1]),op(evec[2]));
> evalm(inverse(P) &*S &* P);
Exercises
1) Given the matrix A:=matrix(2,2,[1,-1,2,-1]);
a. Find the characteristic polynomial.
b. Find the eigenvalues and corresponding eigenvectors.
c. Decide whether A is diagonalizable. If it is find P so that P^-1*A*P is diagonal.
d. Show that A satisfies its characteristic equation.
2) Given the matrix B:=matrix(3,3,[[1,-3,3],[3,-5,3],[6,-6,4]]);
a. Find the characteristic polynomial
b. Find the eigenvalues and corresponding eigenvectors
c. Decide whether B is diagonalizable. If it is find P so that P^-1*B*P is diagonal.
3) Given the matrix C:=matrix(3,3,[[-3,1,-1],[-7,5,-1],[-6,-6,-2]]);
a. Find the characteristic polynomial
b. Find the eigenvalues and corresponding eigenvectors
c. Decide whether C is diagonalizable. If it is find P so that P^-1*C*P is diagonal.
4) Given A:=matrix(2,2,[1,2,2,2]);B:=matrix(2,2,[2,4,1,5]);C:=matrix(2,2,[1,4,1,2]);
a. Find the eigenvalues of A and C
b. Build the matrix F : , where 0 is the 2 by 2 zero matrix
c. Find the eigenvalues of F
5) Given A:=matrix(2,2,[2,1,1,2]);
a. Find the eigenvalues of A^m, m=1,2,3,4
b. Find the eigenvalues of A^(-1)
c. Find the eigenvalues of Id+2A+4A^2 where I means the 2 by 2 identity matrix
6) Given A:=matrix(3,3,[[0,1,0],[-1,0,0],[0,0,1]]);
a. Find the exponential matrix of A time Pi: e^(A*Pi) and its eigenvalues
b. Now find the matrix whose entries consist of the exp(A[i,j]*Pi) and its eigenvalues (*)
c. Find the matrix A^4 and its eigenvalues
d. Now find the matrix whose entries are A[i,j]^4 and its eigenvalues (*)
(*). For this problem see the discussion of computing element-wise operations on matrices.
<< Back
|