disp('Homework problems for section 6.2, Fall 1996, MAT 342') disp('') disp('The following are reference solutions and selected comments. ') disp('Students should continue to work the problems in small steps.') clear disp('Note that MATLAB automatically normalizes the eigenvectors by') disp('making them unit vectors -- since the text book problems are') disp('"COOKED UP" to give nice numbers, try to find some eigen vectors') disp('that have integer components'); pause clear disp('Problem 4:') disp('') A=[-1 1; 1 1]/sqrt(2) p=poly(A) clf ss=roots(p); xx=[-10:.1:10]; yy=polyval(p,xx); plot([-10,10],[0,0],'g-',[0,0],[-10,10],'c-'); hold on plot(xx,yy,'m',ss,zeros(size(ss)),'yo'); axis([-10,10,-10,10]) [EVects,EVals]=eig(A) disp('Check: Multiply EVects*EVals*inv(EVects) and compare to the original matrix A') pause A check=EVects*EVals*inv(EVects) pause clear disp('Problem 8:') disp('') A=[1 0 3;2 1 2;3 0 1] p=poly(A) clf ss=roots(p); xx=[-10:.1:10]; yy=polyval(p,xx); plot([-10,10],[0,0],'g-',[0,0],[-20,20],'c-'); hold on plot(xx,yy,'m',ss,zeros(size(ss)),'yo'); axis([-10,10,-20,20]) [EVects,EVals]=eig(A) disp('Check: Multiply EVects*EVals*inv(EVects) and compare to the original matrix A') pause A check=EVects*EVals*inv(EVects) pause clear disp('Problem 9:') disp('') A=[8 9 9;3 2 3;-9 -9 -10] p=poly(A) clf ss=roots(p); xx=[-10:.1:10]; yy=polyval(p,xx); plot([-10,10],[0,0],'g-',[0,0],[-10,10],'c-'); hold on plot(xx,yy,'m',ss,zeros(size(ss)),'yo'); axis([-10,10,-10,10]) disp('The matrix A has a repeated eigenvalue at s=-1.') disp('We row-reduce the matrix (sI-A) and check its RANK:') reducedA=rref(-1*eye(3)-A) disp('Clearly there is a TWO-parameter family of solutions, i.e. ') disp('there are INDEPENDENT eigenvectors associated to this double') disp('eigenvalue, and hence the matrix A is similar to a diagonal') disp('matrix.') pause [EVects,EVals]=eig(A) disp('Check: Multiply EVects*EVals*inv(EVects) and compare to the original matrix A') pause A check=EVects*EVals*inv(EVects) clear disp('Problem 14:') disp('') A=[2 1 0;0 2 0;0 0 3] p=poly(A) clf ss=roots(p); xx=[-10:.1:10]; yy=polyval(p,xx); plot([-10,10],[0,0],'g-',[0,0],[-10,10],'c-'); hold on plot(xx,yy,'m',ss,zeros(size(ss)),'yo'); axis([1,4,-1,1]) pause disp('The matrix A has a repeated eigenvalue at s=2.') disp('We row-reduce the matrix (sI-A) and check its RANK:') reducedA=rref(2*eye(3)-A) disp('Clearly there is only a ONE-parameter family of solutions') disp('i.e. there is only one eigenvector associated to this double') disp('eigenvalue, and hence the matrix A is not similar to a diagonal') disp('matrix.') pause disp('For comparison, we take a look what MATLAB''s eig returns:') pause [EVects,EVals]=eig(A) disp('As expected, MATLAB can''t find INDEPENDENT eigenvectors either!') pause A check=EVects*EVals*inv(EVects) clear disp('Problem 16:') disp('') A=[2 0 1;3 3 3;1 0 2] p=poly(A) clf ss=roots(p); xx=[-10:.1:10]; yy=polyval(p,xx); plot([-10,10],[0,0],'g-',[0,0],[-10,10],'c-'); hold on plot(xx,yy,'m',ss,zeros(size(ss)),'yo'); axis([0,5,-2,2]) disp('The matrix A has a repeated eigenvalue at s=3.') disp('We row-reduce the matrix (sI-A) and check its RANK:') reducedA=rref(3*eye(3)-A) disp('Again there is only a ONE-parameter family of solutions') disp('i.e. there is only one eigenvector associated to this double') disp('eigenvalue, and hence the matrix A is not similar to a diagonal') disp('matrix.') pause disp('For comparison, we take a look what MATLAB''s eig returns:') pause [EVects,EVals]=eig(A) disp('As expected, MATLAB can''t find INDEPENDENT eigenvectors either!')