> with(linalg);
Consider the following augmented matrix of a system of equations. We need to transform it into the reduced row-echelon form by the row operations.

> A:=matrix(5,8,[[4,8,-2,-5,0,-23,2,37],[1,2,2,5,-5,13,-2,3],[2,4,-2,-5,2,-19,2,21],[3,6,1,0,0,-1,0,22],[4,8,1,2,-5,-1,-1,30]]);

 A := [ 4 8 -2 -5 0 -23 2 37 ] [ 1 2 2 5 -5 13 -2 3 ] [ 2 4 -2 -5 2 -19 2 21 ] [ 3 6 1 0 0 -1 0 22 ] [ 4 8 1 2 -5 -1 -1 30 ]

> B:=mulrow(A,1,1/4);

 B := [ 1 2 -1/2 -5/4 0 -23/4 1/2 37/4 ] [ 1 2 2 5 -5 13 -2 3 ] [ 2 4 -2 -5 2 -19 2 21 ] [ 3 6 1 0 0 -1 0 22 ] [ 4 8 1 2 -5 -1 -1 30 ]

 B := [ 1 2 -1/2 -5/4 0 -23/4 1/2 37/4 ] [ 0 0 5/2 25/4 -5 75/4 -5/2 -25/4 ] [ 2 4 -2 -5 2 -19 2 21 ] [ 3 6 1 0 0 -1 0 22 ] [ 4 8 1 2 -5 -1 -1 30 ]

 B := [ 1 2 -1/2 -5/4 0 -23/4 1/2 37/4 ] [ 0 0 5/2 25/4 -5 75/4 -5/2 -25/4 ] [ 0 0 -1 -5/2 2 -15/2 1 5/2 ] [ 3 6 1 0 0 -1 0 22 ] [ 4 8 1 2 -5 -1 -1 30 ]

 B := [ 1 2 -1/2 -5/4 0 -23/4 1/2 37/4 ] [ 0 0 5/2 25/4 -5 75/4 -5/2 -25/4 ] [ 0 0 -1 -5/2 2 -15/2 1 5/2 ] [ 0 0 5/2 15/4 0 65/4 -3/2 -23/4 ] [ 4 8 1 2 -5 -1 -1 30 ]

 B := [ 1 2 -1/2 -5/4 0 -23/4 1/2 37/4 ] [ 0 0 5/2 25/4 -5 75/4 -5/2 -25/4 ] [ 0 0 -1 -5/2 2 -15/2 1 5/2 ] [ 0 0 5/2 15/4 0 65/4 -3/2 -23/4 ] [ 0 0 3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 0 0 1 -2 1 -2/5 -1/5 ] [ 0 0 0 0 0 0 0 0 ] [ 0 0 0 0 0 0 -1/5 2/5 ]

> B:=swaprow(B,4,5);

 B := [ 1 2 -1/2 -5/4 0 -23/4 1/2 37/4 ] [ 0 0 1 5/2 -2 15/2 -1 -5/2 ] [ 0 0 0 1 -2 1 -2/5 -1/5 ] [ 0 0 0 0 0 0 -1/5 2/5 ] [ 0 0 0 0 0 0 0 0 ]

> B:=mulrow(B,4,-5);

 B := [ 1 2 -1/2 -5/4 0 -23/4 1/2 37/4 ] [ 0 0 1 5/2 -2 15/2 -1 -5/2 ] [ 0 0 0 1 -2 1 -2/5 -1/5 ] [ 0 0 0 0 0 0 1 -2 ] [ 0 0 0 0 0 0 0 0 ]
Now the matrix is in the row echelon form but not yet in the reduced row echelon form. So we have to continue.

 B := [ 1 2 0 0 -1 -2 0 0 ] [ 0 0 1 5/2 -2 15/2 -1 -5/2 ] [ 0 0 0 1 -2 1 -2/5 -1/5 ] [ 0 0 0 0 0 0 1 -2 ] [ 0 0 0 0 0 0 0 0 ]

 B := [ 1 2 0 0 -1 -2 0 0 ] [ 0 0 1 0 3 5 0 -2 ] [ 0 0 0 1 -2 1 -2/5 -1/5 ] [ 0 0 0 0 0 0 1 -2 ] [ 0 0 0 0 0 0 0 0 ]

```                              x1=8-2s+t+2u