Mathematica has RowReduce[], how can I use this to calculate a basis for the range of any matrix?




The leading 1's in the reduced row echelon form select the first, second, and fourth column vectors of A as a basis for the range of A. How do I program mathematica to make that selection after calculating RowReduce[A]?


2 Answers 2


Firstly, there is no such thing as the basis. Secondly, the range of a transformation is generated by the columns, so RowReduce[Transpose[M]] ought to do it.

  • $\begingroup$ This is not what I had in mind at all. $\endgroup$ Apr 14, 2017 at 16:22
  • $\begingroup$ @PhillipDukes Do you always speak in riddles? $\endgroup$
    – Igor Rivin
    Apr 14, 2017 at 17:12
  • 1
    $\begingroup$ "This is not what I had in mind at all." - then @Phillip, can you come up with a formulation that won't confuse answerers? $\endgroup$ Apr 14, 2017 at 18:31
  • $\begingroup$ @J.M. thank you, I hope my example is clear enough. $\endgroup$ Apr 14, 2017 at 20:32

Long form:

A = (* your matrix *)
reduced = RowReduce[A];
positions = DeleteMissing[FirstPosition[1] /@ reduced];

In one line:

basis[A_] := 
 A[[Catenate[DeleteMissing[FirstPosition[1] /@ RowReduce[A]]]]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.