Linear Algebra / Unit 2, Systems of Linear Equations / Topic 2.2
Unit 2. Systems of Linear Equations
This topic organizes elimination into a fixed procedure, called row reduction. The procedure works on the table of numbers of a system, and it works for any number of equations and unknowns.
You need Topic 2.1 for this topic.
In Topic 2.1, the numbers of a system were kept in a table, with one row for each equation. When the right sides are added to the table as a last column, the table is called the augmented matrix of the system. A vertical line separates the coefficients from the right sides.
x + y + z = 6 2x − y + z = 3 x + 2y − z = 2 11162−11312−12Each row is one equation. Each column on the left of the line belongs to one unknown. If an unknown is missing from an equation, its coefficient is 0, and the 0 must be written in the table.
Elimination changes a system into a simpler system that has the same solutions. In the table, three operations do this.
| Operation | Notation |
|---|---|
| Add a multiple of one row to another row | R₂ → R₂ − 2R₁ |
| Multiply a row by a number that is not 0 | R₃ → 3R₃ |
| Exchange two rows | R₂ ↔ R₃ |
The notation R₂ → R₂ − 2R₁ means that row 2 is replaced by row 2 minus 2 times row 1. Row 1 does not change. The operation is applied to all of the entries of the row, including the entry on the right of the line.
None of the three operations changes the solutions of the system. The first operation adds a multiple of one equation to another equation, the second multiplies both sides of an equation by the same number, and the third changes the order of the equations. Each operation can also be undone by another operation of the same kind.
The goal of the first stage is a table with zeros below a staircase of entries. Work from the left column to the right.
Step 1. Use row 1 to make zeros below the first entry of column 1.
R₂ → R₂ − 2R₁ R₃ → R₃ − R₁ 11160−3−1−901−2−4Step 2. Move to column 2. Exchanging rows 2 and 3 puts a 1 in the second position of row 2, which keeps the numbers simple.
R₂ ↔ R₃ 111601−2−40−3−1−9Step 3. Use row 2 to make a zero below it in column 2.
R₃ → R₃ + 3R₂ 111601−2−400−7−21The first entry in a row that is not 0 is called the pivot of that row. In the last table, the pivots are 1, 1, and −7. A matrix is in row echelon form when it satisfies two conditions.
The word echelon refers to the staircase shape that the pivots make. Reaching this form is called Gaussian elimination.
A row exchange is necessary when the entry in the pivot position is 0 and an entry below it is not 0. In Step 2 the exchange was a choice. It avoided fractions.
A matrix in row echelon form is solved from the bottom row to the top row. Write the rows of the last table as equations.
x + y + z = 6 y − 2z = −4 −7z = −21 z = 3the third equation, divided by −7y = −4 + 2(3) = 2the second equation, with z = 3x = 6 − 2 − 3 = 1the first equation, with y = 2 and z = 3The solution is (1, 2, 3), as in Topic 2.1.
The row operations can continue until the solution can be read from the table with no substitution. First make each pivot equal to 1. Then use each pivot to make zeros above it, starting with the last pivot.
R₃ → −1/7R₃ 111601−2−40013 R₂ → R₂ + 2R₃ R₁ → R₁ − R₃ 110301020013 R₁ → R₁ − R₂ 100101020013The rows now state x = 1, y = 2, and z = 3.
A matrix is in reduced row echelon form when it is in row echelon form and it also satisfies two more conditions.
Continuing to this form is called Gauss-Jordan elimination.
A matrix has many row echelon forms, because different choices of operations lead to different tables. It has only one reduced row echelon form. Two people who use different operations reach the same reduced table.
Try it: choose the row operations
Reduce the matrix to reduced row echelon form. Choose an operation, choose the rows, type the number c, and press Apply. The number c can be a whole number, a decimal, or a fraction such as −1/3. The line under the controls shows the operation before you apply it.
Row reduction follows the same order for any system.
A computer solves large systems in this way. A system with 1000 equations and 1000 unknowns takes a computer a fraction of a second.
| Term | Meaning |
|---|---|
| Augmented matrix | The coefficients of a system with the right sides as a last column |
| Row operations | Add a multiple of a row to another row, multiply a row by a number that is not 0, exchange two rows |
| Pivot | The first entry in a row that is not 0 |
| Row echelon form | Each pivot is to the right of the pivot above it, and rows of zeros are at the bottom |
| Back substitution | Solving the equations of an echelon form from the bottom to the top |
| Reduced row echelon form | Echelon form in which each pivot is 1 and is the only entry in its column that is not 0 |
Work each problem on paper first. Then open the answer to check your work.
2151−3−1
new row 2 = (3 − 3, 7 − 6, 13 − 12) = (0, 1, 1)row 2 minus 3 times row 1y = 1the second rowx = 4 − 2(1) = 2the first row, with y = 12 + 2 = 4the check in the first equation6 + 7 = 13the check in the second equation
No. The pivot of row 3 is in column 2, which is to the left of the pivot of row 2 in column 3.
Exchanging rows 2 and 3 gives a matrix in row echelon form.
R₂ → R₂ − 3R₁gives the row (0, −2, −4)R₂ → −1/2R₂gives the row (0, 1, 2)R₁ → R₁ − 2R₂gives the row (1, 0, 1)
The solution is x = 1 and y = 2.
R₂ → R₂ − 2R₁gives the row (0, 1, −1, −1)R₃ → R₃ − R₁gives the row (0, 1, 2, 8)R₃ → R₃ − R₂gives the row (0, 0, 3, 9)z = 3the third row states 3z = 9y = −1 + 3 = 2back substitution in the second rowx = 6 − 2 − 3 = 1back substitution in the first row
The solution is (1, 2, 3).
The first row is (0, 1, 2, 7). Its first entry is 0, so exchange rows 1 and 2.
R₃ → R₃ − 2R₁gives the row (0, −3, 1, 0)R₃ → R₃ + 3R₂gives the row (0, 0, 7, 21)z = 3the third row states 7z = 21y = 7 − 6 = 1back substitution in the second rowx = 7 − 2 − 3 = 2back substitution in the first row
The solution is (2, 1, 3).
Python reads the code one line at a time, from the top to the bottom. The equals sign stores the value on its right under the name on its left, and print shows a result. The name np stands for NumPy, the part of Python that works with vectors and matrices.
A matrix is typed one row at a time. Each row goes inside its own square brackets, and all of the rows go inside one more pair of square brackets. The code below stores the augmented matrix of the system in Practice Problem 5: x + y + z = 6, 2x + 3y + z = 11, and x + 2y + 3z = 14. The last number in each row is the right side.
The part dtype=float tells Python to store the entries as decimal numbers. Without it, Python stores whole numbers only, and a later division would give a wrong result.
Python
Python prints each entry with a period after it, because the entries are stored as decimal numbers.
Python counts rows from 0, not from 1. Row 1 of the matrix is M[0], row 2 is M[1], and row 3 is M[2].
Python
The result is row 2 of the matrix. Now change the last line so that it prints row 3.
Python
The operation R₂ → R₂ − 2R₁ is written as M[1] = M[1] - 2 * M[0]. The right side calculates row 2 minus 2 times row 1, and the equals sign stores the result as the new row 2.
Python
Row 2 is now 0, 1, −1, −1.
In the next box, add one line before the print line that does the operation R₃ → R₃ − R₁. Click at the end of the second line and press Enter to make a new line.
Python
The next box already has the two operations from Step 3. Add one more line before the print line, so that the entry below the second pivot becomes 0. Decide which operation is needed from the matrix at the end of Step 3.
Python
The code below starts from the row echelon form and continues to the reduced row echelon form. The second line divides row 3 by 3, so that its pivot is 1. The / sign means division. The third line uses row 3 to make a zero above its pivot in row 2.
Python
Rows 2 and 3 now state y = 2 and z = 3. Row 1 still has the entries 1, 1, 1, 6.
In the next box, add the operations that make zeros above the pivots in row 1. You can use two lines, one for each operation.
Python
The last column of the reduced matrix is the solution (1, 2, 3).
The instruction np.linalg.solve from Topic 2.1 does row reduction for you. It needs the matrix of coefficients and the vector of right sides.
Python
The result is [1. 2. 3.], the same solution as in Step 5. Small rounding errors in the last digits are normal.
This quiz has 5 questions on this topic. A question asks you either to choose one answer or to type numbers. The page grades your answers and explains each one. A number can be typed as a whole number, a decimal, a fraction such as 1/3, or a calculation such as sqrt(18)/2 or arccos(1/2). The page shows the value of a calculation next to the box. Angles in a calculation are in degrees. The Calculator button under each question opens a calculator. Your answers are saved in your browser, so they are still on the page when you come back to it.
Choose how your answers are checked
1. Which matrix is the augmented matrix of the system x + 2y = 4, 3x − y = 5?
Each row holds one equation. The coefficients of x and y come first, and the right side comes after the bar.
2. Apply the operation R₂ → R₂ − 2R₁ to the matrix 132275. Write the new second row.
new row 2 = (2 − 2, 7 − 6, 5 − 4)the second row minus 2 times the first rownew row 2 = (0, 1, 1)
3. Which of these matrices is in row echelon form?
In row echelon form, each pivot is to the right of the pivot in the row above it, and the entries below each pivot are 0. Only the last matrix has the pivots 1, 4, and 6 in this staircase pattern.
4. Solve by back substitution the system with the augmented matrix 128039.
3y = 9the second rowy = 3divide both sides by 3x + 2y = 8the first rowx = 8 − 6 = 2substitute y = 3
5. Which of these matrices is in reduced row echelon form?
In reduced row echelon form, each pivot is 1, and each pivot is the only entry in its column that is not 0. The first matrix has a 2 above a pivot, the second matrix has a pivot of 2, and the last matrix is not in row echelon form.