Lecture 4 · LU decomposition of $A$
Write the elimination process as A=LU and understand why matrix factorization is the core of numerical calculations.
On this page
Factorization into A = LU | Gilbert Strang | MIT 18.06 Linear Algebra
Lecture 4 / Total 35 Lectures |Part 1 · Elimination and Vector Spaces
Video of this lecture: Bilibili p4 · LU decomposition of ↗(49:06)| MIT OCW official page ↗
Illustration: MIT OCW 18.06SC official lecture summary (CC BY-NC-SA 4.0) and Bilibili classroom video frames (time stamped), about 10 frames per lecture.
Introduction to this lecture
Lecture 2 writes each step of elimination as an elementary matrix, and Lecture 3 completes the rules for matrix multiplication; together we get . This formula is correct, but it is not easy to use. product Mix together the used multipliers from I can no longer read on my body what steps Xiaoyuan has taken.
This lecture is about writing the same thing in a different direction. Do not stack the elimination matrix in Instead of moving them to the right, you get the most basic factorization of the matrix:
is the end point of elimination, the upper triangular matrix; It is the result of multiplying the inverses of the series of elimination matrices in reverse order. The beauty is: Every multiplier used during elimination is kept intact, one step at a time, without interfering with each other. All the information is thus split into two halves: the “multiplier” and the “upper triangle”, and no one owes anyone anything.
Before reaching this step, we need to add two tools about inversion and transposition: why the inverse of a product must be in reverse order, and why finding the inverse after transposing is equal to finding the inverse first and then transposing. They are not just techniques; It is exactly the “reverse inverse” of the elimination matrix. The second half of the lecture turns to two more practical questions: How many operations are required for elimination? The answer is magnitude; and when the pivot position appears , what matrix should be used when a line break is necessary - permutation matrix (permutation matrix).

MIT OCW Official Lecture Notes Summary Page 1/3 (18.06SC Lecture 4 Summary, CC BY-NC-SA 4.0).
1. Inverse of product and inverse of transpose
Let me ask a direct question first: with All reversible, What is it? Intuition makes people write , but that’s not right. The two inverses do indeed need to be multiplied, but the order must be reversed:
Verification requires only multiplicative associativity. put with When multiplying, the brackets can be moved around, but the order cannot be changed:
The first step is to move the brackets to with to get the identity matrix; then multiply it by the left , get ;finally with cancel, what remains . The same holds true when multiplied in the opposite direction:
Both sides return to the identity matrix, so indeed The inverse.
Why the order must be reversed? You can use the metaphor of putting on shoes to remember: put on socks first and then put on shoes. To undo this process, you must take off shoes first and then socks. The order of disassembly is always the reverse of the order in which it is performed. This principle will be used repeatedly later - elimination is a series of row transformations, and undoing it naturally starts from the last step.
The second tool is Transpose. known , transposing a product also requires reverse order. now from Start and transpose both sides at the same time. The identity matrix remains itself after transposition: it is symmetric about the diagonal, and no change is visible when swapping rows and columns. The left end is expanded in reverse order into , so
This equation exactly illustrates Whose converse is it: it is the same as Multiply to get the identity matrix. Therefore
In other words, transposing a matrix first and then inverting it, and inverting it first and then transposing it, have the same result, and the order of the two things can be interchanged at will. This conclusion will be used repeatedly in the future. At this moment, remember its origin: it is entirely derived from It’s “turned” out of this equation.

