# Homework 2 Solutions # 1. > with(LinearAlgebra): > read("/afs/eos.ncsu.edu/users/k/kaltofen/www/courses/LinAlgebra/Maple/ > RefPkg/InitPkg.mpl"): > with(RefPkg); [E_I, E_II, E_III, MyDet, MyInverse, MySolve, Ref, XRef] > A:=<<2,1,0>|<-4,0,3>|<1,-2,0>>; [2 -4 1] [ ] A := [1 0 -2] [ ] [0 3 0] > A^3-A; [-7 34 9] [ ] [-7 -5 24] [ ] [ 6 -33 3] > -A^2+A-4*IdentityMatrix(3); [-2 1 -9] [ ] [-1 6 -3] [ ] [-3 3 2] # 2. > A:=<<1,2>|<1,0>|<-3,-1>>; > B:=<<1,-4,3>|<6,5,-1>|<-3,-2,-1>|<3,7,2>>; [1 1 -3] A := [ ] [2 0 -1] [ 1 6 -3 3] [ ] B := [-4 5 -2 7] [ ] [ 3 -1 -1 2] # a > Transpose(A.B); [-12 -1] [ ] [ 14 13] [ ] [ -2 -5] [ ] [ 4 4] # b # This cannot be done because A transpose has 2 columns and B transpose # has 4 rows. # c > A.Transpose(A); [11 5] [ ] [ 5 5] > Transpose(B).B; [ 26 -17 2 -19] [ ] [-17 62 -27 51] [ ] [ 2 -27 14 -25] [ ] [-19 51 -25 62] > Transpose(B).Transpose(A); [-12 -1] [ ] [ 14 13] [ ] [ -2 -5] [ ] [ 4 4] # 3. > A:=<<0,0,-2>|<-1,4,2>|<-2,4,0>>; [ 0 -1 -2] [ ] A := [ 0 4 4] [ ] [-2 2 0] > infolevel[MyInverse]:=3; > B:=MyInverse(A); infolevel[MyInverse] := 3 Elem step: exchange rows , 1, 3 [-2 2 0] [0 0 1] [ ] [ ] AA=, [ 0 4 4], T=, [0 1 0] [ ] [ ] [ 0 -1 -2] [1 0 0] Elem step: mult row , 1, by , -1/2 [1 -1 0] [0 0 -1/2] [ ] [ ] AA=, [0 4 4], T=, [0 1 0 ] [ ] [ ] [0 -1 -2] [1 0 0 ] Elem step: add , 0, times row , 1, to row , 2 [1 -1 0] [0 0 -1/2] [ ] [ ] AA=, [0 4 4], T=, [0 1 0 ] [ ] [ ] [0 -1 -2] [1 0 0 ] Elem step: add , 0, times row , 1, to row , 3 [1 -1 0] [0 0 -1/2] [ ] [ ] AA=, [0 4 4], T=, [0 1 0 ] [ ] [ ] [0 -1 -2] [1 0 0 ] Finished col , 1 Elem step: mult row , 2, by , 1/4 [1 -1 0] [0 0 -1/2] [ ] [ ] AA=, [0 1 1], T=, [0 1/4 0 ] [ ] [ ] [0 -1 -2] [1 0 0 ] Elem step: add , 1, times row , 2, to row , 1 [1 0 1] [0 1/4 -1/2] [ ] [ ] AA=, [0 1 1], T=, [0 1/4 0 ] [ ] [ ] [0 -1 -2] [1 0 0 ] Elem step: add , 1, times row , 2, to row , 3 [1 0 1] [0 1/4 -1/2] [ ] [ ] AA=, [0 1 1], T=, [0 1/4 0 ] [ ] [ ] [0 0 -1] [1 1/4 0 ] Finished col , 2 Elem step: mult row , 3, by , -1 [1 0 1] [ 0 1/4 -1/2] [ ] [ ] AA=, [0 1 1], T=, [ 0 1/4 0 ] [ ] [ ] [0 0 1] [-1 -1/4 0 ] Elem step: add , -1, times row , 3, to row , 1 [1 0 0] [ 1 1/2 -1/2] [ ] [ ] AA=, [0 1 1], T=, [ 0 1/4 0 ] [ ] [ ] [0 0 1] [-1 -1/4 0 ] Elem step: add , -1, times row , 3, to row , 2 [1 0 0] [ 1 1/2 -1/2] [ ] [ ] AA=, [0 1 0], T=, [ 1 1/2 0 ] [ ] [ ] [0 0 1] [-1 -1/4 0 ] Finished col , 3 [ 1 1/2 -1/2] [ ] B := [ 1 1/2 0 ] [ ] [-1 -1/4 0 ] > A.B; [1 0 0] [ ] [0 1 0] [ ] [0 0 1] # 4. # a. > infolevel[XRef]:=3: > A:=<<-1,-2,-1>|<1,2,1>|<2,2,-2>>; > U:=XRef(A,3,'T'); > T; [-1 1 2] [ ] A := [-2 2 2] [ ] [-1 1 -2] [-1 1 2] [ ] i=, 1, j=, 1, [ 0 0 -2] [ ] [ 0 0 -4] [ 1 0 0] [ ] L=, [-2 1 0] [ ] [-1 0 1] [-1 1 2] [ ] i=, 2, j=, 3, [ 0 0 -2] [ ] [ 0 0 0] [ 1 0 0] [ ] L=, [-2 1 0] [ ] [ 3 -2 1] [-1 1 2] [ ] U := [ 0 0 -2] [ ] [ 0 0 0] [ 1 0 0] [ ] [-2 1 0] [ ] [ 3 -2 1] > T.A; > U; [-1 1 2] [ ] [ 0 0 -2] [ ] [ 0 0 0] [-1 1 2] [ ] [ 0 0 -2] [ ] [ 0 0 0] # b. > E_1:=E_III(3,1,2,-2); > E_2:=E_III(3,1,3,-1); > E_3:=E_III(3,2,3,-2); [ 1 0 0] [ ] E_1 := [-2 1 0] [ ] [ 0 0 1] [ 1 0 0] [ ] E_2 := [ 0 1 0] [ ] [-1 0 1] [1 0 0] [ ] E_3 := [0 1 0] [ ] [0 -2 1] > E_3.E_2.E_1.A; [-1 1 2] [ ] [ 0 0 -2] [ ] [ 0 0 0] # So T = E_3*E_2*E_1. # c. Ax=b, so T*Ax=T*b and so U*x=T*b. Thus we have the following # rightside vectors. > b1:=<<3,5,1>>; > b2:=<<3,10,12>>; [3] [ ] b1 := [5] [ ] [1] [ 3] [ ] b2 := [10] [ ] [12] > T.b1; [ 3] [ ] [-1] [ ] [ 0] # So Ux=T*b1 implies that -2*x_3=-1 implies that x_3=1/2 and x_2=x_2 and # x_1=x_2+2*x_3-3=x_2+1-3=x_2-2. Thus the solution is # x_3=(1/2), x_2=x_2 and x_1=x_2-2; # Now for b2, T*b2 is > T.b2; [3] [ ] [4] [ ] [1] # Since there is a 1 in the third row of the vector T*b2 then the system # has no solutions.