A := matrix(4,5,[2,-1,3,4,9, 1,0,-2,7,11, 3,-3,1,5,8, 2,1,4,4,10]); alias(P=swaprow,Q=mulrow,R=addrow); A1 := P(A,1,2); A2 := R(A1,1,2,-2); A3 := R(A2,1,3,-3); A4 := R(A3,1,4,-2); A5 := Q(A4,2,-1); A6 := R(A5,2,3,3); A7 := R(A6,2,4,-1); A8 := Q(A7,3,-1/14); A9 := R(A8,3,4,-15); A10 := Q(A9,4,-1/5); SOL := backsub(A10); Id := matrix(4,4,[1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]); E1 := P(Id,1,2); E2 := R(Id,1,2,-2); E3 := R(Id,1,3,-3): E4 := R(Id,1,4,-2): E5:=Q(Id,2,-1):E6:=R(Id,2,3,3): E7:=R(Id,2,4,-1):E8:=Q(Id,3,-1/14):E9:=R(Id,3,4,-15):E10:=Q(Id,4,-1/5): A11 := R(A10,3,2,7); A12 := R(A11,3,1,2); A13 := R(A12,4,1,-5); A14 := R(A13,4,2,-3); A15 := R(A14,4,3,1); E11:=R(Id,3,2,7):E12:=R(Id,3,1,2):E13:=R(Id,4,1,-5):E14:=R(Id,4,2,-3): E15 := R(Id,4,3,1): Minv := E15 &* E14 &* E13 &* E12 &* E11 &* E10 &* E9 &* E8 &* E7 &* E6 &* E5 &* E4 &* E3 &* E2 &* E1: M := submatrix(A,1..4,1..4); evalm(M &* Minv); evalm(Minv); inverse(M);