Video 00:04:55|Approximately corresponding to Section 1 “1. The inverse of the product and the inverse of the transpose”.
2. Second level: first example of
Now use the tool on elimination. Let’s start with the simplest second-order situation and see clearly How did it come out. take
The first pivot is , to be eliminated locational , the multiplier is . The second row minus the first row Times: . Written as a matrix, it is
Read this multiplication line by line: The second line of Explain that the new second line is times the first line plus times the second row, i.e. ; first line Then leave the first line as is. only in A number is placed in the position, and its function is to write the sentence “the second row minus four times the first row” into a matrix.
specially placed in the position instead of , there is a reason. if there is , the second row happens to be the first row times, after elimination, the entire second row becomes zero, the second pivot does not exist, the matrix is singular, and the entire decomposition is impossible to talk about.
Now put Move to the right. Take both sides to the left at the same time , it only needs to put locational Change to : How much is subtracted by elimination and how much is added back by inverse operation. So
Directly test: The second line of given , exactly the second line; the first line given , that’s right.
is the first letter of upper, Naturally it is lower: It’s a lower triangle, with everything on the diagonal ; It is an upper triangle with two main elements sitting on the diagonal. with . In the second-order situation with There is only one symbol difference, so you can’t see much difference. The real difference is not revealed until the third level.
By the way, the main element can be brought out separately. put Divide the first row of , the second row is divided by , the pivots fit into a diagonal matrix:
On the diagonal of the factor on the left is , the one on the right is also the same, with the main element sandwiched in the middle, and the shape is smaller than More symmetrical. This way of writing is written as , among which is diagonal matrix (diagonal matrix). Both forms of the actual software will be given and will be used in this course from now on. .
3. Third order: the multiplier remains as is inside
The second order is too simple, one That’s enough. It’s not until level three that you can see why it’s worthwhile to move the reverse to the right. Set It is a third-order matrix, no line breaks are needed, and elimination is performed in a fixed order: use put The position becomes zero, then use Process , and finally use Process , get :
to make If you leave it alone on the left, multiply the three inverse matrices from left to right - note that each time you multiply one, it disappears on the left and appears on the right, and the positions where it appears are arranged upside down:
The order is completely reversed, which is exactly the result of the “reverse the order of undoing” rule in Section 1 being used three times in a row. The number of matrices is the number of elimination steps: order matrix to do steps, each step contributes an elimination matrix, that is, occupies a grid below the diagonal. The third level has multiplier, the fourth order has , exactly equal to The total number of cells below the diagonal.
Let’s use a specific example to see what this string of inverse matrices looks like. Set
express There is nothing to do at that step, there is already a zero there. Multiply the three elimination matrices in original order:
On the diagonal is , there are all zeros above the diagonal - elimination always uses the upper row to change the lower row, and information does not flow upward, which is different from Gauss-Jordan elimination. The problem is That location . It’s not wrong, but it’s ugly and has no clue where it came from. Let’s trace back: First, subtract the first row from the second row. times, then subtract from the third row new second line times. The new second line already contains the first line times, then multiply and subtract from the third row, equal to the first row Times stuffed into the third row. multiplier and Mutual contamination on this chain gave birth to a .
Now switch to the other side and do the reverse in reverse order. Inverting a single elimination matrix simply flips the signs: change , change .
Check line by line: take the first line of the second factor from the first line, and get ;The second line is ; Take the third row of the second factor as it is from the third row, and we get . Gone, with Everyone stays in their own cells, and no one interferes with anyone else.
A general conclusion can be drawn from this: As long as there is no row exchange, of Yuan() is to eliminate The multiplier used when positioning. Want to get it , no additional calculations are required, just write down the multiplier when doing elimination. Furthermore, after clearing the second line, the new second line is stored in , the multiplier is deposited into , the original You can throw it away—— All the information is already in with Everyone is in their place. This is the new understanding brought about by writing elimination in matrix form: There was a melee on the other side, This side is a refreshing ledger.
Once a certain pivot position appears , two lines must be exchanged, this neat set of accounting will be disrupted, then to be rewritten as . This is left to the next lecture.

Video 00:14:44|Approximately corresponding to Section 3 “3. Third order: the multiplier remains as is “nearby”.

Video 00:18:40|Approximately corresponding to Section 3 “3. Third order: the multiplier remains as is “nearby”.

