---------------- general commentary: Problem 1 was worth 1 point and the other three were 8 points apiece. Despite my instructions, many of you compared matrices by printing them out and inspecting. This was worth only half credit. Also some of you did not include supporting matlab output, again half credit. Some had the matlab output, but gave no conclusions. Following is an example solution which would have received full credit. (It was not necessary to print out Problem 1.) I used norm(D-E,1) to compare two matrices, you could hve equally well used max(max(abs(D-E))) instead. It could be improved though. For example, in problem 2a we concluded that since norm(A1-A3,1) = 3.1086e-15 was very small then A1 and A3 were essentially equal. But what if all the entries of A1 and A3 were on the order of 10^-15? Then we should have a much more stringent standard for equality. In other words, we would say two matrices D and E are essentially equal if norm(D-E,1) is significantly smaller than norm(D,1) and norm(E,1). So to be sure, in 2 I really shoiuld have calculated norm(A1,1), norm(A2,1), norm(A3,1), and norm(A4,1) to see that they were much more than 10^-15. One curious phenomenon arose in problem 4. Many of you did this correctly but found the difference to be on the order of 10^-5 rather than the 10^-14 I got below. I presume different versions of matlab use different methods to achieve their results and this accounts for this rather large discrepency which I found suprising. I would appreciate it if you did problem 4 correctly that you email me information on the matlab you used to get your results for problem 4 if you know it, in particular: 1. Version of matlab (e.g. 6.1, 6.5, 5.3, etc) and whether it is the student version. 2. Computer used (eg Wintel PC, Mac, Sun workstation, etc) 3. Whether the difference was about 10^-14 or about 10^-5. < M A T L A B > Copyright 1984-2001 The MathWorks, Inc. Version 6.1.0.450 Release 12.1 May 18 2001 To get started, select "MATLAB Help" from the Help menu. >> rand('state',sum(100*clock)); ---------- Problem 1 ---------------- >> C = randint(3,4,10)+i*randint(3,4,10) C = 4.0000 + 8.0000i 5.0000 + 8.0000i 3.0000 + 1.0000i 8.0000 + 5.0000i 7.0000 + 5.0000i 6.0000 + 9.0000i 1.0000 + 8.0000i 9.0000 + 6.0000i 4.0000 + 9.0000i 6.0000 + 6.0000i 9.0000 + 6.0000i 8.0000 + 1.0000i >> C' ans = 4.0000 - 8.0000i 7.0000 - 5.0000i 4.0000 - 9.0000i 5.0000 - 8.0000i 6.0000 - 9.0000i 6.0000 - 6.0000i 3.0000 - 1.0000i 1.0000 - 8.0000i 9.0000 - 6.0000i 8.0000 - 5.0000i 9.0000 - 6.0000i 8.0000 - 1.0000i >> real(C) ans = 4 5 3 8 7 6 1 9 4 6 9 8 >> imag(C) ans = 8 8 1 5 5 9 8 6 9 6 6 1 >> conj(C) ans = 4.0000 - 8.0000i 5.0000 - 8.0000i 3.0000 - 1.0000i 8.0000 - 5.0000i 7.0000 - 5.0000i 6.0000 - 9.0000i 1.0000 - 8.0000i 9.0000 - 6.0000i 4.0000 - 9.0000i 6.0000 - 6.0000i 9.0000 - 6.0000i 8.0000 - 1.0000i --------------------- Problem 2 ------------------ >> A = rand(7,7)+i*rand(7,7); B = rand(7,7)+i*rand(7,7); -- part a) >> A1=A*B; A2=B*A; A3 = (B'*A')'; A4 = (A'*B')'; >> norm(A1-A2,1), norm(A1-A3,1), norm(A1-A4,1), norm(A2-A3,1), norm(A2-A4,1), norm(A3-A4,1) ans = 11.4325 ans = 3.5527e-15 ans = 11.4325 ans = 11.4325 ans = 3.1086e-15 ans = 11.4325 >> % so A1=A3 and A2=A4 essentially. That is A*B = (B'*A')' and B*A = (A'*B')'. -- part b) >> A1=A'*B'; A2=B'*A'; A3 = (B*A)'; A4=(A*B)'; >> norm(A1-A2,1), norm(A1-A3,1), norm(A1-A4,1), norm(A2-A3,1), norm(A2-A4,1), norm(A3-A4,1) ans = 15.8564 ans = 3.5527e-15 ans = 15.8564 ans = 15.8564 ans = 3.9968e-15 ans = 15.8564 >> % so again A1=A3 and A2=A4 essentially. That is A'*B' = (B*A)' and B'*A' = (A*B)' -- part c) >> A1 = inv(A)*inv(B); A2 = inv(B)*inv(A); A3 = inv(A*B); A4 = inv(B*A); >> norm(A1-A2,1), norm(A1-A3,1), norm(A1-A4,1), norm(A2-A3,1), norm(A2-A4,1), norm(A3-A4,1) ans = 34.1695 ans = 34.1695 ans = 2.9920e-13 ans = 2.1164e-13 ans = 34.1695 ans = 34.1695 >> % so A1=A4 and A2=A3. -- part d) >> A1 = conj(A)*conj(B); A2 = conj(B)*conj(A); A3 = conj(A*B); A4 = conj(B*A); >> norm(A1-A2,1), norm(A1-A3,1), norm(A1-A4,1), norm(A2-A3,1), norm(A2-A4,1), norm(A3-A4,1) ans = 11.4325 ans = 0 ans = 11.4325 ans = 11.4325 ans = 0 ans = 11.4325 >> % So A1=A3 and A2=A4. >> >> %Problem 3 >> >> norm(A-inv(inv(A)),1) ans = 1.0815e-14 >> % so they are essentially equal. >> norm(A-(A')',1) ans = 0 >> % so they are equal. >> norm(inv(A')-(inv(A))',1) ans = 1.1358e-14 >> % so they are essentially equal >> norm(inv(conj(A))-conj(inv(A)),1) ans = 0 >> % So they are equal. >> >> %Problem 4 >> >> rref([A eye(7)]); >> norm([eye(7) inv(A)]-ans,1) ans = 2.0428e-14 >> % So we see that the last seven columns of the rref essentially coincide with inv(A) >> % an alternative method follows, by extracting the last seven columns. >> D = rref([A eye(7)]); >> E = D(:,8:14); >> norm(E-inv(A),1) ans = 2.0428e-14