1
$\begingroup$

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

Given

A={{1,1,1,1,2},{1,2,4,0,5},{2,1,-1,4,0},{-1,1,5,-1,2}};

RowReduce[A]=={{1,0,-2,0,1},{0,1,3,0,2},{0,0,0,1,-1},{0,0,0,0,0}}

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]?

$\endgroup$
0

2 Answers 2

1
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ This is not what I had in mind at all. $\endgroup$ Commented Apr 14, 2017 at 16:22
  • $\begingroup$ @PhillipDukes Do you always speak in riddles? $\endgroup$
    – Igor Rivin
    Commented 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$ Commented Apr 14, 2017 at 18:31
  • $\begingroup$ @J.M. thank you, I hope my example is clear enough. $\endgroup$ Commented Apr 14, 2017 at 20:32
1
$\begingroup$

Long form:

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

In one line:

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

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.