Lab 1, problem 1 for TR: Solving and exploring a system with Sage

(10 pts)

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

  • Describe the the problem with prose and your initial typeset system.
  • 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.
  • Repeat the process for a modified, undetermined system obtained by removing two of the equations.

Comments

  • edited August 2019

    Here's some code:

    i=0
    for i in range(10):
         i = i+1
    print(i)
    

    Here's my matrix:

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

    mark
  • edited August 2019

    My problem is:

    $$\begin{align}2x_{1} + 4x_{2} + 9x_{3} - 9x_{4} + 6x_{5} &= 2\\
    -8x_{1} + 5x_{2} - 6x_{3} - 7x_{4} + 9x_{5} &= 0\\
    -2x_{1} + 3x_{2} - 7x_{3} + 9x_{5} &= -7\\
    2x_{1} - 5x_{2} - 6x_{3} - 4x_{5} &= 0\\
    - 7x_{2} - 4x_{3} + 8x_{4} - 3x_{5} &= -6\end{align}$$

    The code I used to solve the problem:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    2*x1+4*x2+9*x3-9*x4+6*x5 == 2,
    -8*x1+5*x2-6*x3-7*x4+9*x5 == 0,
    -2*x1+3*x2-7*x3+9*x5 == -7,
    2*x1-5*x2-6*x3-4*x5 == 0,
    -7*x2-4*x3+8*x4-3*x5 == -6
    ], [x1,x2,x3,x4,x5])

    Here is the output:
    [[x1 == (-10709/37720), x2 == (10173/18860), x3 == (1693/18860), x4 == (-5561/9430), x5 == (-17933/18860)]]

    This means

    $$\begin{align}x_{1} &= \frac{-10709}{37720}\\
    x_{2} &= \frac{10173}{18860}\\
    x_{3} &= \frac{1693}{18860}\\
    x_{4} &= \frac{-5561}{9430}\\
    x_{5} &= \frac{-17933}{18860}\end{align}$$

    is the unique solution for this system of equations.

    Now, if we remove 2 equations to get this system,

    $$\begin{align}2x_{1} + 4x_{2} + 9x_{3} - 9x_{4} + 6x_{5} &= 2\\
    2x_{1} - 5x_{2} - 6x_{3} - 4x_{5} &= 0\\
    - 7x_{2} - 4x_{3} + 8x_{4} - 3x_{5} &= -6\end{align}$$

    and put in our code like this:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    2*x1+4*x2+9*x3-9*x4+6*x5 == 2,
    2*x1-5*x2-6*x3-4*x5 == 0,
    -7*x2-4*x3+8*x4-3*x5 == -6
    ], [x1,x2,x3,x4,x5])

    We get this as our output:

    [[x1 == -7/138*r1 + 61/23*r2 + 85/69, x2 == -5/69*r1 + 28/23*r2 + 82/69, x3 == -43/69*r1 - 3/23*r2 - 40/69, x4 == r2, x5 == r1]]

    For this output, $r_{1}$ and $r_{2}$ are any 2 real numbers. So, the solution for this system is:

    $$\begin{align} x_{1} = \frac{-7}{138} r_{1} + \frac{61}{23} r_{2} + \frac{85}{69}\\
    x_{2} = \frac{-5}{69} r_{1} + \frac{28}{23} r_{2} + \frac{82}{69}\\
    x_{3} = \frac{-43}{69} r_{1} - \frac{3}{23} r_{2} - \frac{40}{69}\\
    x_{4} = r_{2}\\
    x_{5} = r_{1}\end{align}$$

    This is NOT a unique solution.

    mark
  • edited August 2019

    Problem:

    $$
    \begin{align}x_{1} - 2x_{2} + x_{3} + x_{4} + x_{5} &= 9\\
    - 4x_{2} - 8x_{3} + 7x_{4} - 7x_{5} &= 4\\
    -6x_{1} - 7x_{2} - 7x_{3} - 8x_{4} - 2x_{5} &= 4\\
    x_{1} + 9x_{2} - 7x_{3} - 8x_{4} + 3x_{5} &= -1\\
    - 7x_{3} - 9x_{4} + 7x_{5} &= -9\end{align}
    $$

    Code:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        x1 -2*x2 +x3 +x4 +x5 == 9,
        -4*x2 -8*x3 +7*x4 -7*x5 == 4,
        -6*x1 -7*x2 -7*x3 -8*x4 -2*x5 ==4,
        x1 +9*x2 -7*x3 -8*x4 +3*x5 == -1,
        -7*x3 -9*x4 +7*x5 == -9
    ],[x1,x2,x3,x4,x5])
    

    Output:

    [[x1 == (43928/2691), x2 == (-3907/897), x3 == (7175/2691), x4 == (-2627/299), x5 == (-26683/2691)]]

    Interpretation:

    The system has a unique solution, which is the vector described above.

    Modified Problem:

    $$
    \begin{align}x_{1} - 2x_{2} + x_{3} + x_{4} + x_{5} &= 9\\
    - 4x_{2} - 8x_{3} + 7x_{4} - 7x_{5} &= 4\\
    - 7x_{3} - 9x_{4} + 7x_{5} &= -9\end{align}
    $$

    Code:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        x1 -2*x2 +x3 +x4 +x5 == 9,
        -4*x2 -8*x3 +7*x4 -7*x5 == 4,
    #    -6*x1 -7*x2 -7*x3 -8*x4 -2*x5 ==4,
    #    x1 +9*x2 -7*x3 -8*x4 +3*x5 == -1,
        -7*x3 -9*x4 +7*x5 == -9
    ],[x1,x2,x3,x4,x5])
    

    Output:

    [[x1 == -19/2*r1 + 125/14*r2 + 4/7, x2 == -15/4*r1 + 121/28*r2 - 25/7, x3 == r1 - 9/7*r2 + 9/7, x4 == r2, x5 == r1]]

    Interpretation:

    Since the system is undetermined, we get a solution vector for infinitely many solutions where the variables are parametrized in terms of r1 and r2, which can take the value of any real number.

    mark
  • edited August 2019

    Given the following system of equations:

    $$
    \begin{align}6x_{2} - 4x_{3} - 5x_{4} + 7x_{5} &= -5\\
    -2x_{1} + 5x_{2} - x_{3} - 9x_{4} + 7x_{5} &= -3\\
    - 7x_{2} - 5x_{4} - 2x_{5} &= 0\\
    4x_{1} + 8x_{2} - 7x_{3} + 9x_{4} + 8x_{5} &= 3\\
    7x_{1} + 3x_{2} + 2x_{3} - 6x_{4} - 3x_{5} &= 6\end{align}
    $$

    We can solve these using the Sage solve command as followed:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        6*x2-4*x3-5*x4+7*x5 == -5,
        -2*x1+5*x2-x3-9*x4+7*x5 == -3,
        -7*x2-5*x4-2*x5 == 0,
        4*x1+8*x2-7*x3+9*x4+8*x5 == 3,
        7*x1+3*x2+2*x3-6*x4-3*x5 == 6
    ], [x1,x2,x3,x4,x5])
    

    And are given the output:

    [[x1 == (2318/1279), x2 == (-11493/12790), x3 == (29537/12790), x4 == (7041/12790), x5 == (22623/12790)]]
    

    Which can be interpreted as the unique solution:

    $$
    x1 = (2318/1279)\\ x2 = (-11493/12790)\\ x3 = (29537/12790)\\ x4 = (7041/12790)\\ x5 = (22623/12790)
    $$

    After removing the two time rows:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        6*x2-4*x3-5*x4+7*x5 == -5,
        -2*x1+5*x2-x3-9*x4+7*x5 == -3,
        -7*x2-5*x4-2*x5 == 0
    ], [x1,x2,x3,x4,x5])
    

    Which gives the output:

    [[x1 == 17/8*r1 - 41/8*r2 + 7/8, x2 == -2/7*r1 - 5/7*r2, x3 == 37/28*r1 - 65/28*r2 + 5/4, x4 == r2, x5 == r1]]
    

    This has infinitely many solutions where r1 and r2 are real numbers.

    mark
  • edited August 2019

    I was asked to solve the following matrix:
    $$
    \begin{align}7x_{1} - 9x_{2} + 9x_{3} - 4x_{4} - 6x_{5} &= -9\\
    9x_{1} - 5x_{2} - 2x_{3} - 6x_{4} + 7x_{5} &= 6\\
    5x_{1} - 8x_{2} + 2x_{3} + 6x_{4} - 3x_{5} &= -6\\
    2x_{1} - 8x_{2} + 7x_{3} - 9x_{4} - 8x_{5} &= -6\\
    x_{1} + x_{2} - 2x_{3} + 6x_{4} + 3x_{5} &= -3\end{align}
    $$
    I used the following code to solve it:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        7*x1-9*x2+9*x3-4*x4-6*x5 == -9,
        9*x1-5*x2-2*x3-6*x4+7*x5 == 6,
        5*x1-8*x2+2*x3+6*x4-3*x5 == -6,
        2*x1-8*x2+7*x3-9*x4-8*x5 == -6,
        x1+x2-2*x3+6*x4+3*x5 == -3
    ], [x1,x2,x3,x4,x5])
    

    The result that popped out was this:

    [[x1 == (1095/164), x2 == (7119/1394), x3 == (-16989/2788), x4 == (-3093/2788), x5 
    == (-18879/2788)]]
    

    This shows that there is only one solution to the given matrix since each x has its own value without an "r" added to it.

    Next, I removed row 1 and 5 to get the following matrix:
    $$
    \begin{align}9x_{1} - 5x_{2} - 2x_{3} - 6x_{4} + 7x_{5} &= 6\\
    5x_{1} - 8x_{2} + 2x_{3} + 6x_{4} - 3x_{5} &= -6\\
    2x_{1} - 8x_{2} + 7x_{3} - 9x_{4} - 8x_{5} &= -6\end{align}
    $$
    The code used to solve this solution is the following:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        9*x1-5*x2-2*x3-6*x4+7*x5 == 6,
        5*x1-8*x2+2*x3+6*x4-3*x5 == -6,
        2*x1-8*x2+7*x3-9*x4-8*x5 == -6
    ], [x1,x2,x3,x4,x5])
    

    The result that popped out this time was as follows:

    [[x1 == -225/157*r1 + 780/157*r2 + 390/157, x2 == -194/157*r1 + 840/157*r2 + 
    420/157, x3 == 22/157*r1 + 939/157*r2 + 234/157, x4 == r2, x5 == r1]]
    

    This shows that there is an infinite number of solutions to this problem. That is represented by the "r's" that are present in the answer. Any real number added in place of those "r's" would give a correct answer to the matrix.

    mark
  • edited August 2019

    To begin with I was tasked with solving this system of equations using sage's solve command.
    $$
    \begin{align}5x_{1} - 9x_{2} + 7x_{3} - 7x_{4} + 6x_{5} &= -6\\
    2x_{1} + 9x_{2} - 6x_{3} + 2x_{4} + 9x_{5} &= -6\\
    7x_{1} - 7x_{2} + 5x_{3} - 6x_{4} - 8x_{5} &= 8\\
    6x_{1} - 3x_{2} + 3x_{4} - 3x_{5} &= -7\\
    2x_{1} + 4x_{2} + 7x_{3} + 3x_{4} + 5x_{5} &= 4\end{align}
    $$

    The code used to do this was:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        5*x1 - 9*x2 + 7*x3 - 7*x4 + 6*x5 == -6,
        2*x1 + 9*x2 - 6*x3 + 2*x4 + 9*x5 == -6,
        7*x1 - 7*x2 + 5*x3 - 6*x4 - 8*x5 == 8,
        6*x1 - 3*x2 + 3*x4 - 3*x5 == -7,
        2*x1 + 4*x2 + 7*x3 + 3*x4 + 5*x5 == 4
    ], [x1,x2,x3,x4,x5])
    

    The program spit out:

    [[x1 == (-2921/7641), x2 == (45547/30564), x3 == (11195/10188), x4 ==
    -17729/15282), x5 == (-3673/3396)]]
    

    So this system has a single unique solution! Yay

    Now if I remove 2 of the equations let's see what happens:

    Here is the SOE:

    $$
    \begin{align}5x_{1} - 9x_{2} + 7x_{3} - 7x_{4} + 6x_{5} &= -6\\
    2x_{1} + 9x_{2} - 6x_{3} + 2x_{4} + 9x_{5} &= -6\\
    6x_{1} - 3x_{2} + 3x_{4} - 3x_{5} &= -7\\
    \end{align}
    $$

    This is the edited code:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        5*x1 - 9*x2 + 7*x3 - 7*x4 + 6*x5 == -6,
        2*x1 + 9*x2 - 6*x3 + 2*x4 + 9*x5 == -6,
        6*x1 - 3*x2 + 3*x4 - 3*x5 == -7,
    ], [x1,x2,x3,x4,x5])
    

    Now the output for this is interesting:

    [[x1 == -45/31*r1 + 19/62*r2 - 99/62, x2 == -121/31*r1 + 50/31*r2 - 80/93, x3 == 
    -150/31*r1 + 177/62*r2 - 51/62, x4 == r2, x5 == r1]]
    

    The "r"s in this output means that there is a "real free variable", therefore this output suggests that the edited system of equations has infinitely many solutions.

    mark
  • edited August 2019

    In order to solve the given system of equations,

    $$
    \begin{align}
    -7x_{1} + 5x_{2} - 5x_{3} + 5x_{4} + 2x_{5} &= -4\\
    7x_{2} + 3x_{3} - 3x_{4} - 8x_{5} &= -3\\
    6x_{1} - 2x_{2} - 7x_{3} - 4x_{4} + 8x_{5} &= 2\\
    -7x_{1} - 8x_{2} - x_{3} + 9x_{5} &= -1\\
    2x_{1} + 6x_{2} + 3x_{3} - 6x_{4} + 3x_{5} &= -8
    \end{align}
    $$

    We will use the following Sage code.

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    -7*x1+5*x2-5*x3+5*x4+2*x5==-4,
    7*x2+3*x3-3*x4-8*x5==-3,
    6*x1-2*x2-7*x3-4*x4+8*x5==2,
    -7*x1-8*x2-x3+9*x5==-1,
    2*x2+6*x2+3*x3-6*x4+3*x5==-8
    ], [x1,x2,x3,x4,x5])
    

    Sage returns the following results:

    [[x1 == (6874/16173), x2 == (-2117/3594), x3 == (-4441/16173), x4 == (7871/32346), x5 == (-1804/5391)]]
    

    This shows that the system has a unique solution,
    $$
    x1=\frac{6874}{16173},\hspace{0.8cm}
    x2=-\frac{2117}{3591},\hspace{0.8cm}
    x3=-\frac{4441}{16173},\hspace{0.8cm}
    x4=\frac{7871}{32346},\hspace{0.8cm}
    x5=-\frac{1804}{5391}.\hspace{0.8cm}
    $$

    By removing the equations in rows two and four the system becomes

    $$
    \begin{align}
    -7x_{1} + 5x_{2} - 5x_{3} + 5x_{4} + 2x_{5} &= -4\\
    6x_{1} - 2x_{2} - 7x_{3} - 4x_{4} + 8x_{5} &= 2\\
    2x_{1} + 6x_{2} + 3x_{3} - 6x_{4} + 3x_{5} &= -8
    \end{align}
    $$

    This translates to the Sage code

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    -7*x1+5*x2-5*x3+5*x4+2*x5==-4,
    6*x1-2*x2-7*x3-4*x4+8*x5==2,
    2*x2+6*x2+3*x3-6*x4+3*x5==-8
    ], [x1,x2,x3,x4,x5])
    

    which gives:

    [[x1 == -95/136*r1 + 37/34*r2 - 5/68, x2 == -441/680*r1 + 117/170*r2 - 331/340, x3 == 62/85*r1 + 14/85*r2 - 6/85, x4 == r2, x5 == r1]]
    

    Notice that the solutions for $x_1$, $x_2$ and $x_3$ are all determined by $x_4$ and $x_5$, so there are infinitely many solutions.

    mark
  • edited August 2019

    For this problem I was asked to use Sage's solve command to solve the following system:

    $$
    \begin{align}6x_{1} - 3x_{2} + 7x_{3} - 2x_{4} + x_{5} &= 5\\
    -2x_{1} + 5x_{2} - 5x_{3} + 7x_{4} - 3x_{5} &= 5\\
    3x_{1} + 3x_{2} - 8x_{3} + 2x_{4} + 7x_{5} &= 4\\
    -7x_{1} - 7x_{3} - 3x_{4} - 4x_{5} &= 9\\
    6x_{1} - 6x_{2} - 7x_{3} + 8x_{4} - 6x_{5} &= -2\end{align}
    $$

    The code I used to solve this system was:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        6*x1-3*x2+7*x3-2*x4+1*x5 == 5,
        -2*x1+5*x2-5*x3+7*x4-3*x5 == 5,
        3*x1+3*x2-8*x3+2*x4+7*x5 == 4,
        -7*x1-7*x3-3*x4-4*x5 == 9,
        6*x1-6*x2-7*x3+8*x4-6*x5 == -2,
    ], [x1,x2,x3,x4,x5])
    

    The output I got was:

    [[x1 == (840/199), x2 == (29625/6368), x3 == (-1233/796), x4 == (-6599/1592), x5 == (-24309/6368)]]
    

    Interpreting the results we can see that there is exactly one unique solution to this system.
    $$
    \begin{align}
    x_1&= 840/199 \\
    x_2&= 29625/6368 \\
    x_3&= -1233/796 \\
    x_4&=-6599/1592\\
    x_5&= -24309/6368\\
    \end{align}
    $$

    Now I will repeat the process when I modify the system by removing two of the equations (rows 3 and 4):

    $$
    \begin{align}6x_{1} - 3x_{2} + 7x_{3} - 2x_{4} + x_{5} &= 5\\
    -2x_{1} + 5x_{2} - 5x_{3} + 7x_{4} - 3x_{5} &= 5\\
    6x_{1} - 6x_{2} - 7x_{3} + 8x_{4} - 6x_{5} &= -2\end{align}
    $$

    The code for this modified system is:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        6*x1-3*x2+7*x3-2*x4+1*x5 == 5,
        -2*x1+5*x2-5*x3+7*x4-3*x5 == 5,
        6*x1-6*x2-7*x3+8*x4-6*x5 == -2,
    ], [x1,x2,x3,x4,x5])
    

    Which yields an output of:

    [[x1 == 61/96*r1 - 157/128*r2 + 25/16, x2 == 7/24*r1 - 31/32*r2 + 7/4, x3 == 
    -9/16*r1 + 59/64*r2 + 1/8, x4 == r2, x5 == r1]]
    

    Interpreting the results for this modified system we can see that the variables are parameterized in terms of r1 and r2, which are able to take values of any real numbers. Thus, there are an indefinite amount of solutions for this system.

    mark
  • edited August 2019

    The assignment is to solve the following system of linear equations with Sage's solve command:
    $$\begin{align}-8x_{1} + x_{2} - 2x_{3} - 9x_{4} + 4x_{5} &= -7 \\
    2x_{1} - 6x_{2} - 3x_{3} + x_{4} - 6x_{5} &= 8 \\
    -2x_{1} + 6x_{2} + 4x_{4} + 6x_{5} &= 1 \\
    -5x_{1} - 6x_{2} - 5x_{3} - 6x_{4} + 4x_{5} &= -1 \\
    -2x_{1} + 7x_{2} - 2x_{4} + 6x_{5} &= -5 \end{align}$$

    Code:

    x1, x2, x3, x4, x5 = var('x1, x2, x3, x4, x5')
    solve([-8*x1 + x2 - 2*x3 - 9*x4 + 4*x5 == -7,
           2*x1 - 6*x2 - 3*x3 + x4 - 6*x5 == 8,
           -2*x1 + 6*x2 + 4*x4 + 6*x5 == 1,
           -5*x1 - 6*x2 - 5*x3 - 6*x4 + 4*x5 == -1,
           -2*x1 + 7*x2 - 2*x4 + 6*x5 == -5],
          [x1, x2, x3, x4, x5])
    

    Result:
    [[x1 == (-25/107), x2 == (48/1177), x3 == (-1556/1177), x4 == (1185/1177), x5 == (-1467/2354)]]

    Therefore, there is one solution, which is
    $$\begin{align} x_1 &= -\frac{25}{107} \\
    x_2 &= \frac{48}{1177} \\
    x_3 &= -\frac{1556}{1177} \\
    x_4 &= \frac{1185}{1177} \\
    x_5 &= -\frac{1467}{2354} \end{align}$$

    After this, I removed two of the equations to obtain a new system and solved again.
    $$\begin{align}-8x_{1} + x_{2} - 2x_{3} - 9x_{4} + 4x_{5} &= -7 \\
    -2x_{1} + 6x_{2} + 4x_{4} + 6x_{5} &= 1 \\
    -5x_{1} - 6x_{2} - 5x_{3} - 6x_{4} + 4x_{5} &= -1 \end{align}$$

    Code:

    x1, x2, x3, x4, x5 = var('x1, x2, x3, x4, x5')
    solve([-8*x1 + x2 - 2*x3 - 9*x4 + 4*x5 == -7,
           -2*x1 + 6*x2 + 4*x4 + 6*x5 == 1,
           -5*x1 - 6*x2 - 5*x3 - 6*x4 + 4*x5 == -1],
          [x1, x2, x3, x4, x5])
    

    Result:
    [[x1 == -15/73*r1 - 133/73*r2 + 215/146, x2 == -78/73*r1 - 93/73*r2 + 48/73, x3 == 167/73*r1 + 157/73*r2 - 301/146, x4 == r2, x5 == r1]]

    Therefore, there are infinitely many solutions in terms of two free variables, $x_4$ and $x_5$. They are
    $$\begin{align} x_1 &= - \frac{133}{73}x_4 -\frac{15}{73}x_5 + \frac{215}{146} \\
    x_2 &= - \frac{93}{73}x_4 -\frac{78}{73}x_5 + \frac{48}{73} \\
    x_3 &= \frac{157}{73}x_4 + \frac{167}{73}x_5 - \frac{301}{146} \end{align}$$

    mark
  • edited August 2019

    Here is the equation is was tasked with solving:

    $$\begin{align}-2x_{1} - 4x_{2} + 2x_{3} - x_{4} - 3x_{5} &= 9\\
    3x_{1} + 9x_{2} - 4x_{3} + 9x_{4} + 7x_{5} &= 9\\
    -2x_{1} - 2x_{2} + 4x_{4} - 8x_{5} &= 9\\
    -5x_{1} - 2x_{2} - x_{3} - 6x_{4} + 7x_{5} &= -7\\
    -2x_{1} - 5x_{2} - 8x_{3} - 4x_{4} + 7x_{5} &= -5\end{align}$$

    I used the following code:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
          -2*x1-4*x2+2*x3-x4-3*x5 == 9
          +3*x1+9*x2-4*x3+9*x4+7*x5 == 9
          -2*x1-2*x2+4*x4-8*x5 == 9
          -5*x1-2*x2-x3-6*x4+7*x5 == -7
          -2*x1-5*x2-8*x3-4*x4+7*x5 == -5
    ], [x1,x2,x3,x4,x5])
    

    To give me this output:

    [[x1 == -2*r1 - 2*r2 + 6/5*r3 - 13/5*r4 - 9/5, x2 == r4, x3 == r3, x4 == r2, x5 == r1]]
    

    Which means that my unique system has infinitely many solutions with 4 free variables. These variables are $x_2, x_3, x_4,$ and $x_5$, which are represented by r4, r3, r2, and r1, respectively.

    $$x_1 = -2x_5-2x_4+\frac{6}{5}x_3-\frac{13}{5}x_2-\frac{9}{5}$$

    My edited system of equations is:

    $$\begin{align}-2x_{1} - 4x_{2} + 2x_{3} - x_{4} - 3x_{5} &= 9\\
    -2x_{1} - 2x_{2} + 4x_{4} - 8x_{5} &= 9\\
    -2x_{1} - 5x_{2} - 8x_{3} - 4x_{4} + 7x_{5} &= -5\end{align}$$

    I used the following code:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
       -2*x1-4*x2+2*x3-x4-3*x5 == 9
    #  +3*x1+9*x2-4*x3+9*x4+7*x5 == 9
       -2*x1-2*x2+4*x4-8*x5 == 9
    #  -5*x1-2*x2-x3-6*x4+7*x5 == -7
       -2*x1-5*x2-8*x3-4*x4+7*x5 == -5
    ], [x1,x2,x3,x4,x5])
    

    To give me this new output:

    [[x1 == r4, x2 == 5/2*r1 - 5/2*r2 + r3 - 9/2, x3 == r3, x4 == r2, x5 == r1]]
    

    Which means that my modified system also has infinitely many solutions with 4 free variables. However, this system has a different set of variables, they are $x_1,x_3,x_4,$ and $x_5$, which are represented by r4, r3, r2, and r1, respectively.
    $$x_2 = \frac{5}{2}x_5 - \frac{5}{2}x_4 + x_3 - \frac{9}{2}$$

    mark
  • edited August 2019

    I was given the set of solutions: $$\begin{align}
    4x_{1} - 3x_{2} + 5x_{3} - 8x_{4} - 8x_{5} &= -1\\
    2x_{1} + 8x_{2} - x_{3} - x_{4} + 4x_{5} &= 4\\
    -7x_{1} + 6x_{2} + 7x_{3} + 9x_{5} &= 0\\
    -2x_{1} + 9x_{2} + 4x_{3} + 4x_{4} - 3x_{5} &= -8\\
    8x_{1} + 4x_{2} + 4x_{3} + 2x_{4} - 4x_{5} &= -9\end{align}$$

    The code to solve was:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    4*x1-3*x2+5*x3-8*x4-8*x5 == -1,
    2*x1+8*x2-x3-x4+4*x5 == 4,
    -7*x1+6*x2+7*x3+9*x5 == 0,
    -2*x1+9*x2+4*x3+4*x4-3*x5 == -8,
    8*x1+4*x2+4*x3+2*x4-4*x5 == -9,
    ], [x1,x2,x3,x4,x5])
    

    Which gave the solution:
    [[x1 == (-9804/44101), x2 == (6955/88202), x3 == (-78789/88202), x4 == (-92023/88202), x5 == (41393/88202)]]

    This means that the unique solution is: $$x_1=(-9804/44101)\\x_2=(6955/88202)\\x_3=(-78789/88202)\\x_4=(-92023/88202)\\x_5=(41393/88202).$$

    After modifying the solution sets the remaining solution sets are: $$\begin{align}
    4x_{1} - 3x_{2} + 5x_{3} - 8x_{4} - 8x_{5} &= -1\\
    2x_{1} + 8x_{2} - x_{3} - x_{4} + 4x_{5} &= 4\\
    -7x_{1} + 6x_{2} + 7x_{3} + 9x_{5} &= 0\end{align}$$

    The code to solve was:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    4*x1-3*x2+5*x3-8*x4-8*x5 == -1,
    2*x1+8*x2-x3-x4+4*x5 == 4,
    -7*x1+6*x2+7*x3+9*x5 == 0,
    ], [x1,x2,x3,x4,x5])
    

    Which gave the solutions:
    [[x1 == 625/609*r1 + 547/609*r2 + 142/609, x2 == -62/87*r1 + 1/87*r2 + 37/87, x3 == 214/609*r1 + 541/609*r2 - 80/609, x4 == r2, x5 == r1]]

    Showing that there are infinitely many solutions

    mark
  • edited August 2019

    The problem is:
    $$x_1 - 9x_2 - 5x_3 - 3x_4 + 6x_5 = 5 \\
    -3x_1 - 4x_2 - 8x_3 + 9x_4 - 5x_5 = 4 \\
    2x_1 + 6x_2 - 4x_3 + 4x_4 - 6x_5 = 0 \\
    9x_1 + 3x_2 - 3x_3 - 3x_4 - 9x_5 = 4 \\
    -4x_1 - 9x_2 + 9x_4 + 9x_4 + 4x_5 = 5$$

    This system of equations is used to find the values of $x_i$ with the code:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        1*x1-9*x2-5*x3-3*x4+6*x5 == 5,
        -3*x1-4*x2-8*x3+9*x4-5*x5 == 4,
        2*x1+6*x2-4*x3+4*x4-6*x5 == 0,
        9*x1+3*x2-5*x3-3*x4-9*x5 == 4,
        -4*x1-9*x2+9*x3+9*x4+4*x5 == 5,
    ], [x1,x2,x3,x4,x5])
    

    I got the output:

    [[x1 == (3452/4541), x2 == (-17127/31787), x3 == (-2437/31787), x4 == (691/1673), x5 == (1305/31787)]]
    

    The above output is the unique solution of the given system of equations.

    If you take out the last two equations, you get this output:

    [[x1 == -67/61*r1 + 289/183*r2 + 28/183, x2 == 56/61*r1 - 115/183*r2 - 58/183, x3 == -41/61*r1 + 155/183*r2 - 73/183, x4 == r2, x5 == r1]]
    

    The system of equations with the last two equations taken out has infinitely many solutions.

    mark
  • edited August 2019

    This is the system I was asked to solve using sage:
    $$
    -4x_1+4x_2+2x_3-2x_4+4x_5 = 4 \\
    \hspace{10pt} -8x_2-6x_3+6x_4+3x_5 = 0 \\
    4x_1+9x_2-2x_3-3x_4+4x_5 = -9 \\
    3x_1 + 9x_2+8x_3-8x_4-6x_5 = -5 \\
    5x_1+8x_2+4x_3+x_4-2x_5 = -6 $$

    This is the code that I used:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        -4*x1+4*x2+2*x3-2*x4+4*x5 == 4,
        -8*x2-6*x3+6*x4+3*x5 == 0,
        4*x1+9*x2-2*x3-3*x4+4*x5 == -9,
        3*x1+9*x2+8*x3-8*x4-6*x5 == -5,
        5*x1+8*x2+4*x3+x4-2*x5 == -6
    ],[x1,x2,x3,x4,x5])
    

    The solution this returns is:

    [[x1 == (-493/239), x2 == (108/239), x3 == (-557/1195), x4 == (743/1195), x5 ==    (-232/239)]],
    

    Which is the unique solution to this system.

    A modified version of this system without the last two equations is:

    $$
    -4x_1+4x_2+2x_3-2x_4+4x_5 = 4 \\
    \hspace{10pt} -8x_2-6x_3+6x_4+3x_5 = 0 \\
    4x_1+9x_2-2x_3-3x_4+4x_5 = -9 \\
    $$

    This is the code I used to solve this modified system:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        -4*x1+4*x2+2*x3-2*x4+4*x5 == 4,
        -8*x2-6*x3+6*x4+3*x5 == 0,
        4*x1+9*x2-2*x3-3*x4+4*x5 == -9,
    ],[x1,x2,x3,x4,x5])
    

    And this is the formula for the infinite number of solutions with $x_4$ and $x_5$ as free variables r1 and r2 respectively:

    [[x1 == 163/156*r1 + 5/39*r2 - 44/39, x2 == -8/13*r1 + 5/13*r2 - 5/13, x3 ==   103/78*r1 + 19/39*r2 + 20/39, x4 == r2, x5 == r1]]
    
    mark
  • edited August 2019

    Problem 1: Asked to express and solve linear systems of equations

    -3x+2x+9x+7x+2x == -6
    7x+2x+7x+8x-8x ==-5
    -5x+6x-2x-9x-6x == -4
    4x-4x+3x-x+7x == 3
    2x+6x+5x-3x == 2
    

    Here is the code I used:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    -3*x1+2*x2+9*x3+7*x4+2*x5 == -6,
    7*x1+2*x2+7*x3+8*x4-8*x5 == -5,
    -5*x1+6*x2-2*x3-9*x4-6*x5 == -4,
    4*x1-4*x2+3*x2-x4+7*x5 == 3,
    2*x1+6*x2+5*x3-3*x4 == 2,
    ], [x1,x2,x3,x4,x5])
    

    This is the unique solution to the above system.

    [[x1 == (1613/1970), x2 == (3651/3940), x3 == (-948/985), x4 == (592/2955), x5 == (2752/2955)]]
    

    If you remove two equations the new system will be:

    -3x+2x+9x+7x+2x == -6
    7x+2x+7x+8x-8x ==-5
    -5x+6x-2x-9x-6x == -4
    

    The new code I used would be:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    -3*x1+2*x2+9*x3+7*x4+2*x5 == -6,
    7*x1+2*x2+7*x3+8*x4-8*x5 == -5,
    -5*x1+6*x2-2*x3-9*x4-6*x5 == -4,
    ], [x1,x2,x3,x4,x5])
    

    The answer would then be:

    [[x1 == 133/141*r1 - 89/282*r2 + 1/282, x2 == 159/94*r1 + 165/188*r2 - 155/188, x3 == -40/141*r1 - 152/141*r2 - 68/141, x4 == r2, x5 == r1]]
    
    mark
  • edited August 2019

    The problem is a system of linear equations that contains five equations and five unknowns (therefore allowing every unknown to be solved). The system is as follows:

    $$\begin{array}{rcl}
    x_1−9x_2−9x_3−2x_4−8x_5 & = & 2 \\
    7x_1−4x_2−5x_3+9x_4+9x_5 & = & 2 \\
    −2x_1+9x_2−4x_4+2x_5 & = & -4 \\
    −2x_1−7x_2+3x_3+x_4+2x_5 & = & -9 \\
    4x_1−7x_2−8x_3−3x_4−9x_5 & = & -5.
    \end{array}$$

    This is represented as

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        x1-9*x2-9*x3-2*x4-8*x5 == 2,
        7*x1-4*x2-5*x3+9*x4+9*x5 == 2,
        -2*x1+9*x2-4*x4+2*x5 == -4,
        -2*x1-7*x2+3*x3+x4+2*x5 == -9,
        4*x1-7*x2-8*x3-3*x4-9*x5 == -5
    ], [x1,x2,x3,x4,x5])
    

    in Sage, and evaluating it gives the following solution:

    [[x1 == (-15887/6890), x2 == (15676/10335), x3 == (-19831/20670), x4 == 
    (18311/4134), x5 == (-9395/4134)]].
    

    The output solves for each variable in the system as a rational number with no unknowns. We get exactly one answer. When removing two equations from this system, we get an under-determined system with five unknowns and three equations:

    $$\begin{array}{rcl}
    x_{1} - 9x_{2} - 9x_{3} - 2x_{4} - 8x_{5} & = & 2\\
    7x_{1} - 4x_{2} - 5x_{3} + 9x_{4} + 9x_{5} & = & 2\\
    4x_{1} - 7x_{2} - 8x_{3} - 3x_{4} - 9x_{5} & = & -5,
    \end{array}$$

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        x1-9*x2-9*x3-2*x4-8*x5 == 2,
        7*x1-4*x2-5*x3+9*x4+9*x5 == 2,
        4*x1-7*x2-8*x3-3*x4-9*x5 == -5
    ], [x1,x2,x3,x4,x5]),
    

    with the solution:

    [[x1 == -23/5*r1 - 17/5*r2 + 23/10, x2 == 81/5*r1 + 59/5*r2 - 209/15, x3 == 
    -88/5*r1 - 62/5*r2 + 419/30, x4 == r2, x5 == r1]].
    

    It is evident here that removing two equations from a balance of unknowns and equations causes the solution to depend on two parameters represented as real numbers, $x_4=r_2$ and $x_5=r_1$, meaning this system has infinitely many answers.

    mark
  • edited September 2019

    This is my assigned problem:

    $$
    \begin{align}5x_{1} - 6x_{3} + x_{4} + x_{5} &= 6\\
    -2x_{1} + 5x_{2} + 7x_{3} + 5x_{4} + 8x_{5} &= 8\\
    -9x_{1} + 9x_{2} - 9x_{3} - x_{4} - 8x_{5} &= -9\\
    -5x_{1} - x_{2} - 8x_{3} + 4x_{4} + 3x_{5} &= -8\\
    8x_{1} + x_{2} + 4x_{3} + 5x_{4} - 9x_{5} &= -8\end{align}
    $$

    Code:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        5*x1 - 6*x3 + x4 +x5 == 6,
        -2*x1 + 5*x2 + 7*x3 +5*x4 + 8*x5 == 8,
        -9*x1 + 9*x2- 9*x3 - x4 -8*x5 == -9,
        -5*x1-x2-8*x3+4*x4 +3*x5 == -8,
        8*x1 + x2 +4*x3 + 5*x4 - 9*x5 == -8
    ], [x1,x2,x3,x4,x5])
    

    Output:

    [[x1 == (162055/138687), x2 == (55899/46229), x3 == (-670/46229), x4 == (-176965/138687), x5 == (186752/138687)]]
    

    This system of equations has a unique solution. The solution to each equation will be found only after replacing the defined variables with their respective numerical values.

    When two of the equations are removed, there will be two free variables, $x_4$ and $x_5$. Because of the presence of these two free variables, the system will now have infinitely many solutions.

    Code:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        5*x1 - 6*x3 + x4 +x5 == 6,
        -2*x1 + 5*x2 + 7*x3 +5*x4 + 8*x5 == 8,
        -9*x1 + 9*x2- 9*x3 - x4 -8*x5 == -9,
    ], [x1,x2,x3])
    

    Output:

    [[x1 == -68/117*x4 - 10/9*x5 + 25/13, x2 == -553/702*x4 - 53/54*x5 + 119/78, x3 == -223/702*x4 - 41/54*x5 + 47/78]]
    
    mark
  • edited August 2019

    My System of Equations is

    \begin{align}7x_{1} + 6x_{2} - 7x_{3} + x_{4} - 3x_{5} &= 1\\
    -4x_{1} + 7x_{2} - 9x_{3} - 6x_{4} + 2x_{5} &= -4\\
    -5x_{1} + 3x_{2} - 6x_{3} - 5x_{4} + x_{5} &= -4\\
    9x_{3} - 3x_{4} + 2x_{5} &= -1\\
    5x_{1} + 5x_{2} + x_{3} + 8x_{4} - 4x_{5} &= 9\end{align}

    Using the code

     x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
     solve([
     7*x1-6*x2-7*x3-3*x4-3*x5 == 1,
     -4*x1+7*x2-9*x3-6*x4+2*x5 == -4,
     -5*x1+3*x2-6*x3-5*x4+x5 == -4,
     9*x3-3*x4+5*x5 == -1,
     5*x1-5*x2+x3+8*x4-4*x5 == 9,
    ], [x1,x2,x3,x4,x5])
    

    I was given

     [[x1 == (129/1057), x2 == (-2589/2114), x3 == (-2549/2114), x4 == (2143/1057), x5 == (6737/2114)]]
    

    Deleting the last 2 equations and using only

    \begin{align}7x_{1} + 6x_{2} - 7x_{3} + x_{4} - 3x_{5} &= 1\\
    -4x_{1} + 7x_{2} - 9x_{3} - 6x_{4} + 2x_{5} &= -4\\
    -5x_{1} + 3x_{2} - 6x_{3} - 5x_{4} + x_{5} &= -4\\\end{align}

    Plugging in

     x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
     solve([
         7*x1-6*x2-7*x3-3*x4-3*x5 == 1,
         -4*x1+7*x2-9*x3-6*x4+2*x5 == -4,
         -5*x1+3*x2-6*x3-5*x4+x5 == -4,    
     ], [x1,x2,x3,x4,x5])
    

    I get the answer

    [[x1 == 17/196*r1 - 16/49*r2 + 199/392, x2 == -9/28*r1 - 1/7*r2 + 5/56, x3 == -13/196*r1 - 31/49*r2 + 113/392, x4 == r2, x5 == r1]]

    mark
  • edited September 2019

    Problem 1:My original system was:

    $$\begin{align}-3x_{1} - 4x_{2} + 3x_{3} + 2x_{4} - 4x_{5} &= 1\\
    -3x_{1} - 8x_{2} - 5x_{3} + 3x_{4} + 2x_{5} &= -7\\
    -x_{1} - 8x_{2} + 2x_{3} - 9x_{4} + 9x_{5} &= 8\\
    6x_{1} - 2x_{2} - 8x_{3} - 6x_{4} - 2x_{5} &= 5\\
    x_{1} + 8x_{2} - 5x_{3} + x_{4} - x_{5} &= -3\end{align}$$

    The Input I used was:

    x1,x2,x3,x4,x5= var('x1,x2,x3,x4,x5')
    solve([
      -3*x1-4*x2+3*x3+2*x4-4*x5 == 1,
        -3*x1-8*x2-5*x3+3*x4+2*x5 == -7,
        -1*x1-8*x2+2*x3-9*x4+9*x5 == 8,
        6*x1-2*x2-8*x3-6*x4-2*x5 == 5,
        x1+8*x2-5*x3+x4-x5 == -3,
    ], [x1,x2,x3,x4,x5])
    

    The output was:

    [[x1 == (-1240/15919), x2 == (177/31838), x3 == (6935/15919), x4 == 
    (-20974/15919), x5 == (-8424/15919)]]
    

    Which is a unique solution

    After removing two equations the output becomes:

    [[x1 == (139/43*x4 - 147/43*x5 + 102/43), x2 == (-229/172*x4 + 133/86*x5 - 
    40/43), x3 == (34/43*x4 - 1/43*x5 + 63/43)]]
    

    Which has infinite solutions and therefore is not a unique solution.

  • edited August 2019

    We were asked to solve a system of linear equations (below) with five unknowns, $x_{1},x_{2},x_{3},x_{4},x_{5}$ ,using Sage's solve command.

    $$\begin{align}-5x_{1} + 3x_{2} + 3x_{3} - 8x_{4} - 5x_{5} &= 0\\
    9x_{1} + 9x_{2} - 8x_{3} + x_{4} + 5x_{5} &= 2\\
    -6x_{1} - 4x_{2} + 5x_{3} - 2x_{4} + 2x_{5} &= 0\\
    -4x_{1} + 9x_{2} - 3x_{3} - 9x_{4} + 2x_{5} &= 6\\
    -x_{1} + 2x_{2} - 2x_{3} - 4x_{4} + 7x_{5} &= 5\end{align}$$
    Here is the code we use to find the five variables:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        -5*x1+3*x2+3*x3-8*x4-5*x5 == 0,
        9*x1+9*x2-8*x3+x4+5*x5 == 2,
        -6*x1-4*x2+5*x3-2*x4+2*x5 == 0,
        -4*x1+9*x2-3*x3-9*x4+2*x5 == 6,
        -x1+2*x2-2*x3-4*x4+7*x5 == 5
    ], [x1,x2,x3,x4,x5])
    

    And the output for the command came out to be:

    [[x1 == (-3149/6202), x2 == (-1035/3101), x3 == (-490/443), x4 == 
    (-1110/3101), x5 == (1343/6202)]]
    

    This output shows that there is only one solution for this system and that it is rational.
    If we were to remove two of the equations from the system which would change the solution to this system. Here is the modified system:

    $$\begin{align}-5x_{1} + 3x_{2} + 3x_{3} - 8x_{4} - 5x_{5} &= 0\\
    9x_{1} + 9x_{2} - 8x_{3} + x_{4} + 5x_{5} &= 2\\
    -6x_{1} - 4x_{2} + 5x_{3} - 2x_{4} + 2x_{5} &= 0\end{align}$$

    Here is the code used to find the output:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        -5*x1+3*x2+3*x3-8*x4-5*x5 == 0,
        9*x1+9*x2-8*x3+x4+5*x5 == 2,
        -6*x1-4*x2+5*x3-2*x4+2*x5 == 0
    ], [x1,x2,x3,x4,x5])
    

    Then the output is:

    [[x1 == -151*r1 - 29/2*r2 + 27, x2 == -38*r1 - 5/2*r2 + 7, x3 == -212*r1 - 19*r2 
    + 38, x4 == r2, x5 == r1]]
    

    where $r1$ and $r2$ parameterized real numbers. This underdetermined system has an infinite number of solutions.

    mark
  • edited August 2019

    With the given system of equations

    $$\begin{align}9x_{1} - 2x_{2} - 2x_{3} + x_{4} - 6x_{5} &= -7\\
    5x_{1} - 4x_{2} + 5x_{4} - 7x_{5} &= 9\\
    5x_{1} + 4x_{2} + 5x_{4} + 3x_{5} &= 2\\
    -9x_{1} + 5x_{2} + 5x_{4} - 2x_{5} &= -1\\
    -7x_{1} - 7x_{2} + 6x_{3} - x_{4} + 4x_{5} &= -5\end{align}$$

    with the matrix

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

    sage gives the solution

    [[x1 == (1401/206), x2 == (479/309), x3 == (217/103), x4 == (10007/618), x5 == 
    (1468/103)]]
    

    using the code:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    9*x1-2*x2+2*x3+x4-6*x5 == -7,
    5*x1-4*x2+5*x4-7*x5 == 9,
    5*x1+4*x2-5*x4+3*x5 == 2,
    -9*x1+5*x2+5*x4-2*x5 == -1,
    -7*x1-7*x2+6*x3-x4+4*x5 == -5,
    ], [x1,x2,x3,x4,x5])
    

    This denotes that the system has a unique solution, only one set of numbers

    When removing two of the five equations,
    $$\begin{align}9x_{1} - 2x_{2} - 2x_{3} + x_{4} - 6x_{5} &= -7\\
    5x_{1} - 4x_{2} + 5x_{4} - 7x_{5} &= 9\\
    5x_{1} + 4x_{2} + 5x_{4} + 3x_{5} &= 2\end{align}$$

    the matrix becomes

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

    using the code

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    9*x1-2*x2+2*x3+x4-6*x5 == -7,
    5*x1-4*x2+5*x4-7*x5 == 9,
    5*x1+4*x2-5*x4+3*x5 == 2,
    ], [x1,x2,x3,x4,x5])
    

    the result becomes

    [[x1 == 2/5*r1 + 11/10, x2 == -5/4*r1 + 5/4*r2 - 7/8, x3 == -1/20*r1 + 3/4*r2 - 
    373/40, x4 == r2, x5 == r1]]
    

    defining an infinite amount of solutions to this new system where any r is any real number

    mark
  • edited August 2019

    Problem 1

    In lab 1, I was asked to use Sage to solve the following system of equations:

    $$\begin{align}-8x_{1} + 4x_{2} - 3x_{3} - 6x_{4} - 5x_{5} &= -8\\
    -8x_{1} + 7x_{2} - 5x_{3} - 8x_{4} + 9x_{5} &= 3\\
    8x_{1} - 3x_{3} + 4x_{4} + 3x_{5} &= -2\\
    5x_{1} - 4x_{2} - 7x_{3} + 9x_{4} + 9x_{5} &= 5\\
    -7x_{1} - 8x_{2} + 4x_{3} + 9x_{4} + x_{5} &= 5\end{align}$$

    The code I used was:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
        solve([
        -8 *x1 +4 *x2 -3 *x3 -6 *x4 -5 *x5 == -8,
        -8 *x1 +7 *x2 -5 *x3 -8 *x4 +9 *x5 ==  3,
          8 *x1        -3 *x3 +4 *x4 +3 *x5 == -2,
          5 *x1 -4 *x2 -7 *x3 +9 *x4 +9 *x5 ==  5,
         -7 *x1 -8 *x2 +4 *x3 +9 *x4 +1 *x5 ==  5,
    ], [x1,x2,x3,x4,x5])
    

    Running this in Sage returned:

    [[x1 == (3314/12935), x2 == (-33507/12935), x3 == (1908/12935), x4 == (-22469/12935), x5 == (14406/12935)]]
    

    Or, in a more readable format, the solution to the original system of equations is:

    $$x_{1} = \dfrac{3314} {12935}\\
    x_{2} = \dfrac{-33507}{12935}\\
    x_{1} = \dfrac{1908} {12935}\\
    x_{3} = \dfrac{-22469} {12935}\\
    x_{5} = \dfrac{14406} {12935}$$

    This system has exactly 1 solution.
    I then ran the program with the first two equations removed, resulting in a new system of equations:

    $$\begin{align}8x_{1} - 3x_{3} + 4x_{4} + 3x_{5} &= -2\\
    5x_{1} - 4x_{2} - 7x_{3} + 9x_{4} + 9x_{5} &= 5\\
    -7x_{1} - 8x_{2} + 4x_{3} + 9x_{4} + x_{5} &= 5\end{align}$$

    That I translated it to this Sage code:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
        solve([
          8 *x1        -3 *x3 +4 *x4 +3 *x5 == -2,
          5 *x1 -4 *x2 -7 *x3 +9 *x4 +9 *x5 ==  5,
         -7 *x1 -8 *x2 +4 *x3 +9 *x4 +1 *x5 ==  5,
    ], [x1,x2,x3,x4,x5])
    

    The new Sage code output:

    [[x1 == -1/31*r1 - 15/31*r2 - 17/31, x2 == 227/372*r1 + 146/93*r2 - 101/186, x3 == 85/93*r1 + 4/93*r2 - 74/93, x4 == r2, x5 == r1]]
    

    Which is interpreted as:

    $$\begin{align}x_{1} = \dfrac{-1}{31}r_{1} - \dfrac{15}{31}r_{2} - \dfrac{17}{31}\\
    x_{2} = \dfrac{227}{372}r_{1} + \dfrac{146}{93}r_{2} - \dfrac{101}{186}\\
    x_{3} = \dfrac{85}{93}r_{1} + \dfrac{4}{93}r_{2} - \dfrac{74}{93}\\
    x_{4} = r_{2}\\
    x_{5} = r_{1}\end{align}$$

    Removing the first two equations rendered this system undetermined. Because it didn't have enough equations to solve for every variable, it introduced two new variables, real numbers r1 and r2, and create a parameterized solution. This means it has an infinite number of solutions.

    mark
  • edited August 2019

    I was given the system of equations,

    $$
    \begin{align}6x_{1} + x_{2} + 6x_{3} - x_{4} + 6x_{5} &= -6\\
    4x_{1} + 9x_{2} - 5x_{3} + 3x_{4} - 7x_{5} &= -5\\
    -9x_{1} + 5x_{2} + 5x_{3} - 4x_{4} + 9x_{5} &= 4\\
    3x_{1} + 5x_{2} + 9x_{3} - 7x_{4} - 8x_{5} &= -6\\
    -7x_{1} + x_{2} + 6x_{3} + 4x_{4} - 2x_{5} &= 8\end{align}
    $$

    I solved it with the following code:

    x1,x2,x3,x4, x5 = var('x1,x2,x3,x4,x5')
    solve([
    6*x1+x2+6*x3-1*x4+6*x5 == -6,
    4*x1+9*x2-5*x3+3*x4-7*x5 == -5,
    -9*x1+5*x2+5*x3-4*x4+9*x5 == 4,
    3*x1+5*x2+9*x3-7*x4-8*x5 == -6,
    -7*x1+x2+6*x3+4*x4-2*x5  == 8
    ], [x1,x2,x3,x4,x5])
    

    The result it gave me was

    [[x1 == (-179587/208086), x2 == (-70261/208086), x3 == (14693/208086), x4 ==  (89105/208086), x5 == (-16631/208086)]]
    

    This tells us that the given system has exactly one solution, namely

    $$
    \begin{align}
    x_1=\frac{-179587}{208086}\\
    x_2=\frac{-70261}{208086}\\
    x_3=\frac{14693}{208086}\\
    x_4=\frac{89105}{208086}\\
    x_5=\frac{-16631}{208086}
    \end{align}
    $$

    Removing the bottom two equations of our original system, we obtain:

    $$
    \begin{align}
    6x_{1} + x_{2} + 6x_{3} - x_{4} + 6x_{5} &= -6\\
    4x_{1} + 9x_{2} - 5x_{3} + 3x_{4} - 7x_{5} &= -5\\
    -9x_{1} + 5x_{2} + 5x_{3} - 4x_{4} + 9x_{5} &= 4\\
    \end{align}
    $$

    The code used was

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        6*x1+x2+6*x3-1*x4+6*x5 == -6,
        4*x1+9*x2-5*x3+3*x4-7*x5 == -5,
        -9*x1+5*x2+5*x3-4*x4+9*x5 == 4,
      ], [x1,x2,x3, x4, x5])
    

    and the result was given as

    [[x1 == 286/1051*r1 - 241/1051*r2 - 781/1051, x2 == -48/1051*r1 - 11/1051*r2 - 354/1051, x3 == -1329/1051*r1 + 418/1051*r2 - 211/1051, x4 == r2, x5 == r1]]
    

    where r1 and r2 represent the free or independent variables for this system. There are infinitely many solutions to this system.

    mark
  • edited August 2019

    The problem is to solve the following system:
    $$
    \begin{align}-4x_{1} - 2x_{2} + 9x_{3} + 7x_{4} + x_{5} &= 1\\
    - 8x_{2} + 9x_{3} + 5x_{4} &= 3\\
    x_{1} + x_{2} - x_{3} - 8x_{4} + 7x_{5} &= 7\\
    7x_{1} - 6x_{2} - 3x_{3} - 9x_{4} - 2x_{5} &= -3\\
    7x_{1} - 4x_{3} + 9x_{4} - 9x_{5} &= -3\end{align}
    $$

    Here is the code I used to solve the problem:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    -4*x1-2*x2+9*x3+7*x4+x5 == 1,
    -8*x2+9*x3+5*x4 == 3,
    x1+x2-x3-8*x4+7*x5 == 7,
    7*x1-6*x2-3*x3-9*x4-2*x5 == -3,
    7*x1-4*x3+9*x4-9*x5 == -3,
    ], [x1,x2,x3,x4,x5])
    

    The output I received was:

    [[x1 == (5934/12929), x2 == (-8915/12929), x3 == (-10602/12929), x4 == 
    (12577/12929), x5 == (26214/12929)]]
    

    The output indicates the system only has one possible solution. This means the output above is the unique solution to the system. The solution contains the value for each of the unknown variables that satisfies each of the equations in the system.

    By modifying the system and removing two equations, the system now becomes:
    $$
    \begin{align}-4x_{1} - 2x_{2} + 9x_{3} + 7x_{4} + x_{5} &= 1\\
    - 8x_{2} + 9x_{3} + 5x_{4} &= 3\\
    7x_{1} - 4x_{3} + 9x_{4} - 9x_{5} &= -3\end{align}
    $$

    Here is the code I used to solve the modified system:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
    -4*x1-2*x2+9*x3+7*x4+x5 == 1,
    -8*x2+9*x3+5*x4 == 3,
    7*x1-4*x3+9*x4-9*x5 == -3,
    ], [x1,x2,x3,x4,x5])
    

    The output I received was:

    [[x1 == 227/125*r1 - 67/25*r2 - 77/125, x2 == 261/250*r1 - 53/25*r2 - 93/125, 
    x3 == 116/125*r1 - 61/25*r2 - 41/125, x4 == r2, x5 == r1]]
    

    The output above indicates the system has infinitely many solutions. The variables $x_{4}$ and $x_{5}$ are considered to be free variables. Since $x_{4}$ and $x_{5}$ are free variables, this means that any value used for either $x_{4}$ or $x_{5}$ can be used to find the other unknown variables and satisfy the system.

    mark
  • edited August 2019

    Problem 1:
    My original system consists of the equations:
    $$
    \begin{align}
    7x_{1} - 5x_{2} + x_{3} + 9x_{4} + 8x_{5} &= -8\\
    x_{1} - x_{2} + x_{3} + 8x_{5} &= 8\\
    -x_{1} + 7x_{2} - x_{3} + 3x_{4} - 3x_{5} &= 5\\
    9x_{1} - 2x_{2} - 8x_{3} + 9x_{4} - 5x_{5} &= 4\\
    -2x_{1} - 7x_{2} + 2x_{3} + 4x_{4} - 2x_{5} &= 8
    \end{align}
    $$

    Here is the code that I used to solve the original system:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        7*x1-5*x2+x3+9*x4+8*x5==-8,
        x1-x2+x3+8*x5==8,
        -1*x1+7*x2-x3+3*x4-3*x5==5,
        9*x1-2*x2-8*x3+9*x4-5*x5==4,
        -2*x1-7*x2+2*x3+4*x4-2*x5==8,
    ], [x1,x2,x3,x4,x5])
    

    Here is the output from this solution:

    [[x1 == (-133099/21653), x2 == (-18802/21653), x3 == (-142327/21653), x4 == (41882/21653), x5 == (53731/21653)]]
    

    This system has only one possible unique solution. This solution consists of the values:
    $$
    \begin{align}
    x1 = \dfrac{-133099}{21653}\\
    x2 =\dfrac{-18802}{21653}\\
    x3 = \dfrac{-142327}{21653}\\
    x4 = \dfrac{41882}{21653}\\
    x5 = \dfrac{53731}{21653}
    \end{align}
    $$

    Removing the last two equations from the system leaves the modified system:
    $$
    \begin{align}
    7x_{1} - 5x_{2} + x_{3} + 9x_{4} + 8x_{5} &= -8\\
    x_{1} - x_{2} + x_{3} + 8x_{5} &= 8\\
    -x_{1} + 7x_{2} - x_{3} + 3x_{4} - 3x_{5} &= 5
    \end{align}
    $$

    Here is the code to solve this system:

    x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        7*x1-5*x2+x3+9*x4+8*x5==-8,
        x1-x2+x3+8*x5==8,
        -1*x1+7*x2-x3+3*x4-3*x5==5,
    ], [x1,x2,x3,x4,x5])
    

    This yields the output:

    [[x1 == -5/9*r1 - 11/6*r2 - 11/9, x2 == -5/6*r1 - 1/2*r2 + 13/6, x3 == -149/18*r1 + 4/3*r2 + 205/18, x4 == r2, x5 == r1]]
    

    In this output solution, $r1$ and $r2$ are free/independent variables for this undetermined system, which has infinitely many solutions.

    mark
  • edited September 2019

    My set of equations was:
    $$
    \begin{align}
    6x_{1} - 3x_{2} - 3x_{3} + 2x_{4} + 4x_{5} &= -2\\
    8x_{1} + 8x_{2} + 9x_{3} - 3x_{4} + 5x_{5} &= 5\\
    4x_{1} + 6x_{3} + 6x_{4} + 9x_{5} &= -7\\
    2x_{1} + 4x_{2} + 8x_{3} - 5x_{4} + 3x_{5} &= 5\\
    4x_{1} + 7x_{2} - 7x_{3} + x_{4} + 5x_{5} &= 0
    \end{align}
    $$

    My code for my set of solutions was:

     x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        6*x1-3*x2-3*x3+2*x4+4*x5 == -2,
        8*x1+8*x2+9*x3-3*x4+5*x5 == 5,
        4*x1+6*x3+6*x4+9*x5 == -7,
        2*x1+4*x2+8*x3-5*x4-3*x5 == 5,
        4*x1+7*x2-7*x3+x4+5*x5 == 0
    ], [x1,x2,x3,x4,x5])
    

    this yeilded the output of

    [[x1 == (-739/1228), x2 == (-112/307), x3 == (-93/614), x4 == (-1565/614), x5 == 
    (396/307)]]
    

    thus showing the single possible solution of the series for each associated variable.

    next I removed two random lines from the series leaving me with
    $$
    \begin{align}
    6x_{1} - 3x_{2} - 3x_{3} + 2x_{4} + 4x_{5} &= -2\\
    8x_{1} + 8x_{2} + 9x_{3} - 3x_{4} + 5x_{5} &= 5\\
    4x_{1} + 7x_{2} - 7x_{3} + x_{4} + 5x_{5} &= 0
    \end{align}
    $$
    and the code for solving the adjusted series.

     x1,x2,x3,x4,x5 = var('x1,x2,x3,x4,x5')
    solve([
        6*x1-3*x2-3*x3+2*x4+4*x5 == -2,
        8*x1+8*x2+9*x3-3*x4+5*x5 == 5,
        4*x1+7*x2-7*x3+x4+5*x5 == 0
    ], [x1,x2,x3,x4,x5])
    

    this yields new solutions that are now paramatrized and offer infinitely many solutions

    [[x1 == -701/1062*r1 - 115/1062*r2 - 14/531, x2 == -86/531*r1 + 98/531*r2 + 
    167/531, x3 == 31/177*r1 + 47/177*r2 + 53/177, x4 == r2, x5 == r1]]
    
    mark
  • @Student07
    I think your formatting could still use a bit of work. For example, here:

    $$[[x1 == (-1240/15919), x2 == (177/31838), x3 == (6935/15919), x4 == (-20974/15919), x5 == (-8424/15919)]]$$

    You're trying to typeset this mathematically with LaTeX, but it should be a code block. Same here:

    $$[[x1 == (139/43x4 - 147/43x5 + 102/43), x2 == (-229/172x4 + 133/86x5 - 40/43), x3 == (34/43x4 - 1/43x5 + 63/43)]]$$

    The following "code", however is not code:

    I used the code:
    M = Matrix([
    [2, 8, 1, 5, -4, -4],
    [14, -5, 7, -5, -5, -7],
    [-16, 3, -8, -4, 3, 5],
    [-12, 13, -6, 10, 1, 3],
    ]);
    M.rref()
    to put into row Echelon form:

    [ 1 0 1/2 0 -105/242 -68/121]
    [ 0 1 0 0 -83/121 -81/121]
    [ 0 0 0 1 57/121 60/121]
    [ 0 0 0 0 0 0]

  • @Student14

    What you've got looks great! But I don't think you finished the problem by considering the modified system.

This discussion has been closed.