# How to track row swap in Gaussian elimination?

How do I track which rows were swapped in the Gaussian elimination using RowReduce?

I am doing metabolic control analysis on a mathematical of the energy metabolism I have in Mathematica.

I need to do several matrix operations including a Gaussian elimination. For my control analysis I need to know which rows were swapped and where they are after the elimination.

Is there a way to let Mathematica also give me the final position of the original rows after the elimination?

Thank you very much,

Anne-Claire

• It's not clear what "original rows" would mean. Gaussian elimination adds linear combinations of rows so a given final row can have parts of multiple original rows. Jul 7 '14 at 14:09

I don't think you can "follow" the steps taken, but you surely can see how the resulting matrix is formed by "augmenting" your matrix with the identity. Following the last example on the docs about RowReduce[]:

m = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}};
a = Transpose[Join[Transpose[m], IdentityMatrix[Length[m]]]];
MatrixForm[r = RowReduce[a]] So for example the first row of the result is obtained by the lc:

-7/2 m[] + 5/2 m[]