##### Activity1.3.2Using Sage to find row reduced echelon matrices
1. Enter the following matrix into Sage.

\begin{equation*} \left[ \begin{array}{rrrr} -1 \amp -2 \amp 2 \amp -1 \\ 2 \amp 4 \amp -1 \amp 5 \\ 1 \amp 2 \amp 0 \amp 3 \end{array} \right] \end{equation*}

2. Let's give our matrix the name $$A$$ by entering

A = matrix( ..., ..., [ ... ])
We may then find the reduced row echelon by entering
A = matrix( ..., ..., [ ... ])
A.rref()

Use Sage to find the reduced row echelon form of the matrix from Item a of this activity.

Another common mistake is to forget the parentheses after rref.

Here are some practices that you may find helpful when working with matrices in Sage.

• Break the matrix entries across lines, one for each row, for better readability by pressing Enter between rows.

A = matrix(2, 4, [ 1, 2, -1, 0,
-3, 0,  4, 3 ])

• Print your original matrix to check that you have entered it correctly. You may want to also print a dividing line to separate matrices.

A = matrix(2, 2, [ 1, 2,
2, 2])
print A
print "---------"
A.rref()

3. Use Sage to describe the solution space of the system of linear equations

\begin{equation*} \begin{alignedat}{5} -x_1 \amp \amp \amp \amp \amp {}+{} \amp 2x_4 \amp {}={} \amp 4 \\ \amp \amp 3x_2 \amp {}+{} \amp x_3 \amp {}+{} \amp 2x_4 \amp {}={} \amp 3 \\ 4x_1 \amp {}-{} \amp 3x_2 \amp \amp \amp {}+{} \amp x_4 \amp {}={} \amp 14 \\ \amp \amp 2x_2 \amp {}+{} \amp 2x_3 \amp {}+{} \amp x_4 \amp {}={} \amp 1 \\ \end{alignedat} \end{equation*}

4. Consider the two matrices:

\begin{equation*} \begin{array}{rcl} A \amp = \amp \left[ \begin{array}{rrrr} 1 \amp -2 \amp 1 \amp -3 \\ -2 \amp 4 \amp 1 \amp 1 \\ -4 \amp 8 \amp -1 \amp 7 \\ \end{array}\right] \\ B \amp = \amp \left[ \begin{array}{rrrrrr} 1 \amp -2 \amp 1 \amp -3 \amp 0 \amp 3 \\ -2 \amp 4 \amp 1 \amp 1 \amp 1 \amp -1 \\ -4 \amp 8 \amp -1 \amp 7 \amp 3 \amp 2 \\ \end{array}\right] \\ \end{array} \end{equation*}

We say that $$B$$ is an augmented matrix of $$A$$ because it is obtained from $$A$$ by adding some more columns.

Using Sage, define the matrices and compare their reduced row echelon forms. What do you notice about the relationship between the two reduced row echelon forms?

5. Using the system of equations in Item c, write the augmented matrix corresponding to the system of equations. What did you find for the reduced row echelon form of the augmented matrix?

Now write the coefficient matrix of this system of equations. What does Item d of this activity tell you about its reduced row echelon form?

in-context