Mathematics by T. Arens, F. Hettlich, Ch. Karpfinger, U. Kockelkorn, K. Lichtenegger, H. Stachel (chapter 18: Eigenvalues and Eigenvectors)restart; Eigenvalues of a matrixWe obtain the eigenvalues of a matrix with the command eigenvalues in the package linalg. E.g. for the matrixA:= 1/8*evalm(matrix(3,3,[43, -15, 3, 21, 15, -3, 30, -6, 14]));the eigenvalues arewith(linalg):
eigenvalues(A);
As a matter of fact we may also directly proceed by evaluating the characteristical polynominal and determining its roots. Therefore we are using the commands det and solve already know from previous chapters.E:=array(identity,1..3,1..3);
p:=det(A-lambda*E);
EW:=[solve(p=0,lambda)];The command charpoly of the linalg package provides the charateristical polynominal.charpoly(A,lambda);Also the eigenvectors can directly be determined by the command eigenvectors .eigenvectors(A);The command yields a list of eigenvalues with their algebraical multiplicity and a basis of the according eigenspace.Now we verify whether the statement that the sum of all diagonal elements, so called trace , is equivalent to the sum of the eigenvalues.sum(EW[j],j=1..3);
trace(A);Remark: By loading the linalg package the meaning of the trace command changed. Without the package the command is used for finding errors (debugging) procedurs. Though the command is overwritten by the package linalg .We are going to verify that the product of the eigenvalues is equivalent to the determinant of the matrix:product(EW[j],j=1..3);
det(A);Geometrically the eigenvalues are stretching factors in the direction of the eigenvectors. Let us pick one eigenvector x and evaluate the image under the linear transformation. Regarding both in a plot will help us understanding their definition and meaning.x:=matrix(3,1,[1,5/3,2]);
y:=evalm(A&*x);
with(plots):
with(plottools):
p1:=plot3d(0,0..5,0..5,color=gray,style=patchnogrid,axes=boxed):
p2:=sphere([seq(x[j,1],j=1..3)],0.1,style=patchnogrid,color=blue):
p3:=sphere([seq(y[j,1],j=1..3)],0.1,style=patchnogrid,color=red):
p4:=line([0,0,0],[seq(y[j,1],j=1..3)],linestyle=1,color=black):
display(p1,p2,p3,p4);You may grab and rotate the plot with the left mouse button to get a better imagination in the 3 dimensional space. Obviously y (red) is the vector x (blue) stretched by a factor 3.The Cayley-Hamilton theorem declares that we obtain the null matrix if we insert A in the characteristical polynominal. We will give it a try: First we convert p to a function.p:=unapply(p,lambda);Inserting the matrix A in the polynominal and evaluating the expression will return the expected result:evalm(p(A));The inverse to A, like it is explained in the book on page 595, can be determined by taking A as a common factor. Withq:=unapply(simplify((24-p(lambda))/lambda),lambda);we compareevalm(1/24*q(A));andinverse(A); DiagonalizabilityWhether a matrix is diagoniziable or nit can be determined by the aid of the command jordan, which shows the jordan normal representation of a matrix (see also the optional section 18.8. In our example with three different eigenvalues the matrix diagonalizable and we obtain the diagonal matrix with the eigenvalues on its diagonal.J:=jordan(evalm(A));If we add another argument, for instance 'S', the variable S will lead to the transformation matrix, i.e. is holds LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2KS1GLDYlUSJKRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LVEiPUYnL0Y4USdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGQi8lKXN0cmV0Y2h5R0ZCLyUqc3ltbWV0cmljR0ZCLyUobGFyZ2VvcEdGQi8lLm1vdmFibGVsaW1pdHNHRkIvJSdhY2NlbnRHRkIvJSdsc3BhY2VHUSwwLjI3Nzc3NzhlbUYnLyUncnNwYWNlR0ZRLUYjNiotSSVtc3VwR0YkNiUtRiw2JVEiU0YnRjRGNy1GIzYnLUY7Ni1RKiZ1bWludXMwO0YnRj5GQEZDRkVGR0ZJRktGTS9GUFEsMC4yMjIyMjIyZW1GJy9GU0Zcby1JI21uR0YkNiRRIjFGJ0Y+LyUnZmFtaWx5R1EwVGltZXN+TmV3flJvbWFuRicvJStiYWNrZ3JvdW5kR1EuWzI1NSwyNTUsMjU1XUYnRj4vJTFzdXBlcnNjcmlwdHNoaWZ0R1EiMEYnLUY7Ni1RMSZJbnZpc2libGVUaW1lcztGJ0Y+RkBGQ0ZFRkdGSUZLRk0vRlBRJjAuMGVtRicvRlNGX3AtRiw2JVEiQUYnRjRGN0ZbcEZZRmJvRmVvRj5GK0Zib0Zlb0Y+RitGYm9GZW9GPg==jordan(evalm(A),'S'):
evalm(S);
evalm(inverse(S)&*A&*S);Lets consider another examplel:B:=matrix(3,3,[[2, 0, 0],[-2, 2, 3], [3, 0, -1]]);
jordan(evalm(B));
In this case the matrix is not diagonizable (By the last Jordan block we see, that LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYsLUkjbWlHRiQ2JVEnJiM5NTU7RicvJSdpdGFsaWNHUSZmYWxzZUYnLyUsbWF0aHZhcmlhbnRHUSdub3JtYWxGJy1JI21vR0YkNi1RIj1GJ0YyLyUmZmVuY2VHRjEvJSpzZXBhcmF0b3JHRjEvJSlzdHJldGNoeUdGMS8lKnN5bW1ldHJpY0dGMS8lKGxhcmdlb3BHRjEvJS5tb3ZhYmxlbGltaXRzR0YxLyUnYWNjZW50R0YxLyUnbHNwYWNlR1EsMC4yNzc3Nzc4ZW1GJy8lJ3JzcGFjZUdGSS1JI21uR0YkNiRRIjJGJ0YyLUY2Ni1RIn5GJ0YyRjlGO0Y9Rj9GQUZDRkUvRkhRJjAuMGVtRicvRktGVC1GLDYlUSNpc0YnL0YwUSV0cnVlRicvRjNRJ2l0YWxpY0YnRlAtRiw2JVEiZUYnRllGZW4vJSdmYW1pbHlHUTBUaW1lc35OZXd+Um9tYW5GJy8lK2JhY2tncm91bmRHUS5bMjU1LDI1NSwyNTVdRidGMg==igenvalue of the matrix with algebraic factor 2 and geometeric multiplicity 3. Note, the matrix has the alebraic muliplicityt 2 and geometrical muliplicity:For matrices there is also availabble the exponential function (exponential) in the package linalg. If the matrix is diagoniziabled, the explicit representation is computed by corresponding eigenvalues and eigenvectors.exponential(A,t); Numerical computation of EigenvaluesWe code our own program to approximate the greatest eigenvalue of a matrix.viter:=proc(A, v0, n)
local j, xn, vn, vmax, lambda, lambdalist;
vn := v0;
lambdalist := [];
for j to n do
xn := evalm(A&*vn);
vmax:=norm(vn,infinity);
member(vmax,[seq(vn[i,1],i=1..rowdim(vn))],'jmax');
lambda := evalf( xn[jmax,1]/vn[jmax,1], 3);
lambdalist := [op(lambdalist), lambda] ;
vn := evalm(xn);
od;
op(lambdalist)
end:Remark: With the command op the operators of an expression, in this case the entries of the list are returned.Let us try the routine for the initial matrix A and the start vector (1,1,1).A:= 1/8*evalm(matrix(3,3,[43, -15, 3, 21, 15, -3, 30, -6, 14]));
v0:=matrix(3,1,[[1],[1],[1]]);
viter(A,v0,20);The iteration is convergent. However we observe a relatively slow convergency in the list of the approximated eigenvalues.The prefered method to compute eigenvalues for matrices that can be transformed to the diagonal form is the QR-method, we refer to further literature of numerical mathematics. The QR-method is based on a decomposition of the matrix to a product of a unit matrix Q and a upper triangle matrix R. This command is implemented in Maple under the name Eigenvals .evalf( Eigenvals( evalm(A) ) ); Exercises1. Determine the eigenvalues and eigenvectors ofA:= evalm(matrix(3,3,[1, -3, 3, 3, -5, 3, 6, -6, 4]));by finding roots of the characteristical polynominal and solving the according linear systems of equations for the eigenvectors. Prove your result by the commands eigenvalue and eigenvectors.SolutionWe define the characteristical polynominal.E:=array(identity,1..3,1..3);
p(lambda):=det(A-lambda *E);We obtain the eigenvalues as roots.EW:=[solve(p(lambda)=0,lambda)];To get the eigenvectors we solve the associated linear systems of equationsNull:=vector([0,0,0]):
ev:=[seq(linsolve(A-EW[j]*E,Null),j=1..3)];and choose eigenvectors:EV:=[subs(_t[1]=1,ev[1]),subs(_t[1]=1,_t[2]=1,ev[2]),subs(_t[1]=-1,_t[2]=1,ev[3])];We control ourself using the command eigenvectors:eigenvectors(A);Note, that all linear combinations of eigenvectors for the eigenvalue -2 are valid eigenvectors as well, which explains the discrepance in the result. If we had chosen _t[2]=0 instead of _t[2]= -1 , we would have obtained the same eigenvectors like Maple.2. a) We carry on Ex 18.10: Determine the orthogonal matrix S, such that S^(-1)*A*S is a diagonal matrix withA:= evalm(matrix(3,3,[10, 8, 8, 8, 10, 8, 8, 8, 10]));b) Test the result of Ex 18.9 (a) for the matrixA:= evalm(matrix(2,2,[1, I, I, -1]));and evaluate LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2Ji1JJW1zdXBHRiQ2JS1GLDYlUSJBRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW5HRiQ2JFEiMkYnL0Y7USdub3JtYWxGJy8lMXN1cGVyc2NyaXB0c2hpZnRHUSIwRicvJSdmYW1pbHlHUTBUaW1lc35OZXd+Um9tYW5GJy8lK2JhY2tncm91bmRHUS5bMjU1LDI1NSwyNTVdRidGQUYrRkZGSUZB .Solutiona) By the command jordan we directly obtain the desired result:jordan(evalm(A),'S');The transformation matrix isevalm(S);and we control the result byevalm(inverse(S)&*A&*S);b) In the second example we obtainA:= evalm(matrix(2,2,[1, I, I, -1]));
jordan(evalm(A),'S');byevalm(S);As you can see the matrix has the eigenvalue 0 in an algebraical multiplicity of 2.eigenvectors(evalm(A));For the square of matrix A followsevalm(A&*A);A matrix with the attribute LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2KC1JJW1zdXBHRiQ2JS1GLDYlUSJBRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUYsNiVRImtGJ0Y3RjovJTFzdXBlcnNjcmlwdHNoaWZ0R1EiMEYnLUkjbW9HRiQ2LVEiPUYnL0Y7USdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGSy8lKXN0cmV0Y2h5R0ZLLyUqc3ltbWV0cmljR0ZLLyUobGFyZ2VvcEdGSy8lLm1vdmFibGVsaW1pdHNHRksvJSdhY2NlbnRHRksvJSdsc3BhY2VHUSwwLjI3Nzc3NzhlbUYnLyUncnNwYWNlR0ZaLUkjbW5HRiQ2JFEiMEYnRkcvJSdmYW1pbHlHUTBUaW1lc35OZXd+Um9tYW5GJy8lK2JhY2tncm91bmRHUS5bMjU1LDI1NSwyNTVdRidGR0YrRltvRl5vRkc= is called nilpotent (see section 18.8).3. For which real values a exists a diagonal form of the matrixA:= evalm(matrix(3,3,[1, 0, 0, 0, 3, a, 1, a, 3]));SolutionFirs we determine the eigenvalueseigenvalues(A);Now we have to distinguished four cases:1. case LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2KC1GLDYlUSJhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LVEiPUYnL0Y4USdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGQi8lKXN0cmV0Y2h5R0ZCLyUqc3ltbWV0cmljR0ZCLyUobGFyZ2VvcEdGQi8lLm1vdmFibGVsaW1pdHNHRkIvJSdhY2NlbnRHRkIvJSdsc3BhY2VHUSwwLjI3Nzc3NzhlbUYnLyUncnNwYWNlR0ZRLUkjbW5HRiQ2JFEiMEYnRj4vJSdmYW1pbHlHUTBUaW1lc35OZXd+Um9tYW5GJy8lK2JhY2tncm91bmRHUS5bMjU1LDI1NSwyNTVdRidGPkYrRlhGZW5GPg== :eigenvectors(evalm(subs(a=0,evalm(A))));There exists a diagonal form, since the geometric and algebraical multiplicity of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2KC1GLDYlUSkmbGFtYmRhO0YnLyUnaXRhbGljR1EmZmFsc2VGJy8lL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I1NSwyNTVdRidGPkYrRlhGZW5GPg== :eigenvectors(evalm(subs(a=2,evalm(A))));See the 2. casejordan(evalm(subs(a=-2,evalm(A))));4. case:If LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYmLUkjbWlHRiQ2JVEiYUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy8lJ2ZhbWlseUdRMFRpbWVzfk5ld35Sb21hbkYnLyUrYmFja2dyb3VuZEdRLlsyNTUsMjU1LDI1NV1GJy9GM1Enbm9ybWFsRic= is neither 0,2, nore -2 , there exists a diagonal form that we get asjordan(evalm(A),'S');Attention: the two critical cases are not recognaized by Maple if we simply apply the jordan command. However if we regard the transformated formevalm(S);it becomes clear, that LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2KC1GLDYlUSJhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LVEiPUYnL0Y4USdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGQi8lKXN0cmV0Y2h5R0ZCLyUqc3ltbWV0cmljR0ZCLyUobGFyZ2VvcEdGQi8lLm1vdmFibGVsaW1pdHNHRkIvJSdhY2NlbnRHRkIvJSdsc3BhY2VHUSwwLjI3Nzc3NzhlbUYnLyUncnNwYWNlR0ZRLUkjbW5HRiQ2JFEiMkYnRj4vJSdmYW1pbHlHUTBUaW1lc35OZXd+Um9tYW5GJy8lK2JhY2tncm91bmRHUS5bMjU1LDI1NSwyNTVdRidGPkYrRlhGZW5GPg== and LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2KS1GLDYlUSJhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LVEiPUYnL0Y4USdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGQi8lKXN0cmV0Y2h5R0ZCLyUqc3ltbWV0cmljR0ZCLyUobGFyZ2VvcEdGQi8lLm1vdmFibGVsaW1pdHNHRkIvJSdhY2NlbnRHRkIvJSdsc3BhY2VHUSwwLjI3Nzc3NzhlbUYnLyUncnNwYWNlR0ZRLUYjNictRjs2LVEqJnVtaW51czA7RidGPkZARkNGRUZHRklGS0ZNL0ZQUSwwLjIyMjIyMjJlbUYnL0ZTRlotSSNtbkdGJDYkUSIyRidGPi8lJ2ZhbWlseUdRMFRpbWVzfk5ld35Sb21hbkYnLyUrYmFja2dyb3VuZEdRLlsyNTUsMjU1LDI1NV1GJ0Y+RitGam5GXW9GPkYrRmpuRl1vRj4= do not lead to a reasonable tranformation. Even the usage of the command eigenvectors requires a closed look to identify the geometrical multiplicity for the special cases.eigenvectors(A);