Section2.2Solving Systems¶ permalink
SubsectionThe Assignment
- Read section 2.2 of Strang (pages 45-51).
- Watch a video or two from the YouTube series Essence of Linear Algebra by user 3Blue1Brown.
- Read the following and complete the exercises below.
SubsectionLearning Goals
Before class, a student should be able to do the following things.
- Clearly state and use the following vocabulary words: pivot, multiplier, triangular matrix, back substitution, singular, non-singular
Sometime after class, a student should be able to the following things.
- Perform elimination to put a system of linear equations into triangular form.
- Solve small systems by hand.
- Explain the two failure modes for elimination, and describe which leads to no solutions, and which leads to infinitely many solutions.
- Solve larger systems with the help of a computer algebra package (Sage).
SubsectionDiscussion: Elimination for Solving Systems of Linear Equations
Now we begin the process of learning how to solve a system of linear equations systematically through a process called elimination.
SubsubsectionSome terminology
A typical system looks something like this: \begin{equation*} \left\{ \begin{array}{rrrrrrrr} 3 x_1 & +& 2 x_2 & - & \pi x_3 & = & 0 \\ -4 x_1 & -& 33 x_2 & + & x_3 & = & 12 \end{array}\right. \end{equation*} This situation is two equations in three unknowns. The unknowns here are the three numbers \(x_1\), \(x_2\) and \(x_3\) for which we search. Usually, we bundle the numbers together as a vector \((x_1, x_2, x_3)\). If we can find a vector which makes all of the equations true simultaneously, we call that vector a solution.
Keep in mind that the process involves eliminating instances of the variable below pivots. Strang describes the process pretty well, and gives good examples. What Strang describes in this section is sometimes called the forward pass elimination.
Watch out for situations which are singular in that they have fewer pivots than unknowns. A system is called non-singular if it has as many pivots as unknowns.
SubsubsectionKeeping track of things
Playing with all of the equations is nice, but all that really matters is the collection of coefficients, and the numbers on the right hand sides of the equal signs. Experienced solvers get tired of copying notation from line to line in a computation, so they only keep track of the matrix of coefficients, augmented by the vector on the right-hand side. In the example above, that augmented matrix is \begin{equation*} \augmatrix{ccc}{ 3 & 2 & -\pi & 0 \\ -4 & -33 & 1 & 12 } \end{equation*} All of the row operations can be performed on just this augmented matrix, without losing any of the essential information.
SubsectionSageMath and Row Operations
The process of elimination for systems of equations involves performing operations on the equations. When translated to matrix form, it involves operations on the rows of the coefficient matrix. The corresponding matrix methods come in two types.
The first type of method modifies the matrix “in place”, which means that it Changes the input matrix.
- A.rescale_row(r, num) multiplies row r by the factor of num.
- A.swap_rows(r1, r2) switches the places of rows r1 and r2.
- A.add_multiple_of_row(target, useful, num). This adds num times row useful to row target.
Throughout, please remember that SageMath uses \(0\)-based indexing! So the rows are labeled 0, 1, 2, ...
This just did the whole process of forward pass elimination. (Well, we did a bit more than Strang would. He wouldn't rescale the rows.)
Sometimes you do not want to change the matrix A. If instead, you want to leave A alone, you can use these methods, which return a new object and do not change A.
- A.with_rescaled_row(r, num)
- A.with_swapped_rows(r1, r2)
- A.with_added_multiple_of_row(t, u, num)
Let's do the same operations as above, but without changing A. This will mean making a bunch of new matrices. In fact, let's also change the name of our matrix to B.
This second option has some advantages. At any point, you can revise your work, because the original matrix is still in memory, and so are all of the intermediate steps. Let's display all six of the matrices at once to see that they all still exist.
SubsectionExercises
Task28
Suppose that a system of three equations in three unknowns has two solutions \((1,0,-1)\) and \((2,1,2)\). Explain why the system must have other solutions than these two. Describe clearly two other solutions.Task29
Find three examples of numbers \(a\) so that elimination will fail to give three pivots for this coefficient matrix: \begin{equation*} A = \begin{pmatrix} a & 2 & 3 \\ a & a & 4 \\ a & a & a \end{pmatrix} \end{equation*}Task30
Complete the following to make an example of a system of two equations in two unknowns which is singular but still has a solution, or explain why no such example exists. \begin{equation*} \left\{ \begin{array}{ccccc} 2x & + & 3y & = & 1 \\ \bullet x & + & \bullet y & = & \bullet \end{array}\right. \end{equation*}Task31
Complete the following to a system of three equations in three unknowns which is singular and does not have a solution, or explain why no such example exists. \begin{equation*} \left\{ \begin{array}{ccccccc} & & 3y & - & z & = & 1 \\ 2x & - & y & + & 3z & = & 0 \\ \bullet x & + & \bullet y & + &\bullet z & = & \bullet \end{array}\right. \end{equation*}Task32
Complete the following to a system of three equations in three unknowns which is singular but still has a solution, or explain why no such example exists. \begin{equation*} \left\{ \begin{array}{ccccccc} x & + & y & + & z & = & 1 \\ 2x & + & y & + & 2z & = & 0 \\ \bullet x & + & \bullet y & + &\bullet z & = & \bullet \end{array}\right. \end{equation*}Task33
- How many ways can three planes in three dimensional space meet? Make examples to represent as many qualitatively different situations as you can.
- How many ways can two lines in the plane meet? Make examples to represent as many qualitatively different situations as you can.