Lab 1, problem 2 for MW: Reduced row echelon form

edited August 2019 in Assignments

(10 pts)

This is where we'll report our answers to problem 2 of lab 1. The question itself deals with a randomly generated matrix (personalized for each student) and you are asked to do the following:

  • Describe the the problem with prose and your initial typeset matrix.
  • Include the code you used to solve the problem as a code block.
  • Include the output of your command, also as a code block.
  • Describe your interpretation of the output, viewing the matrix as the augmented matrix representation of a linear system.

Comments

  • edited August 2019

    I was asked to use Sage to find the reduced row echelon form of the following matrix:

    $$\left(\begin{matrix}7 & 3 & -5 & 7 & 4 & 14 \\ 4 & 4 & 4 & -2 & -2 & -4 \\ 12 & -5 & 0 & 2 & 6 & 4 \\ -8 & 9 & 4 & -4 & -8 & -8\end{matrix}\right)$$

    To do this, I put the below block of code into Sage.

    M = Matrix([
         [7, 3, -5, 7, 4, 14],
         [4, 4, 4, -2, -2, -4],
         [12, -5, 0, 2, 6, 4],
         [-8, 9, 4, -4, -8, -8],
    ]);
    M.rref()
    

    And got this as the output:

    [       1        0        0   77/312   37/104   77/156]
    [       0        1        0     5/26    -9/26     5/13]
    [       0        0        1 -293/312  -53/104 -293/156]
    [       0        0        0        0        0        0]
    

    This output tells me that $x_4 x_5$ are free variables, and that the last column in the matrix is a vector of constants. $x_1 x_2 x_3$ can be solved in terms of $x_4$ and $x_5$.

    $$\begin{align}x_{1} &= -77/312x_{4} - 37/104x_{5} + 77/156\\
    x_{2} &= -5/26x_{4} + 53/104x_{5} + 5/13\\
    x_{3} &= 293/312x_{4} + 53/104x_{5} - 293/156\\
    x_{4} &= x_{4}\\
    x_{5} &= x_{5}\end{align}$$

    Therefore, there are infinitely many solutions.

    mark
  • edited August 2019

    A matrix is provided with 4 rows and 6 columns. I was asked to find the RREF of the matrix using Sage.
    Initial Matrix:

    $$\left(\begin{matrix}-7 & 8 & 5 & -4 & -2 & 7 \\ 3 & 7 & 7 & -8 & -4 & -4 \\ -14 & 4 & 12 & 8 & 4 & 5 \\ 7 & 4 & -7 & -12 & -6 & 2\end{matrix}\right)$$

    Sage code:

    M = Matrix([
         [-7, 8, 5, -4, -2, 7],
         [3, 7, 7, -8, -4, -4],
         [-14, 4, 12, 8, 4, 5],
         [7, 4, -7, -12, -6, 2],
    ]);
    M.rref()
    

    RREF:

    $$\left(\begin{matrix}1 & 0 & 0 & -276/457 & -138/457 & -801/914 \\ 0 & 1 & 0 & -580/457 & -290/457 & 281/457 \\ 0 & 0 & 1 & 176/457 & 88/457 & -741/914 \\ 0 & 0 & 0 & 0 & 0 & 0\end{matrix}\right)$$

    Solutions for the system:

    $$x1 - \frac{276}{457}x4 - \frac{138}{457}x5 = -801/914\\
    x2 - \frac{580}{457}x4 - \frac{290}{457}x5 = 281/457\\
    x3 + \frac{176}{457}x4 + \frac{88}{457}x5 = -\frac{741}{914}\\
    0 = 0$$

    This solution shows that the matrix can be put in RREF. As can be seen, x1, x2, and x3 describe bound variables while x4 and x5 are free variables.

    mark
  • edited August 2019

    Problem 2:
    Use Sage to find the reduced row echelon form of the following matrix:

    $$\left(\begin{matrix}4 & 7 & -8 & 3 & -3 & -4 \\ 7 & -8 & -2 & 3 & 6 & -1 \\ -2 & 3 & 14 & 0 & 7 & 7 \\ 6 & 4 & -22 & 3 & -10 & -11\end{matrix}\right)$$

    My Code:

    pizza = Matrix([
     [4, 7, -8, 3, -3, -4],
     [7, -8, -2, 3, 6, -1],
     [-2, 3, 14, 0, 7, 7],
     [6, 4, -22, 3, -10, -11],
    ]);
    pizza.rref()
    

    Output from Sage:

    [      1       0       0 114/187 160/187       0]
    [      0       1       0  27/187 -31/187       0]
    [      0       0       1  21/374 123/187     1/2]
    [      0       0       0       0       0       0]
    

    This output from my matrix, pizza, isn't very pretty. That's because if we look at the original matrix as an augmented matrix representing a linear system, we'll notice that the system has 5 unknowns, but only 4 equations to work with. Because of this, we have returned a solution for the system that has the following equations:

    $$
    x1 + \frac{114}{187}x4 + \frac{160}{187}x5 = 0\\
    x2 + \frac{27}{187}x4 - \frac{-31}{187}x5 = 0\\
    x3 + \frac{21}{374}x4 + \frac{123}{187}x5 = \frac{1}{2}\\
    0 = 0\\
    $$

    From this, we have x1, x2, and x3 as the bound variables, and x4 & x5 as the free variables.

    mark
  • edited August 2019

    I was asked to find the Reduced Row Echelon Form of

    $$\left(
    \begin{array}{cccccc}
    9 & -8 & -5 & 2 & -4 & -3 \\
    -3 & 10 & 5 & 7 & 5 & 5 \\
    6 & 2 & 0 & 9 & 1 & 2 \\
    -7 & 6 & 1 & -7 & 3 & -3 \\
    \end{array}
    \right)$$

    The code I input into sage was

    M = Matrix([
         [9, -8, -5, 2, -4, -3],
         [-3, 10, 5, 7, 5, 5],
         [6, 2, 0, 9, 1, 2],
         [-7, 6, 1, -7, 3, -3],
    ]);
    M.rref()
    

    which produced the result

    [    1     0     0 33/23     0 10/23]
    [    0     1     0  9/46   1/2 -7/23]
    [    0     0     1 43/23     0 43/23]
    [    0     0     0     0     0     0]
    

    This output indicates that x_{4} and x_{5} are free variables, and the Reduced Row Echelon Form of the given matrix is

    $$\left(
    \begin{array}{cccccc}
    1 & 0 & 0 & \frac{33}{23} & 0 & \frac{10}{23}\\
    0 & 1 & 0 & \frac{9}{46} & \frac{1}{2} & \frac{-7}{23}\\
    0 & 0 & 1 & \frac{43}{23} & 0 & \frac{43}{23}\\
    0 & 0 & 0 & 0 & 0 & 0\\
    \end{array}
    \right)$$

    If looking at the initial matrix as an augmented matrix of a system, then this can also be expressed as the possible solutions to that system

    \begin{align}x_{1} = \frac{10}{23} - \frac{33}{23} * x_{4}\\
    x_{2} = \frac{-7}{23} - \frac{9}{46} * x_{4} - \frac{1}{2} * x_{5}\\
    x_{3} = \frac{43}{23} - \frac{43}{23} * x_{4}\\
    x_{4} = x_{4}\\
    x_{5} = x_{5}\end{align}

    mark
  • edited September 2019

    Given the following matrix:
    $$
    \left(\begin{matrix}-2 & 4 & -1 & -1 & -2 & 8 \\ 7 & -1 & -6 & -1 & 7 & -2 \\ 2 & -8 & -5 & -6 & 4 & -16 \\ -9 & 5 & 5 & 0 & -9 & 10\end{matrix}\right)
    $$

    The resulting solution are
    $$
    \left(\begin{matrix}-1 & 0 & 0 & 165/232 & 91/116 & 0 \\ 0 & 1 & 0 & 79/232 & -19/116 & 2 \\ 0 & 0 & 1 & 109/116 & -13/58 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0\end{matrix}\right)
    $$

    My interpretation of this result is that there is one unique solution, thanks to RREF. This solution indicates that x1,x4,x3 have solutions whereas x2 and x5 are undefined, free variables which parameterize the system.

    My code looked like this

    M = Matrix([
    [-2, 4, -1, -1, -2, 8],
    [7, -1, -6, -1, 7, -2],
    [2, -8, -5, -6, 4, -16],
    [-9, 5, 5, 0, -9, 10],
    ]);
    M.rref()
    
  • edited August 2019

    I was given a matrix of 4 equations, with 5 variables, and asked to solve them using sage. The matrix was given as:

    $$
    \left(\begin{matrix}4 & -18 & 0 & -9 & 4 & 6 \\ -1 & 12 & 0 & 6 & -10 & -11 \\6 & 8 & 4 & 4 & -7 & 3 \\ 3 & -6 & 0 & -3 & -6 & -5\end{matrix}\right)
    $$

    To solve this matrix, the following code was inputed into sage:

    M = Matrix([
     [4, 18, 0, -9, 4, 6],
     [-1, 12, 0, 6, -10, -11],
     [6, 8, 4, 4, -7, 3],
     [3, -6, 0, -3, -6, -5],
    ]);
    M.rref()
    

    And in turn, the following code was outputted as a solution:

    [     1      0      0      0  -22/5  -21/5]
    [     0      1      0      0      0      0]
    [     0      0      1      0   29/4 115/12]
    [     0      0      0      1  -12/5 -38/15]
    

    This solution means that x1, x2, and x3 are solutions of x4 and x5. In other words, since x4 and x5 are undefined; free variables; this system has infinitely many solutions.

  • edited August 2019

    Given an augmented matrix of 4 by 6 we were asked to solve the matrix, which is below:

    $$
    \left(
    \begin{matrix}
    -16 & -8 & 1 & 9 & 5 & 2 \\
    16 & 8 & -7 & -5 & 5 & 7 \\
    -2 & -1 & 9 & -6 & 8 & 0 \\
    18 & 9 & -16 & 1 & -3 & 7
    \end{matrix}
    \right)
    $$

    The SageMath code is below:

    M = Matrix([
         [-16,-8,1,9,5,2],
         [16,8,-7,-5,5,7],
         [-2,-1,9,-6,8,0],
         [18,9,-16,1,-3,7],
    ]);
    M.rref()
    

    The resulting solution is below in LaTEX and as a code block

    $$
    \left(
    \begin{matrix}
    1 & \frac{1}{2} & 0 & 0 & -\frac{23}{2} & -\frac{27}{4} \\
    0 & 0 & 1 & 0 & -\frac{403}{29} & -\frac{627}{58} \\
    0 & 0 & 0 & 1 & -\frac{532}{29} & -\frac{627}{58} \\
    0 & 0 & 0 & 0 & 0 & 0
    \end{matrix}
    \right)
    $$

    [      1     1/2        0       0   -23/2   -27/4]
    [      0       0        1        0 -403/29 -505/58]
    [      0       0        0        1 -532/29 -627/58]
    [      0       0        0        0       0       0]
    

    With this solution, $x_1, x_3,$ and $x_4$ have solutions, and $x_2$ and $x_5$ are undefined, also called free variables, so there are infinite solutions. The individual solutions are:

    $$
    \begin{align}
    x_1 &= -\frac{1}{2}x_2 + \frac{23}{2}x_5 - \frac{27}{4} \\
    x_2 &= x_2 \\
    x_3 &=\frac{403}{29} x_5-\frac{505}{58} \\
    x_4 &= \frac{532}{29}x_5 -\frac{627}{58} \\
    x_5 &= x_5
    \end{align}
    $$

    mark
  • edited August 2019

    I was given the following matrix and asked produce an augmented one in Reduced Row Echelon Form:

    $$\left(\begin{matrix}2 & 6 & 0 & 5 & 6 & 4 \\ 3 & 2 & -6 & 2 & -7 & 6 \\ -5 & 9 & -2 & 9 & -8 & -10 \\ 5 & 8 & -6 & 7 & -1 & 10\end{matrix}\right)$$

    So I input the following code into sage:

    M = Matrix([
             [2, 6, 0, 5, 6, 4],
         [3, 2, -6, 2, -7, 6],
         [-5, 9, -2, 9, -8, -10],
         [5, 8, -6, 7, -1, 10],
    ]);
    M.rref()
    

    Which output the following augmented matrix in RREF:

    [      1       0       0 -25/158  126/79       2]
    [      0       1       0   70/79   37/79       0]
    [      0       0       1 -37/316 335/158       0]
    [      0       0       0       0       0       0]
    

    This augmented matrix can be easily read to elucidate our parameterized solution, which is:

    \begin{align}x_{1} &= 2 + 25/158x_{4} - 126/79x_{5}\\
    x_{2} &= -70/79x_{4} - 37/79x_{5}\\
    x_3 &= 37/316x_{4} - 335/158x_{5}\\
    x_{4} &= x_{4}\\
    x_{5} &= x_{5}\end{align}

    This means there are infinite solutions of the augmented matrix where $x_1$,$x_2$, and $x_3$ are all dependent of the free variables $x_4$ & $x_5$. We can further deduce that the original linear system defined by the original matrix has infinite solutions with the same dependent and free variables.

    mark
  • edited August 2019

    I was tasked with solving the following matrix using Sage:
    $$\left(\begin{matrix}0 & -3 & -3 & -9 & -18 & -8 \\ 3 & 11 & 1 & 10 & 20 & 0 \\ 3 & 8 & -2 & 1 & 2 & -8 \\ -5 & -1 & 7 & -2 & -4 & 8\end{matrix}\right)$$

    In order to do so, I used the following lines of code:

    M = Matrix([
     [0, -3, -3, -9, -18, -8],
     [3, 11, 1, 10, 20, 0],
     [3, 8, -2, 1, 2, -8],
     [-5, -1, 7, -2, -4, 8],
    ]);
    M.rref()
    

    Which gives the output:

    [     1      0      0  87/13 174/13  64/13]
    [     0      1      0 -17/13 -34/13 -68/39]
    [     0      0      1  56/13 112/13 172/39]
    [     0      0      0      0      0      0]
    

    The matrix has an infinite number of solutions, as $x_4$ and $x_5$ are free variables. The solution to the matrix can be written as:
    $$x_1= (-87/13)x_4 - (174/13)x_5 + (64/13)\\x_2= (17/13)x_4 + (34/13)x_5 - (68/39)\\x_3= (-56/13)x_4 - (112/13)x_5 + (172/39)\\x_4= x_4\\x_5= x_5$$

    mark
  • edited August 2019

    I was given a system of equations in the form of a matrix, shown below:

    $$
    \left(\begin{matrix} 1 & -13 & -2 & -14 & -6 & -4 \\ 1 & -7 & 3 & -2 & 6 & 6 \\ -4 & -5 & 4 & -8 & -4 & 8 \\ -5 & 8 & 6 & 6 & 2 & 12 \end{matrix}\right)
    $$

    I was asked to use Sage to find its reduced row echelon form, so I input the following code:

    M = Matrix([
        [1, -13, -2, -14, -6, -4],
        [1, -7, 3, -2, 6, 6],
        [-4, -5, 4, -8, -4, 8],
        [-5, 8, 6, 6, 2, 12],
    ]);
    M.rref()
    

    I clicked "evaluate" and Sage returned the following output:

    [      1       0       0 482/261 662/261       0]
    [      0       1       0 272/261  92/261       0]
    [      0       0       1  100/87  172/87       2]
    [      0       0       0       0       0       0]
    

    Thus, the reduced row echelon form of this matrix can also be expressed as:

    $$
    \begin{align} x_{1} + \frac{482}{261}x_{4} + \frac{662}{261}x_{5} &= 0\\
    x_{2} + \frac{272}{261}x_{4} + \frac{92}{261}x_{5} &= 0\\
    x_{3} + \frac{100}{87}x_{4} + \frac{172}{87}x_{5} &= 2\\
    0 &= 0 \end{align}
    $$

    Variables $x_{1}$, $x_{2}$, and $x_{3}$ are bound variables, while variables $x_{4}$ and $x_{5}$ are free variables. Therefore, there are infinitely many solutions to this system of equations.

    mark
  • edited September 2019

    Here is the 4 x 6 matrix given in problem 2:
    $$
    \left(\begin{matrix}16 & -4 & 8 & -9 & 6 & 7 \\ 12 & 8 & 6 & 4 & -2 & 4 \\ -4 & 2 & -2 & -5 & 1 & -3 \\ -16 & -6 & -8 & -9 & 3 & -7\end{matrix}\right)
    $$
    My first task is to convert this matrix to reduced row echelon form. I can do this in Sage. Here is my code:

    M = Matrix([
         [16, -4, 8, -9, 6, 7],
         [12, 8, 6, 4, -2, 4],
         [-4, 2, -2, -5, 1, -3],
         [-16, -6, -8, -9, 3, -7],
    ]);
    M.rref()
    

    When I hit the "evaluate" button, here is the result:

    [      1       0     1/2       0  39/362  82/181]
    [      0       1       0       0 -81/362 -45/181]
    [      0       0       0       1 -68/181  25/181]
    [      0       0       0       0       0       0]
    

    This result is the matrix I am looking for (in reduced row echelon form):
    $$
    \left(\begin{matrix}1 & 0 & 1/2 & 0 & 39/362 & 82/181 \\ 0 & 1 & 0 & 0 & -81/362 & -45/181 \\ 0 & 0 & 0 & 1 & -68/181 & 25/181 \\ 0 & 0 & 0 & 0 & 0 & 0\end{matrix}\right)
    $$

    The matrix can be considered to be augmented. Therefore its affiliated system has 4 equations and 5 unknowns. Here is the system:
    $$
    \begin{align}x_{1} +0x_{2} +(1/2)x_{3} + 0x_{4} + (39/362)x_{5} &= 82/181\\
    0x_{1} + x_{2} + 0x_{3} + 0x_{4} - (81/362)x_{5} &= -45/181\\
    0x_{1} + 0x_{2} + 0x_{3} + x_{4} -(68/181)x_{5} &= 25/181\\
    0x_{1} + 0x_{2} + 0x_{3} + 0x_{4} + 0x_{5} &= 0\end{align}
    $$
    This system is easy to solve since its affiliated matrix is in reduced row echelon form. I use algebra to find the solution. 0 = 0 so x5 = r1. Moving up, x4 = (68/181)x5 + (25/181). In terms of r1, x4 = (68/181)r1 + (25/181). Moving up, it appears x3 is a free variable so x3 = r2. Moving up, x2 = (81/362)x5 - (45/181). In terms of r1, x2 = (81/362)r1 - (45/181). Moving up, x1 = (-1/2)x3 - (39/362) + (82/181). In terms of r2, x1 = (-1/2)r2 - (39/362) + (82/181).

    The solution to the system is ((-1/2)r2 - (39/362) + (82/181), (81/362)r1 - (45/181), r2, (68/181)r1 + (25/181), r1). This solution has 2 free variables (x5 and x3) corresponding to r1 and r2, respectively. This means the system has infinitely many solutions.

    mark
  • edited August 2019

    I was given the following matrix and asked to use Sage to find its reduced row echelon form:

    $$\left(\begin{matrix}8 & 4 & -16 & 4 & -8 & -1 \\ -7 & -9 & -14 & -3 & 0 & -5 \\ -12 & 10 & -24 & -3 & -17 & -5 \\ 4 & -6 & 8 & 7 & 9 & 4\end{matrix}\right)$$

    My Sage input:

    M = Matrix([
         [-8, 4, -16, 4, -8, -1],
         [-7, -9, -14, -3, 0, -5],
         [-12, 10, -24, -3, -17, -5],
         [4, -6, 8, 7, 9, 4],
    ]);
    M.rref()
    

    My results:

    [       1        0        2        0  216/277 437/1108]
    [       0        1        0        0 -191/277 115/1108]
    [       0        0        0        1   69/277  241/554]
    [       0        0        0        0        0        0]
    

    This system has infinitely many solutions with $x_3$ and $x_5$ as free variables:

    $$
    \begin{align}x_{1} &= \frac{437}{1108} -2x_{3} - \frac{216}{277}x_{5}\\
    x_{2} &= \frac{115}{1108} + \frac{191}{277}x_{5}\\
    x_{4} &= \frac{241}{544} - \frac{69}{277}x_{4} \end{align}
    $$

    mark
  • edited August 2019

    I was asked to use Sage to find the reduced row echelon form of this matrix:

    $$ \left(\begin{matrix}-6 & 2 & 16 & 5 & 8 & -5 \\ 7 & 7 & -8 & -1 & -4 & -3 \\ -2 & 2 & 14 & -6 & 7 & 5 \\ 13 & 5 & -24 & -6 & -12 & 2\end{matrix}\right) $$

    I found the solution by typing in this code:

    M = Matrix([
         [-6, 2, 16, 5, 8, -5],
         [7, 7, -8, -1, -4, -3],
         [-2, 2, 14, -6, 7, 5],
         [13, 5, -24, -6, -12, 2],
    ]);
    M.rref()
    

    The solution produced was the following:

    [       1        0        0 -667/200        0  611/200]
    [       0        1        0  371/200        0 -443/200]
    [       0        0        1 -117/100      1/2  111/100]
    [       0        0        0        0        0        0]
    

    This can also be written as:

    x1 = (611/200) + (667/200)x4
    x2 = (-443/200) - (371/200)x4
    x3 = (111/100) + (117/100)x4 - (1/2)x5
    x4 = x4
    x5 = x5

    x4 and x5 are free variables and are used to parameterize the system.

    mark
  • @Student25

    This output from my matrix, pizza, isn't very pretty.

    Pizza?????

  • @Student24

    So, what do your results tell you about the solutions to system?

  • @Student34

    This solution means that x1, x2, and x3 are solutions of x4 and x5. In other words, since x4 and x5 are undefined; free variables; this system has infinitely many solutions.

    Not quite sure I follow this line. Could you be more clear? For example, what is a solution in terms of the free variables?

  • @Student37

    Then I use Sage to find the solution to this system. Here is my code:

    Hmm... One major point to the reduced row echelon form is that the system is easy enough to solve at a glance. I don't think it really makes sense to use Sage to solve that system.

Sign In or Register to comment.