MIT OCW Official Lecture Notes Summary Page 2/3 (18.06SC Lecture 4 Summary, CC BY-NC-SA 4.0).
4. The cost of elimination: why
So far we have talked about “how to do it”, and next we have to ask “how expensive”. one For a system of first-order equations, how many operations are required for elimination? This question has practical weight: Engineering always hopes to The bigger the matrix, the better, because the larger the matrix, the more information it can hold and the more reliable the results, but the price will also increase, so you must know how fast it increases. Can the system of equations be solved in one second? How long will it take? The key is to understand that the amount of calculation varies with Ways of growing - like With linear growth like that, doubling only takes twice as long; like For square growth like that, it takes four times the time to double; like In this way, if the cube grows, doubling it will take eight times; if it is like In that case, doubling it would be a disaster.
First, let’s define “one operation” clearly. A typical action is to multiply one row by a multiplier and then subtract from another row, with one multiplication and one subtraction in between. Here, multiplication and addition are counted as one operation; if the numbers are divided, the number of multiplications and subtractions is half, and the total number is only doubled, which does not affect the magnitude of the increase.
Now count the first steps. The order matrix has elements. In the first step of elimination, the first row does not move, and all the following rows need to be changed, so approximately elements, the cost is approximately . Strictly speaking, the first line has not been changed, the real number is less one, but compared to The difference is trivial—what is required here is the magnitude of the first item, not a precise item-by-item account.
In the second step, the first row is already in place, and there is no need to worry about the first column. The remaining A small problem of order, the cost is about . The next step is , so decreasing, the last few steps are just spinning around on a few numbers. The total is approx.
What is this sum? it obviously isn’t , nor ;There are a total of terms, the largest term is , so the worst is multiply , that is . While each item is decreasing, the actual ratio is Small, about one-third the size:
that It is calculated from the fact that “the numbers are getting smaller”. If you want to see its origin clearly, you can borrow calculus: in the continuous version, put from accumulated to ,
The same coefficients are obtained as the discrete summation. The summation is a discrete integral, and the integral is a continuous summation. The two must be consistent in the magnitude of the leading term.
This conclusion has two direct consequences. First, from double to , the price rises to approximately Times: , . Second, elimination is far better than any “formula solution”. The big formula for determinant is items, Anything larger is completely unfeasible; with The gap between them is the actual reason why modern numerical linear algebra is all based on elimination.
right end vector The account must be settled separately. It only has one column. Follow elimination all the way and do back-substitution at a cost of only magnitude, ratio One factor less . This is exactly The Economics of: Flowers put split into with Once, every time a new right-hand end vector comes, you only need to pay again . In engineering, it is often the same With many , first Breaking it down and then dealing with the right end one by one is the most cost-effective way to organize it.

Video 00:31:55|Approximately corresponding to Section 4 “4. The cost of elimination: why “Nearby.
5. Permutation matrix: Line wrapping is also a matrix multiplication
The last topic returns to the gap where elimination fails: the pivot position is , two lines must be swapped, sometimes even twice. Swapping two rows is the same as “subtracting a multiple of one row from another row”. It is a row transformation of the matrix, so it can also be written as left multiplication of a matrix. The only question is what this matrix looks like. The matrix that does this is called permutation matrix, recorded as . Its construction method is extremely simple: rearrange the rows of the identity matrix, and it can do the same row rearrangement for any matrix. The principle of inspection is the same as before—— Each row of has only one , that The position of indicates that the row of the product should be Which row of .
First list all third-order permutation matrices. If you count yourself as one, it will not change anything; By swapping the first two lines of , we get , swap the first and last two lines to get , they exchange the first and second rows with the first and third rows respectively:
In the same way, swap the second and third rows swapped The last two lines of are obtained. The first three (, , ) only exchanges one pair of rows, the remaining possibility is to rotate the three rows as a whole:
It is a cycle: the second row goes up to the first row, the third row goes up to the second row, the first row goes down to the third row; Then rotate in the opposite direction. Counting, there are exactly six. Generally, The number of order permutation matrices is , because each row arrangement corresponds to a matrix; the fourth order has .
These six matrices form a small closed family. When two permutation matrices are multiplied, the result is still in the list - first do a row rotation, then do a row rotation, and the total is nothing more than a row wrap. You can’t get out even by doing the inverse: if you put the changed lines back, you still get a line break. In algebraic language, they form a group (group), six elements, multiplication and inversion are not out of bounds.
Specifically, look at a few inverses. After exchanging the first and second lines, you only need to exchange them again to return to the original state, so It is the opposite of itself, . And with Inverse of each other: doing exactly The reverse rotation of .
The permutation matrix also has a beautiful property: Inverse equals transpose, . The reason is that each row and column of the permutation matrix has exactly one , the rest are all zero; transpose the “th “Which row the row is taken from” becomes “th where the rows were sent”, which happens to be the reverse description of the same row rearrangement. So for a permutation matrix, inversion and transposition are the same thing.
This closure has a very practical corollary: no matter how many times the rows are swapped during the elimination process, these swaps can eventually be merged into one , written as a clean prefix. This is exactly what the next lecture will do repair into The confidence: when the elimination must wrap, put ride on the left in front, with You can keep that refreshing accounting. At this point, the main line of elimination is finished.

