Let’s do a simple matrix inverse...

A = {{1,2},{0,-3}}

Inverse[A]//MatrixForm

I2 = IdentityMatrix[2]

(AI2 = Join[A,I2,2])//MatrixForm

RowReduce[AI2]//MatrixForm

B = {{8,7,5},{3,8,9},{4,2,3}}

Det[B]

Inverse[B]//MatrixForm

I3 = IdentityMatrix[3];

(BI3 =Join[B,I3,2])//MatrixForm

(Temp = RowReduce[BI3])//MatrixForm

Drop[Temp[[{1,2,3},{4,5,6}]]]//MatrixForm

(BI3a =Join[B,{{0},{0},{1}},2])//MatrixForm

RowReduce[BI3a]//MatrixForm

BI3//MatrixForm

E1 = {{1/8,0,0},{0,1,0},{0,0,1}}

E1.BI3//MatrixForm

E2 = {{1,0,0},{-3,1,0},{-4,0,1}}

E2.E1.BI3//MatrixForm

E3 = {{1,0,0},{0,8/43,0},{0,0,1}}

E3.E2.E1.BI3//MatrixForm

E4 = {{1,-7/8,0},{0,1,0},{0,3/2,1}}

E4.E3.E2.E1.BI3//MatrixForm

E5 = {{1,0,0},{0,1,0},{0,0,43/107}}

E5.E4.E3.E2.E1.BI3//MatrixForm

E6 = {{1,0,23/43},{0,1,-57/43},{0,0,1}}

E6.E5.E4.E3.E2.E1.BI3//MatrixForm

RowReduce[BI3]//MatrixForm

Det[B]

PrimeQ[107]