Linear Algebra / Unit 3, Matrices / Topic 3.6
Unit 3. Matrices
This topic shows that elimination writes a square matrix as a product of two triangular matrices, A = LU. The factorization keeps a record of the elimination steps, so that the same matrix can be used again with new right sides.
You need Topics 2.2, 3.2, 3.3, and 3.4 for this topic.
Each row operation of Topic 2.2 can be done by multiplying the matrix on the left by another matrix. To find that matrix, apply the row operation to the identity matrix. The result is called an elementary matrix.
For example, the operation R₂ → R₂ − 2R₁ on a matrix with three rows is the multiplication by
E = 100−210001Check it on a matrix A.
EA = 100−210001 211433879E subtracts 2 times row 1 from row 2EA = 211011879row 2 is now (0, 1, 1)Row 2 of the product is row 2 of A minus 2 times row 1 of A. The other rows did not change.
The inverse of an elementary matrix undoes the row operation. To undo “subtract 2 times row 1 from row 2”, add 2 times row 1 to row 2. So the inverse of E has +2 in place of −2.
E⁻¹ = 100210001Reduce the matrix A to row echelon form, and write down the multiplier of each step. The multiplier is the number of times that the pivot row is subtracted.
| Step | Operation | Multiplier | Result |
|---|---|---|---|
| 1 | R₂ → R₂ − 2R₁ | 2 | 211011879 |
| 2 | R₃ → R₃ − 4R₁ | 4 | 211011035 |
| 3 | R₃ → R₃ − 3R₂ | 3 | 211011002 |
The final matrix is upper triangular. It is called U. Its diagonal entries are the pivots 2, 1, and 2.
The three steps are three multiplications by elementary matrices, E₃E₂E₁A = U. Multiplying both sides by the inverses, in the reverse order, gives A back.
A = E₁⁻¹ E₂⁻¹ E₃⁻¹ U = LUThe matrix L = E₁⁻¹E₂⁻¹E₃⁻¹ is lower triangular, and it does not need to be calculated. It has 1 in each diagonal position, and each multiplier appears below the diagonal, in the position of the entry that the step removed.
L = 100210431 U = 211011002The multiplier 2 removed the entry in row 2 and column 1, so it is in row 2 and column 1 of L. The multipliers 4 and 3 are in row 3. Check the product:
LU = 100210431 211011002multiply the two triangular matricesLU = 211433879the product is AL stands for lower triangular and U stands for upper triangular. The matrix U is the result of elimination, and the matrix L is the record of how elimination reached it.
Step by step: building L and U
Press Next to do one elimination step. Each multiplier is written into L as soon as it is used. The last step multiplies L and U to check the result.
To solve Ax = b, write the system as L(Ux) = b and call the vector Ux by the name y. The system splits into two triangular systems.
For example, solve Ax = b with b = (5, 13, 33).
Forward substitution with L:
Back substitution with U:
The solution is (1, 1, 2). Check:
2 + 1 + 2 = 5the first equation4 + 3 + 6 = 13the second equation8 + 7 + 18 = 33the third equationThe vector y is the right side after elimination, so the two substitutions do the same work as row reduction on the augmented matrix. The gain appears when the same matrix A is used with many different right sides. The elimination is done once, to find L and U. After that, each new right side needs only the two substitutions, which are much faster than a new elimination. In physics and engineering, the matrix often describes a fixed structure or circuit, and the right sides are the different loads or inputs.
Elimination needs a row exchange when a 0 appears in a pivot position. From Topic 3.3, a row exchange is a multiplication by a permutation matrix P. If the rows of A are first put in an order that needs no further exchanges, the reordered matrix PA has a factorization.
PA = LUFor example, the matrix below has a 0 in the first pivot position. Exchanging its two rows gives a matrix that is already upper triangular.
A = 0213 P = 0110 PA = 1302 = 1001 1302Computer programs also exchange rows when a pivot is very small compared with the entries below it, because dividing by a very small number increases the rounding errors.
From Topic 3.4, the determinant of a product is the product of the determinants, and the determinant of a triangular matrix is the product of its diagonal entries. The diagonal entries of L are all 1, so det L = 1.
det A = (det L)(det U) = product of the pivotsFor the example, det A = (2)(1)(2) = 4. When row exchanges are used, each exchange changes the sign, as in Topic 3.4.
| Term | Meaning |
|---|---|
| Elementary matrix | The identity matrix after one row operation |
| Multiplier | The number of times the pivot row is subtracted in one step |
| U | The upper triangular matrix that elimination produces |
| L | The lower triangular matrix with 1 on the diagonal and the multipliers below it |
| Forward substitution | Solving Ly = b from the top row to the bottom row |
| PA = LU | The factorization when row exchanges are needed |
Work each problem on paper first. Then open the answer to check your work.
Apply the operation to the identity matrix: E = 100010501.
The inverse subtracts 5 times row 1 from row 3: E⁻¹ = 100010−501.
R₂ → R₂ − 3R₁gives the row (0, 4), with the multiplier 3L = 1031the multiplier goes below the diagonalU = 2104the row echelon formrow 2 of LU = 3(2, 1) + (0, 4) = (6, 7)the check
R₂ → R₂ − 2R₁gives the row (0, 1, 2)R₃ → R₃ − 3R₁gives the row (0, 2, 5)R₃ → R₃ − 2R₂gives the row (0, 0, 1)
L = 100210321 and U = 123012001.
y₁ = 4forward substitution, row 13y₁ + y₂ = 20forward substitution, row 2y₂ = 20 − 12 = 8substitute y₁ = 44x₂ = 8back substitution, row 2x₂ = 2divide both sides by 42x₁ + x₂ = 4back substitution, row 1x₁ = 1substitute x₂ = 22 + 2 = 4the check in the first equation6 + 14 = 20the check in the second equation
The solution is (1, 2).
The pivots are the diagonal entries of U: 1, 1, and 1. No row exchange was used, so det A = 1.
The first pivot position holds 0, so no multiple of row 1 can remove the 2 below it.
Exchange the two rows. Then PA = 2301, which is already upper triangular, so L = I and U = PA.
The code below starts the factorization of the matrix A from Part 2 of this topic. The part dtype=float stores the entries as decimal numbers, so that divisions work correctly. The second line makes a copy of A under the name U, so that A itself does not change. The third line starts L as the 3 by 3 identity matrix.
Python counts rows and columns from 0. The entry in row 2 and column 1 of a matrix is written U[1, 0], and row 2 as a whole is written U[1]. The fourth line calculates the multiplier and stores it in L. The fifth line subtracts that multiple of row 1 from row 2.
Python
The multiplier 2 is now in L, and row 2 of U is 0, 1, 1.
In the next box, add two lines before the print lines. The first new line stores the multiplier for row 3 in L[2, 0]. The second new line subtracts that multiple of row 1 from row 3. Follow the pattern of the fourth and fifth lines.
Python
One entry below the diagonal of U is left, in row 3 and column 2. The pivot row for this step is row 2. Add the two lines that finish the factorization. The last line of the box multiplies L and U, so the last result should be the original matrix A.
Python
The code below solves Ax = b for b = (5, 13, 33) in the two stages of Part 4. The instruction np.linalg.solve solves each triangular system.
Python
The results are y = (5, 3, 4) and x = (1, 1, 2), as in Part 4.
Now use the same L and U with a new right side, b = (4, 10, 26). Change only the third line.
Python
When np.diag is given a matrix, it returns the diagonal entries of that matrix. The instruction np.prod multiplies all of the numbers in a list. Together they give the product of the pivots.
Python
The pivots are 2, 1, and 2. Their product is 4, which is the determinant of A.
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. The elimination of A = 2347 uses one operation, R₂ → R₂ − mR₁. Find the multiplier m.
The entry below the first pivot is 4, and the pivot is 2. The multiplier is 4/2 = 2.
2. For the same matrix A = 2347, find the second row of U.
new row 2 = (4 − 4, 7 − 6) = (0, 1)row 2 minus 2 times row 1So U has the rows 2, 3 and 0, 1.
3. The elimination of a 3 by 3 matrix uses the operations R₂ → R₂ − 3R₁, R₃ → R₃ + 2R₁, and R₃ → R₃ − 4R₂, with no row exchanges. Which matrix is L?
L holds the multipliers below its diagonal. The multiplier is the number that is subtracted, so the operation R₃ → R₃ + 2R₁ has the multiplier −2. The multipliers are 3 in row 2, and −2 and 4 in row 3.
4. Solve Ly = b by forward substitution, with L = 1021 and b = (3, 10).
y₁ = 3the first row2y₁ + y₂ = 10the second rowy₂ = 10 − 6 = 4substitute y₁ = 3
5. A matrix A is factored as A = LU with no row exchanges. The pivots are 2, 5, and −1. Find det A.
det L = 1, and det U is the product of the pivots.det A = (2)(5)(−1) = −10