Ma 309: Matrix Algebra Model Solutions to Homework Assignment 10 Prof. Wickerhauser Exercise 1 of Section 6.3, p.351. Find the eigenvalues and eigenvectors of A, check that the eigenvectors are linearly independent, then use Th 6.3.2 to get the diagonalization A=XAX^{-1}. These computations are best done with MatLab. a. Eigenvalues {1,-1} of A are distinct, so the eigenvectors are linearly independent by Th.6.3.1: >> A=[0 1; 1 0] A = 0 1 1 0 >> [X D]=eig(A) X = -0.7071 0.7071 = -1/sqrt(2) 1/sqrt(2) 0.7071 0.7071 1/sqrt(2) 1/sqrt(2) D = -1 0 0 1 >> A-X*D*inv(X) ans = 0 0 0 0 b. Eigenvalues {1,2} of A are distinct, so the eigenvectors are linearly independent by Th.6.3.1: >> A=[5 6; -2 -2] A = 5 6 -2 -2 >> [X D]=eig(A) X = 0.8944 -0.8321 -0.4472 0.5547 D = 2 0 0 1 >> A-X*D*inv(X) ans = 1.0e-14 * 0.5329 0.9770 -0.2887 -0.4885 c. Eigenvalues {0,-2} of A are distinct, so the eigenvectors are linearly independent by Th.6.3.1: >> A=[2 -8; 1 -4] A = 2 -8 1 -4 >> [X D]=eig(A) X = 0.9701 0.8944 0.2425 0.4472 D = 0 0 0 -2 >> A-X*D*inv(X) ans = 0 0 0 0 d. Eigenvalues {2,1,-1} of A are distinct, so the eigenvectors are linearly independent by Th.6.3.1: >> A=[2 2 1; 0 1 2; 0 0 -1] A = 2 2 1 0 1 2 0 0 -1 >> [X D]=eig(A) X = 1.0000 -0.8944 0.2294 0 0.4472 -0.6882 0 0 0.6882 D = 2 0 0 0 1 0 0 0 -1 >> A-X*D*inv(X) ans = 1.0e-15 * 0 0 0.2220 0 0 0 0 0 0 Exercise 3 of Section 6.3, p.352. By exercise 3 of section 6.1, an nxn matrix A is singular if and only if 0 is an eigenvalue of A. Only the matrix in part c of exercise 1 above has a zero eigenvalue, so the others are nonsingular. By an extension of Remark 4 on page 340, we see that if A=XDX^{-1}, then A^{-1}=XD^{-1}X^{-1}, and the inverse of a diagonal matrix D is the diagonal matrix of reciprocals of corresponding diagonal coefficients. a. >> A=[0 1; 1 0]; >> [X D]=eig(A); X*inv(D)*inv(X) ans = 0 1 1 0 b. >> A=[5 6; -2 -2]; >> [X D]=eig(A); X*inv(D)*inv(X) ans = -1 -3 1 2.5 d. >> A=[2 2 1; 0 1 2; 0 0 -1]; >> [X D]=eig(A); X*inv(D)*inv(X) ans = 0.5 -1 -1 0 1 2 0 0 -1 Exercise 4 of Section 6.3, p.352. Factor A=XDX^{-1}. If the diagonal coefficients of D are nonnegative, then we may compute their square roots to define C=D^{1/2}, and the matrix B=XCX^{-1} will satisfy B^2=A. a. >> A=[2 1; -2 -1] A = 2 1 -2 -1 >> [X D]=eig(A) X = 0.7071 -0.4472 -0.7071 0.8944 D = 1 0 0 0 But this D is its own square root. Thus B=A will work: >> B=X*sqrt(D)*inv(X) B = 2 1 -2 -1 b. >> A=[9 -5 3; 0 4 3; 0 0 1] A = 9 -5 3 0 4 3 0 0 1 The eigenvalues of A are {9,4,1}, the diagonal elements, since A is upper triangular. >> [X D]=eig(A) X = 1.0000 0.7071 -0.5774 0 0.7071 -0.5774 0 0 0.5774 D = 9 0 0 0 4 0 0 0 1 >> B=X*sqrt(D)*inv(X) B = 3.0000 -1.0000 1.0000 0 2.0000 1.0000 0 0 1.0000 Check that B^2=A: >> B*B-A ans = 1.0e-14 * 0 0 -0.1332 0 0 -0.1332 0 0 0 The difference is about equal to the truncation error of double precision arithmetic. Exercise 7 of Section 6.3, p.352. Let A be the 3x3 matrix for this exercise. Since A is upper triangular, its eigenvalues are the diagonal coefficients {a,a,b}. We compute the eigenspaces N(A-aI) and N(A-bI) by row reduction: A-aI = 0 1 0 ==> N(A-aI)=Span{[1 0 0]'} 0 0 1 0 0 b-a A-bI = a-b 1 0 ==> N(A-aI)=Span{[1 (a-b) (a-b)^2]'} 0 a-b 1 0 0 0 Both eigenspaces are one-dimensional, so there cannot be 3 linearly independent eigenvectors for A, so A is defective. Exercise 12 of Section 6.3, p.353. Suppose that A != 0 is an nxn matrix. We prove the equivalent contrapositive: if has n linearly independent eigenvectors, then A cannot be nilpotent. But by Th.6.3.2 of p.339, such an A can be diagonalized as A=XDX^{-1}, where D is diagonal and the linearly independent columns of X are eigenvectors for A. Since A != 0, we know D != 0, so D^k != 0 for all integers k>0, so A^k=A=XD^kX^{-1} != 0 for all integers k>0. Hence A is not nilpotent. Exercise 13 of Section 6.3, p.353. Let {v1,...,vk} be the nonzero eigenvalues of diagonalizable matrix A, and let x1,...,xk be the corresponding columns of the diagonalizing matrix X. Here we have renumbered the eigenvalues, if necessary, to simplify the notation. Those columns are eigenvectors, so A*xj=vj*xj for j=1,...,k, so A[(1/vj)*xj]=xj, so {x1,...,xk} and thus Span{x1,...,xk} is a subset of R(A). Now suppose x is in R(A). Write x=Ay for some vector y, and let y=y1*x1+...+yk*xk + y{k+1}*x{k+1}+...+yn*xn be the unique expansion of y in the eigenvector basis {x1,...,xn}. Then x = Ay = v1*y1*x1+...+vk*yk*xk is in Span{x1,...,xk}, so R(A) is a subset of Span{x1,...,xk}. By combining both paragraphs, we show R(A)=Span{x1,...,xk}. Since {x1,...,xk} is a linearly independent set, it is a basis for its span R(A). Exercise 17 of Section 6.3, p.353. Use MatLab notation. First, but definition, A similar to B ==> B=inv(U)*A*U for some invertible U. A diagonalizable ==> A=X*D*inv(X) for some invertible X. Now let S=inv(U)*X. Then S is invertible with inv(S)=inv(X)*U. By substitution we get B=inv(U)*X*D*inv(X)*U = S*D*inv(S), so by definition B is diagonalizable (to the same diagonal matrix of eigenvalues as A). Exercise 18 of Section 6.3, p.353. Use MatLab notation. Write A=X*D*inv(X) and B=X*E*inv(X) for diagonal matrices D,E. But D*E=E*D, since diagonal matrix multiplcation is commutative. Thus, by cancelling the inv(X)*X=I inner factors, we get A*B = X*D*inv(X)*X*E*inv(X) = X*D*E*inv(X) = X*E*D*inv(X) = X*E*inv(X)*X*D*inv(X) = B*A Exercise 23 of Section 6.3, p.354. a. We note that A^2=0, so the Taylor series for exp(A) is all zeroes after the I and A terms, so exp(A) = I+A = 2 1 -1 0 b. We note that for all k=0,1,..., A^k= 1 k 0 1 so the Taylor series for exp(A) gives the matrix exp(A) = Sum 1/k! Sum k/k! = e e 0 Sum 1/k! 0 e where the evaluation of Sum k/k! = Sum 1/(k-1)! = e follows from the re-indexing k <-- k'+1. c. We note that A^k=I+k*B, where B = 0 0 -1 0 0 0 0 0 0 Thus the Taylor series for exp(A) splits into two simple parts: exp(A) = Sum A^k/k! = (Sum 1/k!)*I + [Sum k/k!]*B = e*I + e*B, = e 0 -e 0 e 0 0 0 e since Sum k/k! = Sum 1/(k-1)! = e. Exercise 24 of Section 6.3, p.354. a. Note that A^2=A, so A is idempotent and A^k=A for all positive integers k. Therefore, after separating the k=0 term from the Taylor series for exp(A), we get exp(A) = Sum A^k/k! = I+A*(Sum{k>0} 1/k!) = I+(e-1)A = 1-2(e-1) 0-1(e-1) = 3-2e 1-e 0+6(e-1) 1+3(e-1) 6e-6 3e-2 Check this with MatLab's exp() and expm() commands: >> A=[-2 -1; 6 3] A = -2 -1 6 3 >> e=exp(1); B=[3-2*e 1-e; 6*e-6 3*e-2] B = -2.4366 -1.7183 10.3097 6.1548 >> B-expm(A) ans = 1.0e-13 * 0.0178 0.0178 -0.1066 -0.0888 b. Note that A^2=I, so A^k=A if k is odd and A^k=I if k is even. Thus the Taylor series for exp(A) splits into two parts: exp(A) = Sum A^k/k! = [Sum 1/(2*k)!]*I + [Sum 1/(2k+1)!]*A Now Sum 1/(2*k)! = [Sum 1^k/k! + Sum(-1)^k/k!]/2 = [e+1/e]/2, Sum 1/(2k+1)! = [Sum 1^k/k! - Sum(-1)^k/k!]/2 = [e-1/e]/2, so exp(A) = ([e+1/e]/2)*I + ([e-1/e]/2)*A = 2e-1/e 2e-2/e = 5.0687 4.7008 1/e-e 2/e-e -2.3504 -1.9825 Check this with MatLab's expm() command: >> e=exp(1); B=[2*e-1/e 2*e-2/e; 1/e-e 2/e-e]; >> A=[3 4;-2 -3]; expm(A)-B ans = 1.0e-13 * 0.2842 0.1599 -0.0711 -0.0266 c. Note that A^2=A, so A is idempotent and A^k=A for all positive integers k. Therefore, after separating the k=0 term from the Taylor series for exp(A), we get exp(A) = Sum A^k/k! = I+A*(Sum{k>0} 1/k!) = I+(e-1)A = 1+1(e-1) 0+1(e-1) 0+1(e-1) 0-1(e-1) 1-1(e-1) 0-1(e-1) 0+1(e-1) 0+1(e-1) 1+1(e-1) = e e-1 e-1 1-e 2-e 1-e e-1 e-1 e Check this with MatLab's exp() and expm() commands: >> e=exp(1); B=[e e-1 e-1; 1-e 2-e 1-e; e-1 e-1 e] B = 2.7183 1.7183 1.7183 -1.7183 -0.7183 -1.7183 1.7183 1.7183 2.7183 >> B-(e-1)*A-eye(3) ans = 0 0 0 0 0 0 0 0 0 >> expm(A)-B ans = 1.0e-14 * -0.4441 -0.3109 -0.3997 0.1998 0.1110 0.2887 -0.3109 -0.2887 -0.4885 Exercise 25 of Section 6.3, p.354. a. Note that A*A=I, so (tA)^k = (t^k)A if k is odd, (t^k)I if k is even. As in exercise 24b, the Taylor series for exp(A) splits into two parts: exp(tA) = Sum (tA)^k/k! = [Sum (t^{2k})/(2k)!]I+[Sum (t^{2k+1})/(2k+1)!]A Now Sum (t^{2k})/(2k)! = [Sum t^k/k! + Sum(-t)^k/k!]/2 = [exp(t)+exp(-t)]/2 = cosh(t), Sum (t^{2k+1})/(2k+1)! = [Sum t^k/k! - Sum(-t)^k/k!]/2 = [exp(t)-exp(-t)]/2 = sinh(t). Thus exp(tA) = cosh(t)I + sinh(t)A = cosh(t)+sinh(t) -2sinh(t) 0 cosh(t)-sinh(t) and the solution of the initial value problem Y'=AY from Y0=(1,1)' is Y(t) = exp(tA)*Y0 = ( cosh(t)-sinh(t), cosh(t)-sinh(t) )' b. Again, A*A=I, so just as in part a we have exp(tA) = cosh(t)I + sinh(t)A = cosh(t)+2sinh(t) 3sinh(t) -sinh(t) cosh(t)-2sinh(t) and the solution of the initial value problem Y'=AY from Y0=(-4,2)' is Y(t) = exp(tA)*Y0 = ( -4cosh(t)-5sinh(t), 2cosh(t) )' c. We compute a few powers of A with MatLab: >> A=[1 1 1;0 0 1;0 0 -1] A = 1 1 1 0 0 1 0 0 -1 >> B = A*A B = 1 1 1 0 0 -1 0 0 1 >> AAA = A*A*A AAA = 1 1 1 0 0 1 0 0 -1 Since A^3=A, we may conclude by induction that (tA)^k = I, if k=0, A, if k>0 is odd, B, if k>0 is even. But then the Taylor expansion of exp(tA) splits into three parts: exp(tA) = Sum (tA)^k/k! = I + A*(Sum{k>0} t^{2k-1}/(2k-1)!) + B*(Sum{k>0} t^{2k}/(2k)!) Now Sum{k>0} t^{2k-1}/(2k-1)! = sinh(t), Sum{k>0} t^{2k}/(2k)! = cosh(t)-1, so exp(tA) = I + sinh(t)A + (cosh(t)-1)B = sinh(t)+cosh(t) sinh(t)+cosh(t)-1 sinh(t)+cosh(t)-1 0 1 sinh(t)-cosh(t)+1 0 0 cosh(t)-sinh(t) and the solution of the initial value problem Y'=AY from Y0=(1,1,1)' is Y(t) = exp(tA)*Y0 = 3sinh(t)+3cosh(t)-2 sinh(t)-cosh(t)+2 cosh(t)-sinh(t) d. Compute a few powers of A with MatLab: >> A=[1 1 1; 1 0 1; -1 -1 -1] A = 1 1 1 1 0 1 -1 -1 -1 >> B=A*A B = 1 0 1 0 0 0 -1 0 -1 >> A*A*A ans = 0 0 0 0 0 0 0 0 0 A is evidently nilpotent with A^3=0, so A^k=0 for all k>2, so the Taylor series for exp(tA) has only 2 terms: exp(tA) = I + tA + (t^2/2)B = 1+t+t^2/2 t t+t^2/2 t 1 t -t-t^2/2 -t 1-t-t^2/2 and the solution of the initial value problem Y'=AY from Y0=(1,1,-1)' is Y(t) = exp(tA)*Y0 = (1+t, 1, -1-t)'. Exercise 26 of Section 6.3, p.355. Let x be an eigenvector for eigenvalue v of the nxn matrix A. Then x is not zero, and exp(A)x = [Sum A^k/k!]x = Sum [A^k]x/k! = Sum [v^k]x/k! = [Sum v^k/k!]x = exp(v)x. Thus exp(v) is an eigenvalue of exp(A), as claimed. Exercise 1 of Section 6.4, p.363. (i) ||z|| (ii) ||w|| (iii) (iv) --------- ---------- ----------- ---------- a. 6 3 10 - 4i 10 + 4i b. 4 7 -4 + 10i -4 - 10i Exercise 2 of Section 6.4, p.363. a. Compute the inner product to check orthogonality: = [(1+i)/2]*[-i/sqrt(2)]+[(1-i)/2]*[-1/sqrt(2)] = [1/sqrt(8)]*[-i+1 - 1+i] = 0, so z1 and z1 are orthogonal in C^2. Check that the norms are one: ||z1|| = sqrt([(1+i)/2]*[(1-i)/2]+[(1-i)/2]*[(1+i)/2]) = sqrt( (1+1)/4 + (1+1)/4 ) = sqrt(1) = 1. ||z2|| = sqrt([i/sqrt(2)]*[-i/sqrt(2)]+[-1/sqrt(2)]^2) = sqrt( 1/2 + 1/2 ) = sqrt(1) = 1. Hence {z1,z2} is an orthonormal set in C^2. b. Writing T=[z1 z2], the expansion coefficients z=a*z1+b*z2 are given by the transition matrix [a b]'=T^H z: a = = z1^H z = 4 b = = z2^H z = 2*sqrt(2) Exercise 4 of Section 6.4, p.364. a. Neither normal nor Hermitian: >> A=[1-i 2; 2 3] A = 1.0000 - 1.0000i 2.0000 2.0000 3.0000 >> A' ans = 1.0000 + 1.0000i 2.0000 2.0000 3.0000 >> A'*A-A*A' ans = 0 0 + 4.0000i 0 - 4.0000i 0 b. Hermitian, hence also normal. >> A=[1 2-i; 2+i -1] A = 1.0000 2.0000 - 1.0000i 2.0000 + 1.0000i -1.0000 >> A'-A ans = 0 0 0 0 c. Normal, but not Hermitian: >> A=[1 -1; 1 1]/sqrt(2) A = 0.7071 -0.7071 0.7071 0.7071 >> A'-A ans = 0 1.4142 -1.4142 0 >> A'*A-A*A' ans = 0 0 0 0 d. Neither Hermitian nor normal: >> A=[i 1; 1 -i]/sqrt(2) A = 0 + 0.7071i 0.7071 0.7071 0 - 0.7071i >> A*A'-A'*A ans = 0 0 + 2.0000i 0 - 2.0000i 0 e. Skew-Hermitian, hence also normal, but not Hermitian: >> A=[0 i 1; i 0 -2+i; -1 2+i 0] A = 0 0 + 1.0000i 1.0000 0 + 1.0000i 0 -2.0000 + 1.0000i -1.0000 2.0000 + 1.0000i 0 >> A'*A-A*A' ans = 0 0 0 0 0 0 0 0 0 >> A'-A ans = 0 0 - 2.0000i -2.0000 0 - 2.0000i 0 4.0000 - 2.0000i 2.0000 -4.0000 - 2.0000i 0 >> A'+A ans = 0 0 0 0 0 0 0 0 0 f. Hermitian, hence also normal: >> A=[3 1+i i; 1-i 1 3; -i 3 1] A = 3.0000 1.0000 + 1.0000i 0 + 1.0000i 1.0000 - 1.0000i 1.0000 3.0000 0 - 1.0000i 3.0000 1.0000 >> A'*A-A*A' ans = 0 0 0 0 0 0 0 0 0 >> A'-A ans = 0 0 0 0 0 0 0 0 0 Exercise 5abcef of Section 6.4, p.364. a. Use MatLab to diagonalize: >> A=[1 2; 2 1]; [U D]=eig(A); U U = -0.7071 0.7071 = -1/sqrt(2) 1/sqrt(2) 0.7071 0.7071 1/sqrt(2) 1/sqrt(2) Check that the diagonalizing matrix U is unitary: >> U'*U ans = 1.0000 0 0 1.0000 b. Use MatLab to diagonalize and check that the eigenvectors matrix is unitary: >> A=[1 3+i; 3-i 4]; [U D]=eig(A) U = 0.8018 + 0.2673i 0.5071 + 0.1690i -0.5345 0.8452 >> U'*U ans = 1.0000 0.0000 0.0000 1.0000 c. Use MatLab to diagonalize and check that the eigenvectors matrix is unitary: >> A=[2 i 0; -i 2 0; 0 0 2]; [U D]=eig(A); U U = 0 + 0.7071i 0 0 + 0.7071i -0.7071 0 0.7071 0 1.0000 0 >> U'*U ans = 1.0000 0 0 0 1.0000 0 0 0 1.0000 e. Use MatLab to diagonalize and check that the eigenvectors matrix is unitary: >> A=[0 0 1; 0 1 0; 1 0 0]; [U D]=eig(A); U U = 0.7071 0.7071 0 0 0 -1.0000 -0.7071 0.7071 0 >> U'*U ans = 1.0000 0 0 0 1.0000 0 0 0 1.0000 f. Use MatLab to diagonalize and check that the eigenvectors matrix is unitary: >> A=[1 1 1; 1 1 1; 1 1 1]; >> [U D]=eig(A); U U = 0.4082 0.7071 0.5774 0.4082 -0.7071 0.5774 -0.8165 0 0.5774 >> U'*U ans = 1.0000 0.0000 -0.0000 0.0000 1.0000 0.0000 -0.0000 0.0000 1.0000 Exercise 6 of Section 6.4, p.364. If ajj is the diagonal entry in row j and column j of a Hermitian matrix A, then A^H = A implies that bar(ajj)=ajj, so ajj is its own complex conjugate, so ajj must be real. Exercise 10 of Section 6.4, p.365. Note A is Hermitian, so by the Spectral Theorem we may find a unitary matrix U and a diagonal matrix D such that A=U*D*(U^H). We do this with MatLab: >> A=[4 0 0; 0 1 i; 0 -i 1]; [U D]=eig(A) U = 0 0 1.0000 0 + 0.7071i 0 + 0.7071i 0 -0.7071 0.7071 0 D = 0 0 0 0 2 0 0 0 4 Note that D has nonnegative entries on the diagonal. Hence D=C*(C^H), where C=diag{0,sqrt(2),2}. [Many other choices of C will also work.] But then putting B=(U*C)^H and noting that B^H=U*C gives us (B^H)*B = U*C*(C*U)^H = U*C*(C^H)*(U^H) = U*D*(U^H) = A Exercise 12 of Section 6.4, p.365. Denote the conjugate transpose by ' as in MatLab. Compute U'=(I-2*u*u')'=I'-2*(u')'*u'=I-2*u*u'=U. Thus U is Hermitian. Compute U'*U = (I-2*u*u')'*(I-2*u*u') by definition = (I-2*u*u')*(I-2*u*u') since U'=U = I-4*u*u'+4*u*u'*u*u' expanding = I-4*u*u'+4*u**u' since u'*u=1 = I Hence U is unitary. Exercise 13 of Section 6.4, p.365. Suppose U is both unitary and Hermitian and let v be an eigenvalue of U with eigenvector x. Then Ux=vx and also U'x=vx, since U'=U, so x = Ix = U'Ux = U'(vx)=v(U'x)= v^2 x Since x is not the zero vector, we may conclude that v^2=1. and thus v=1 or v= -1. Exercise 19 of Section 6.4, p.366. By the Spectral Theorem (6.4.4, page 360), the Hermitean matrix A may be diagonalized as A=U*D*U^H, where U is the unitary matrix whose columns are orthonormal eigenvectors of A, and D=diag{v1,...,vn} has the corresponding eigenvalues on its diagonal. But we may write U=[u1 ... un], so its ij coefficient is uj(i), which is the ith coordinate of the jth vector uj. But U^H=[u1^H; ...; un^H] ==> D*(U^H)=[v1*u1^H;...;vn*un^H], so the ij coefficient of D*(U^H) is vi*bar(ui(j)). Now, let A=(aij) be the coefficients of A. Expanding aij in terms of the diagonalization and the vectors {uk} then gives aij = U*D*(U^H) = Sum{k} vk*uk(i)*bar(uk(j)) = [Sum{k} vk*uk*(uk^H)](ij), ==> A = Sum{k} vk*uk*(uk^H), as claimed.