< M A T L A B > Copyright 1984-2003 The MathWorks, Inc. Version 6.5.1.200223 Release 13 (Service Pack 1) Aug 22 2003 Using Toolbox Path Cache. Type "help toolbox_path_cache" for more info. To get started, select "MATLAB Help" from the Help menu. --Problem 1 >> A = rand(4,4); >> sum(eig(A)), prod(eig(A)), poly(A), trace(A), det(A) ans = 2.7334 ans = 0.1155 - 0.0000i ans = 1.0000 -2.7334 1.2135 -0.6543 0.1155 ans = 2.7334 ans = 0.1155 >> A = rand(5,5); >> sum(eig(A)), prod(eig(A)), poly(A), trace(A), det(A) ans = 3.3249 ans = -0.0594 ans = 1.0000 -3.3249 2.4972 -0.4880 -0.1819 0.0594 ans = 3.3249 ans = -0.0594 >> A=rand(6,6); >> sum(eig(A)), prod(eig(A)), poly(A), trace(A), det(A) ans = 2.9244 ans = -0.0326 + 0.0000i ans = Columns 1 through 6 1.0000 -2.9244 -0.9067 0.1127 0.1779 -0.0186 Column 7 -0.0326 ans = 2.9244 ans = -0.0326 -- Analysis: In all these examples, the trace equals the sum of the eigenvalues and is the negative of the second coefficient of the characteristic polynomial (the coefficient of lambda^{n-1}). In all examples the determinent equals the product of the eigenvalues and is plus or minus the constant coefficient of the characteristic polynomial, (plus for even sized matrices and minus for odd sized matrices). So it is reasonable to conjecture that this always is true. Note that the above conjecture applies to the matlab version of the characteristic polynomial which differs from Lay's version by a constant (-1)^n. It is not hard to prove some of these conjectures, note that (t -r1)(t - r2)(t - r3)...(t - rn) = t^n - (r1+r2+...+rn)t^{n-1} + .... + (-1)^n*r1* r2*r3 ... *rn So the coefficient of t^{n-1} is always minus the sum of the roots and the constant coefficient is (-1)^n times the product of the roots. This shows the conjectured relation between the sums and products of the eigenvalues and the coefficients of the characteristic polynomial. On the other hand the characteristic polynomial is det(lambda*eye(n)-A), and setting lambda = 0 we see that the constant term of the characteristic polynomial is det(-A) which is (-1)^n * det(A). To get the trace requires a little more work. By the (complex) Schur lemma (see course web page since Lay only mentions the real Schur lemma) there is a complex matrix Q so that U = Q^{-1}AQ is upper triangular. But similar matrices have the same trace so trace(A) = trace(U) = sum of eigenvalues of U. But U and A have the same eigenvalues since they are similar. ---- Problem 2 >> A=[8 -10 -5;2 17 2;-9 -18 4]; >> eig(A) ans = 3.0000 13.0000 13.0000 >> rref(A-3*eye(3)) ans = 1.0000 0 -0.5556 0 1.0000 0.2222 0 0 0 --- So using the method of Example 4, a basis of the 3 eigenspace is { [ .5556, -.2222, 1 ]' }. >> rref(A-13*eye(3)) ans = 1 2 1 0 0 0 0 0 0 --- So using the method of Example 4, a basis of the 13 eigenspace is { [-2, 1, 0 ]', [-1, 0, 1]' }. -- it looks like there should be an exact answer to the 3 eigenspace if we multiply by 9. >> 9*rref(A-3*eye(3)) ans = 9 0 -5 0 9 2 0 0 0 -- So we could say more exactly that a basis of the 3 eigenspace is { [ 5, -2, 9 ]' }. --- Problem 3 -- Construct an integer matrix with entries between -4 and 4. >> A=randint(4,4,[-4 4]); >> poly(A),poly(A'),[V D]=eig(A), [Vt Dt]=eig(A') ans = 1.0000 4.0000 -51.0000 -48.0000 32.0000 ans = 1.0000 4.0000 -51.0000 -48.0000 32.0000 -- So we see the characteristic polynomials of A and A' are the same V = 0.5429 0.5190 0.1900 0.0366 0.5128 -0.5338 0.7322 -0.7424 0.0482 -0.5729 -0.1090 0.6626 0.6633 0.3427 -0.6449 0.0920 D = -9.0204 0 0 0 0 5.8885 0 0 0 0 0.4552 0 0 0 0 -1.3234 Vt = -0.5147 -0.7127 -0.7172 0.6044 -0.4579 0.4412 -0.0946 -0.3189 -0.4008 0.5052 -0.1596 0.6671 -0.6039 0.2055 0.6718 -0.2966 -- Notice that no column of V is a multiple of a column of Vt, -- so the eigenvectors of A are completely different from the eigenvectors of A' -- (Note that when matlab computes V and Vt the columns are always unit vectors. -- So it is easy to visually check they are not multiples of one another since the -- only possible multiples are plus or minus one.) -- Some of you tried to check that the eigenvectors differed by computing norm(V-Vt) -- or sum(sum(abs(V-Vt))). But this is not a good test since it is quite possible that -- Matlab might compute the columns of V in a different order than the columns of Vt, -- and so norm(V-Vt) could be big even though each column of V was a column of Vt. -- In addition, this test would not detect whether a column of V was a negative of -- a column of Vt. So even the student who got real fancy and sorted the columns -- of V and Vt before comparison did not have a good test. Dt = -9.0204 0 0 0 0 5.8885 0 0 0 0 0.4552 0 0 0 0 -1.3234 >> A=randint(5,5,[-4 4]); >> poly(A),poly(A'),[V D]=eig(A), [Vt Dt]=eig(A') ans = 1.0000 6.0000 50.0000 216.0000 544.0000 554.0000 ans = 1.0000 6.0000 50.0000 216.0000 544.0000 554.0000 -- So again we see the characteristic polynomials of A and A' are the same V = Columns 1 through 4 0.1281 + 0.0617i 0.1281 - 0.0617i 0.3199 + 0.4306i 0.3199 - 0.4306i 0.1343 - 0.4262i 0.1343 + 0.4262i -0.1847 + 0.3305i -0.1847 - 0.3305i 0.5222 0.5222 -0.5567 -0.5567 0.2849 + 0.4171i 0.2849 - 0.4171i 0.0995 - 0.4905i 0.0995 + 0.4905i -0.4255 + 0.2667i -0.4255 - 0.2667i -0.0385 + 0.0839i -0.0385 - 0.0839i Column 5 0.6572 0.5770 -0.4727 -0.0302 0.1039 D = Columns 1 through 4 -0.0287 + 5.7792i 0 0 0 0 -0.0287 - 5.7792i 0 0 0 0 -1.9892 + 2.1185i 0 0 0 0 -1.9892 - 2.1185i 0 0 0 0 Column 5 0 0 0 0 -1.9641 Vt = Columns 1 through 4 0.1122 + 0.4587i 0.1122 - 0.4587i 0.4333 - 0.1933i 0.4333 + 0.1933i -0.1714 - 0.1990i -0.1714 + 0.1990i -0.4909 -0.4909 0.0918 + 0.3777i 0.0918 - 0.3777i -0.0443 - 0.3578i -0.0443 + 0.3578i 0.1009 + 0.2686i 0.1009 - 0.2686i -0.3608 + 0.2427i -0.3608 - 0.2427i 0.6890 0.6890 -0.3205 - 0.3349i -0.3205 + 0.3349i Column 5 -0.0268 0.7421 -0.1900 0.5368 0.3525 Dt = Columns 1 through 4 -0.0287 + 5.7792i 0 0 0 0 -0.0287 - 5.7792i 0 0 0 0 -1.9892 + 2.1185i 0 0 0 0 -1.9892 - 2.1185i 0 0 0 0 Column 5 0 0 0 0 -1.9641 -- Notice again that no column of V is a multiple of a column of Vt, -- so the eigenvectors of A are completely different from the eigenvectors of A' ----- Problem 4 >> A=[-6 4 0 9; -3 0 1 6;-1 -2 1 0;-4 4 0 7]; >> [V D] = eig(A) V = -0.6325 0.2626 -0.5148 0.3159 -0.3162 -0.1313 -0.6230 -0.7324 0.3162 -0.9191 -0.5869 -0.3830 -0.6325 0.2626 0.0481 0.4659 D = 5.0000 0 0 0 0 1.0000 0 0 0 0 -2.0000 0 0 0 0 -2.0000 -- The eig command guarantees that A*V = V*D. -- So if V is invertible then A = V*D*inv(V). -- So we should set P = inv(V) to get A = inv(P)*D*P. >> P=inv(V) P = 1.1294 -0.9035 -0.2259 -2.3717 1.2693 -0.0000 -1.2693 -1.9039 -2.0509 0.3362 -0.1121 1.8268 1.0293 -1.2612 0.4204 -0.1886 >> norm(A-inv(P)*D*P) ans = 7.1251e-15 -- So we see that A essentially equals inv(P)*D*P. -- Problem 5 >> A=[15 -66 -44 -33; 0 13 21 -15; 1 -15 -21 12; 2 -18 -22 8]; >> [V D] = eig(A) V = 0.0000 0.8642 0.8435 0.9605 -0.6396 -0.2357 -0.2519 -0.0603 0.6396 0.3143 0.3425 0.1745 0.4264 0.3143 0.3283 0.2081 D = 2.0000 0 0 0 0 5.0000 0 0 0 0 4.0000 0 0 0 0 4.0000 -- According to the book (Theorems 8 and 5) the columns of V should -- be a basis so that [T]_B is D. We can check this below. >> norm(inv(V)*A*V-D) ans = 3.7880e-13 Thus [T]_B = inv(V)*A*V is essentially diagonal.