# How to get the left matrix that was used to obtain reduced row echelon form?

Hi all.

I have a matrix A and would like to determine a matrix E such that E*A = R, where R is the reduced row echelon form of the matrix A. I just know the command R = A.rref(). But I don't know how to get E (my stupid solution is to compute the inverse of the pivot columns of A ...). Is there e.g. an argument such that A.rref() also outputs E?

Thanks a lot, Julian

edit retag close merge delete

Sort by » oldest newest most voted

You can use the echelon_form method with transformation=True.

Example:

sage: A = Matrix([[1, 2, 3], [3, 2, 1], [1, 1, 1]])
sage: A
[1 2 3]
[3 2 1]
[1 1 1]
sage: A.echelon_form(transformation=True)
(
[ 1  0 -1]  [ 0  1 -2]
[ 0  1  2]  [ 0 -1  3]
[ 0  0  0], [ 1  1 -4]
)

more

Thanks for your quick answer. However, it does not really what I would like to have :-/ Am I doing something wrong or does It not work if A is over GF(q). (gives A.echelon_form(transformation=True) always reduced row echelon form or just echelon form?)

Thanks :)

There are two bugs in Sage regarding this:

• The method for reduced row echelon form, rref, calls the method echelon_form, and is supposed to pass on the arguments it is given, such as transformation=True, but it does not.

• The method echelon_form itself does not always honor the request to return the transformation (i.e., the argument transformation=True).

See