# Revision history [back]

### Row echelon form of a matrix containing symbolic expresssions

Hi,

I want to find out the row echelon form of this matrix:

$\left(\begin{array}{rrrr} 1 & 1 & 2 & b_{1} \\ 1 & 0 & 1 & b_{2} \\ 2 & 1 & 3 & b_{3} \end{array}\right)$

By manually performing elementary row operations on paper, I get this answer:

$\left(\begin{array}{rrrr} 1 & 1 & 2 & b_{1} \\ 0 & 1 & 1 & b_{1} - b_{2} \\ 0 & 0 & 0 & -b_{1} - b_{2} + b_{3} \end{array}\right)$

I thought I can do the following in sage (after creating b1,b2 and b3):

var('b_1,b_2,b_3')
A=matrix(SR,[[1,1,2,b_1],[1,0,1,b_2],[2,1,3,b_3]])
show(A)
A.echelon_form()


But I get:

$\left(\begin{array}{rrrr} 1 & 0 & 1 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{array}\right)$

What is the correct function and/or parameters I should use to get the expected answer?

Thank you.

### Row echelon form of a matrix containing symbolic expresssions

Hi,

I want to find out the row echelon form of this matrix:

$\left(\begin{array}{rrrr} 1 & 1 & 2 & b_{1} \\ 1 & 0 & 1 & b_{2} \\ 2 & 1 & 3 & b_{3} \end{array}\right)$

By manually performing elementary row operations on paper, I get this answer:

$\left(\begin{array}{rrrr} 1 & 1 & 2 & b_{1} \\ 0 & 1 & 1 & b_{1} - b_{2} \\ 0 & 0 & 0 & -b_{1} - b_{2} + b_{3} \end{array}\right)$

I thought I can do the following in sage (after creating b1,b2 and b3):sage:

var('b_1,b_2,b_3')
A=matrix(SR,[[1,1,2,b_1],[1,0,1,b_2],[2,1,3,b_3]])
show(A)
A.echelon_form()


But I get:

$\left(\begin{array}{rrrr} 1 & 0 & 1 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{array}\right)$

What is the correct function and/or parameters I should use to get the expected answer?

Thank you.