In-class Demonstration: InversesBy Russell Blythrestart: with(LinearAlgebra):We start with a random 3 x 3 matrix.A:= RandomMatrix(3,3,generator=rand(-3..3));Our task is to find the inverse of the matrix A. The equation Y = AX computes Y given X. We need to compute X given Y. Define a general Y, and solve for X: Y := Vector(3,<y1,y2,y3>);
AugA := <A|Y>;
RedA := ReducedRowEchelonForm(AugA);Next we extract the expression for X in terms of YXvec := DeleteColumn(RedA,1..3);y1vec := eval(Xvec,{y1=1,y2=0,y3=0});
y2vec := eval(Xvec,{y1=0,y2=1,y3=0});
y3vec := eval(Xvec,{y1=0,y2=0,y3=1});Thus Xvec = y1*y1vec + y2*y2vec + y3*y3vec. If we make a matrix with y1vec, y2vec, y3vec as the columns, then y1, y2 and y3 are the coefficients of the linear combination giving X. We write this as BY, whereB := <y1vec | y2vec | y3vec>;Check:B.Y;This is just the transpose of Xvec. Thus X = BY. B is the inverse of A!Check the products AB and BA:A.B;
B.A;Note the first column of B arises from solving AX = NiMpNyUiIiIiIiFGJiUidEc=; the second column from solving AX =NiMpNyUiIiEiIiJGJSUidEc= and the third column from solving AX = NiMpNyUiIiFGJSIiIiUidEc=. These three systems may be solved simultaneously, by finding the reduced row echelon form of the matrix [A,I]I3 := IdentityMatrix(3);
BigA := <A | I3>;
RedBigA := ReducedRowEchelonForm(BigA);
Note the final three columns are precisely the inverse matrix B.Maple computes matrix inverses directly:A^(-1);