Video 00:38:39|Approximately corresponding to Section 5 “5. Permutation matrix: line wrapping is also a matrix multiplication”.

Video 00:39:17|Approximately corresponding to section 5 “5. Permutation matrix: line wrapping is also a matrix multiplication”.

Video 00:44:11|Approximately corresponding to Section 5 “5. Permutation matrix: Line wrapping is also a matrix multiplication”.

MIT OCW Official Lecture Notes Summary Page 3/3 (18.06SC Lecture 4 Summary, CC BY-NC-SA 4.0).
Summary of this lecture
- The inverse of the product is in reverse order: , because undoing a series of operations must start from the last step; verification only uses the associative law, .
- Transpose and inversion can exchange the order: by Transpose both sides , so .
- Second order example The medium multiplier is , put turn into ; put Move it to the right , .
- It is the lower triangle and the diagonal elements are all ; It is the upper triangle and the diagonal element are the two main elements. If the pivot element is extracted separately, we will get In the form, the diagonal matrix in the middle contains the pivot element, and the diagonal elements of the factors on both sides are .
- third order situation Correspond ; in the example of Yuan is ( with caused by mutual contamination), and only clean ones with .
- Core conclusion: When no row exchange is performed, the multiplier used for elimination enters directly corresponding position without any additional calculation; new rows are stored in the elimination process , deposit multiplier , the original It can be discarded.
- The amount of operation of elimination: the first step is about , followed by , the total is approximately (available control).
- The cost of the right-hand vector is only ; therefore first decomposed into with (pay ), and then process multiple right-hand vectors one by one, which is the most economical approach. determinant formula Magnitude explains why only elimination is used in calculations.
- The permutation matrix is obtained by rearranging the rows of the identity matrix, level total one; the third level has There are 4 levels . They are closed to multiplication and inversion and form a group.
- The permutation matrix satisfies ;Swap a pair of rows It is the inverse of itself, and the two three cycles are the inverse of each other. The next lecture on writing in the context of line exchange .
keywords
| English | Chinese | One sentence explanation |
|---|---|---|
| factorization | decompose | Write a matrix as the product of several matrices with a simpler structure, such as |
| LU factorization | LU decomposition | put written as unit lower triangle and upper triangle The product of Record elimination multiplier |
| lower triangular matrix | lower triangular matrix | A matrix with all zeros above the main diagonal, The diagonal elements of are all |
| upper triangular matrix | upper triangular matrix | A matrix with all zeros below the main diagonal, The diagonal element of is the pivot element |
| diagonal matrix | diagonal matrix | A matrix whose off-diagonal elements are all zeros, The factor in the middle of the form |
| multiplier | multiplier | The “multiple of the pivot row” subtracted from a certain row during elimination. Enter directly without row exchange. |
| elementary matrix | elementary matrix | The matrix corresponding to one elimination step, its inverse only needs to change the sign of the multiplier |
| identity matrix | identity matrix | All diagonal elements are The matrix of is still itself after transposition |
| inverse matrix | inverse matrix | Multiply the original matrix to obtain the matrix of the identity matrix; the inverse of the product is taken in reverse order |
| transpose | transpose | Swap rows and columns; for a single matrix, transpose and inversion can swap the order |
| permutation matrix | permutation matrix | The matrix obtained by rearranging the rows of the identity matrix is used to exchange the rows to satisfy |
| row exchange | row swap | When the pivot position is zero, swap the two rows to obtain a non-zero pivot, as shown in Implemented by left multiplication |
| operation count | Amount of operation | The number of multiplications, additions and subtractions required to complete an algorithm, elimination is magnitude |
| group | group | A set of matrices that is closed to both multiplication and inversion, such as all order permutation matrix |
Machine-assisted translation · Read Chinese original
