Is it legal to interchange rows during finding inverse matrix

inverselinear algebramatrices

I'm calculating an inverse matrix using Gauss-Jordan algorithm.
I'd like to use pivoting (with swapping rows, just like in standard Gauss algorithm) in order to avoid division by zero in some cases.
But I also noticed that interchanging rows affects inverse matrix and I don't fully understand how could I avoid division by zero on when running Gauss-Jordan algorithm backwards (when I transform reduced row echelon form of matrix A to identity matrix).

Best Answer

I would suggest you watch the MIT OpenCourseware by Sir Gilbert Strang or 3B1B series on Linear Algebra there you'll find how matrix product can be represented as the product of a linear combination of rows and columns I'm sure you'll enjoy it!

Why is not illegal? $$AB = C$$ Now, when you perform any row transformation on matrix $A$ then the same row transformation will reflect in matrix $C$ How?

$$C_{ij} = \sum_{k = 1}^{m}A_{ik}B_{kj}$$ Or should I write it as $$\sum_{k = 1}^{m}A_{ik}B_{kj} = C_{ij}$$ The above formula tells that whatever changes you will make to matrix $A$ for row transformation the same matrix $C$ will reflect;

Similarly, for the column transformation on matrix $B$ will be the column transformation for matrix $C = AB$

  • Fact: An illegal act on any step of mathematics would end you to an illegal result which in the above case it doesn't happen so must be legal.