Ask Your Question

Revision history [back]

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