% Question3b A = [ 1,2,3; 4,5,6; 1,0,50 ] % do the gaussian elimination % Note that gauss uses a copy of A [Aupper,r] = luFactor(A) % Solve 3 systems e1 = [1,0,0]' e2 = [0,1,0]' e3 = [0,0,1]' x1 = luSolve(Aupper,r,e1) x2 = luSolve(Aupper,r,e2) x3 = luSolve(Aupper,r,e3) % check inverse with the matlab inv function Ainv = [x1,x2,x3] AinvCheck = inv(A)