Key to MATLAB Exercise 2 School of Mathematical Sciences Xiamen University httplgdipke.xmuedu Key to matLaB Exercise 2- Solving Linear Systems of Equations > A-round(10 rand(5)) > B=round(20 rand(5))-10 ans=5972 > det(A') ans=5972 b)>>det(A+B ns=36495 >>det(A)det(B) ans=26384 No c)>>det(A"B) ans=121900464 >>det(A)°det(B) ans=121900464 d)>>det(a")*det(B) ans=121900464 > det(a* ans=121900464 e)>> det(inv(A)) ans=1.6745e-004 > inv(det(A)) ans=1.6745e-004 f>>det(A"inv(B) ans=0.2926 >>det(A)inv(det( B)) ans=0.2926 Yes 2. >>A=round(10*rand(6)) a)>>A= round(10*rand(6),B=A;B(2,)=A(1)B(1,)=A(2-) 36 ans=-4636 nterchanging two rows of a matrix changes the sign of the determinant b)>>C=A;C(3,)=4*A(3,) >>det(C ans=18544 >>det(A)*4 ans=18544 Multiplying a single row of a matrix by a scalar has the effect of multiplying the value of the determinant by that scalar c)>>D=A,D(5,)=A(5,:)+2*A(4,) > det(A) ans=4636 ans=4636 Adding a multiple of one row to another does not change the value of the determinant a)>>A=[12;2-2l;b=42;x=Ab A >> det(A) ans=-6 >>A=[12;2-2:b=42l;x=invA)*bKey to MATLAB Exercise 2 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu. Key to Ex21 Key to MATLAB Exercise 2 Solving Linear Systems of Equations 1. >> A=round(10*rand(5)) >> B=round(20*rand(5))10 a) >> det(A) ans =5972 >> det(A') ans = 5972 Yes b) >> det(A+B) ans = 36495 >> det(A)+det(B) ans = 26384 No c) >> det(A*B) ans = 121900464 >> det(A)*det(B) ans = 121900464 Yes d) >> det(A')*det(B') ans = 121900464 >> det(A'*B') ans = 121900464 Yes e) >> det(inv(A)) ans = 1.6745e004 >> inv(det(A)) ans = 1.6745e004 Yes f) >> det(A*inv(B)) ans = 0.2926 >> det(A)*inv(det(B)) ans = 0.2926 Yes 2. >> A=round(10*rand(6)). a) >> A=round(10*rand(6)); B=A;B(2,:)=A(1,:);B(1,:)=A(2,:); >> det(A) ans = 4636 >> det(B) ans = 4636 Interchanging two rows of a matrix changes the sign of the determinant. b) >> C=A; C(3, :)=4*A(3, :) >> det(C) ans = 18544 >> det(A)*4 ans = 18544 Multiplying a single row of a matrix by a scalar has the effect of multiplying the value of the determinant by that scalar. c) >> D=A; D(5, :)=A(5, :)+2*A(4, :) >> det(A) ans =4636 >> det(D) ans=4636 Adding a multiple of one row to another does not change the value of the determinant. 3. a) >> A=[1 2; 2 2]; b=[4;2]; x=A\b x = 2 1 >> A*x ans = 4 2 >> det(A) ans =6 Or >> A=[1 2; 2 2]; b=[4;2]; x=inv(A)*b Or