Lecture 2 · Matrix elimination
Use Gaussian elimination to transform the system of equations into an upper triangle, and understand the conditions for failure of pivot components, multipliers, and elimination.
On this page
Elimination with matrices | Gilbert Strang | MIT 18.06 Linear Algebra
Lecture 2 / Total 35 Lectures |Part 1 · Elimination and Vector Spaces
Video of this lecture: Bilibili p2 · Matrix elimination ↗(47:42)| 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
Last lecture It is interpreted into three views: the row view looks at the equation, the column view looks at the linear combination of column vectors, and the matrix view looks at a multiplication. All three views explain what the problem is, but do not give a solution. This lecture supplements this method, which is elimination (elimination). Elimination is not a determinant method - determinants don’t appear until much later in the course - but what all numerical software really does when solving a system of linear equations: change the coefficients below the main diagonal to zero in a fixed order, Convert it into an upper triangular matrix, and then solve it backwards from the last equation.
There are two clues in this lecture. The first is the algorithm itself: use a Example, step by step forward elimination (forward elimination), see clearly what roles the pivot, multiplier, and augmented matrix play, and then back generation (back substitution) to find the solution. Also ask a reverse question: When will this algorithm fail? If the pivot position is , can it be saved by exchanging two lines? If it can’t be saved, what’s wrong with the matrix itself?
The second clue is to translate these actions into the matrix language. The key ideas of the entire course must ultimately be written as matrix operations rather than just textual descriptions. “Subtract the first row from the second row Times” can be written as a left multiplication of a matrix ; By stringing together the two-step elimination, we get . Matrix multiplication allows moving parentheses but does not allow exchange of orders. This pair of properties determines that elimination matrices can only be multiplied in a fixed order. Finally, reverse the steps and get the inverse matrix sum threshold.

MIT OCW Official Lecture Notes Summary Page 1/3 (18.06SC Lecture 2 Summary, CC BY-NC-SA 4.0).
1. From system of equations to augmented matrix
Consider a system of equations with three equations and three unknowns
Arrange the coefficients into a matrix by position to get the coefficient matrix and the right-hand vector
So the question is written as . Note that in the third equation there is no , so of The location is ;This term will later make the multiplier of a certain step exactly equal to .
When actually doing elimination, copy over and over again The equals and plus signs are pure burdens, all the information is already in the numbers. But the equation cannot be lost: the transformation done on the left end at each step of elimination must be done simultaneously on the right end. By connecting the right end as an extra column to the right side of the coefficient matrix, we get augmented matrix:
“Zengguang” means “to connect one piece to another.” This column is not used as a pivot during the elimination process, but is rewritten along with the row transformation; when the left end becomes an upper triangle, this column becomes the new right end vector. The right-hand side is written into the same table to ensure that the rule “do the same thing on both sides of the equation” is not missed. In actual software, the left end is often eliminated to the upper triangle first, and then the same steps are performed on the right end. The results of the two methods are the same, but the calculations of the left and right ends are performed separately.
2. Forward elimination: pivot element, multiplier, upper triangle
The first step in elimination is to take the first equation and use it to eliminate the following two equations . In the first equation The coefficient of is , this number is called pivot, which is the “key number” used in this step to eliminate the elements below. The row where the pivot is located remains unchanged in this step, and is only used to eliminate other rows, so it is called the pivot row.
Now decide on the multiplier. The purpose is clear: let the second line locational become . Since the first line The coefficient is , use To subtract the first line of times, just get this offset. So this step multiplier (multiplier) is . It is agreed to use “subtract” instead of “add”: subtract in the second line times the first row,
Count each item item by item. The first line remains unchanged, still . second line subtract , get : , , . The third line The first item of is originally , the multiplier is , minus Double the first line and nothing changes.
The right end is synchronized: the second line subtract , the remaining ; first line of and the third line Not moving. So the augmented matrix becomes
The first step is completed, has disappeared from the last two equations, and the problem is reduced to two equations and two unknowns . Strictly speaking, the first step deals with location; The location is already , the multiplier is , no further action is required. A real program would still “look” at this number, only to find that no calculation is needed.
The second step continues with the new pivot. at this time positional is the second pivot element, and the one below it The location is . use times the second row and subtracts the third row, the multiplier is :
The third line subtract , get . Right end: . So far
The left end becomes one upper triangular matrix(upper triangular matrix), is the first letter of upper; the right-hand vector is denoted as , it is The result after going through the same steps. The purpose of the entire elimination can be summarized in one sentence: become , put become , while with the original equation Same solution. The three main elements are , all fall on the diagonal; no obstacles were encountered in this step, indicating that the properties of this matrix are very good. By the way, by multiplying the three pivot elements we get , exactly The determinant of - The determinant will not be discussed until later, but its value is already hidden on the diagonal.

Video 00:04:46 | Approximately corresponding to section 2 “2. Forward elimination: pivot element, multiplier, upper triangle”.

Video 00:11:26 | Approximately corresponding to section 2 “2. Forward elimination: pivot element, multiplier, upper triangle”.
3. Back generation
Writing back the equation form is
This system of equations is triangular: the last equation contains only , the penultimate one contains only , the first three are included. To solve the problem, start from the last one and defeat them one by one from bottom to top. This process is called back generation.
Obtained immediately from the third formula
put Substituting into the second equation: , so , got . again Substituting into the first equation: , so , got . The solution is
Substitution test for the original system of equations: the first equation ;Second formula ;Third formula . All three equations hold true and the solutions are correct.
The reason why backgeneration can be carried out in this order is entirely because is upper triangular: each equation has only one new unknown in its turn. This also explains why elimination requires effort to create a triangle first - turning a general system of equations into a triangle, and the rest is just mechanical substitution. The combination of elimination and substitution is a complete solution.
4. When does elimination fail?
The previous example went well, but the algorithm must be able to cope with bad situations. The so-called failure refers to not being able to collect three main elements after completing the forward elimination. There are two kinds of failure, those that can be remedied and those that cannot.
The first type: the position of the main element is , but there are non-zero elements below. Assume that the first equation of The coefficient is not Rather , the first pivot cannot be taken out. Don’t give up at this time, just swap the two lines: put one of the following If the equation with non-zero coefficients is moved to the first line, the pivot component will be there. This “temporary failure” only requires that the corresponding position of the line being replaced is not .
The same phenomenon will appear in later steps. In the example Change to , after the first line, the second line becomes , The position has become , the second pivot cannot be taken out. But look below it: The location is , non-zero, so swap the second and third lines to continue. The matrix is not bad, it’s just that the order is not what the algorithm likes.
The second type: the pivot position is , and all below . This failure cannot be remedied. put in example locational Change to , the first step is still the same, and the second line is still , the third line becomes . Then perform the second step and subtract the third line Times the second line: . The third pivot position appears , and there are no rows underneath it, and there is nowhere to change them. The matrix has only two pivots, called singular matrix (singular matrix), it is irreversible, and the system of equations no longer has a unique solution for each right-hand vector.
From the column view, there is a clear geometric reason for this failure. When The location is when, The third column of is , while
i.e. the third column is exactly a combination of the first two columns and does not provide any new direction. The three column vectors are pressed into the same plane passing through the origin, and their linear combination cannot jump out of this plane, so only those that fall within this plane Only then can there be a solution. Column vectors are linearly related, pivots are missing, and matrices are irreversible. These three things are three ways of saying the same thing.
The criterion for judgment is therefore very specific: in the process of elimination, the principal element cannot be ;Once a certain pivot position appears , first check if there are non-zero elements directly below that can be replaced. If there are, then the matrix will continue with a new line. If not, the matrix will be singular. The step of changing to rows is itself a matrix operation, which will appear later in the form of a permutation matrix.

Video 00:18:07 | Approximately corresponding to Section 4 “4. When does elimination fail”.
5. Write one-step elimination as a matrix
So far, elimination has been described in words. Next, subtract the first row from the second row times” is written as a matrix. The key preparation is understanding what matrix multiplication does in the row direction.
The previous lecture emphasized columns: multiplying a matrix by a column vector, the result is a linear combination of the columns of the matrix. Now let’s look at the symmetry side. Get a row vector Take left , the result is still a row vector whose The components are
That is to say, Each column of is calculated by the same set of coefficients weighted sum. Putting the whole line together, the conclusion is
Multiplying a row vector on the left by a matrix yields a linear combination of the rows of the matrix. This is completely parallel to “right multiply a column vector by a matrix to get the combination of each column”: matrix multiplication can be read in the column direction as well as the row direction, which is the central idea of linear algebra.
The idea of row combinations can immediately be applied to elimination. The matrix you are looking for Satisfy: the first row does not move, the third row does not move, the second row becomes “the second row minus times the first line”. Since each row of the product is Press each row The coefficients of the corresponding rows are combined, The line directly states the recipe:
- Take the first line , meaning as long as the first line of;
- The third line takes , meaning as long as The third line of;
- The second line takes , indicating Double the first row and add Times the second row.
thus
You can spot check any element by using the dot product of “row times column”. Productive element, take The second line of with The third column of Do the dot product: , and in the result locational consistent.
The subscript of this matrix Its corrected position is recorded: No. Row, No. columns. it’s called elementary matrix (elementary matrix), also called elimination matrix, denoted as . Its shape is very regular: all the diagonals are , only below the main diagonal Put one everywhere ;on the diagonal Make sure that each row retains a copy of its own row. The negative number below is the multiple to be subtracted.
The same goes for the second step. To “subtract the third line times the second row”, the matrix simply needs to be in place :
If there is nothing to do at a certain step, the corresponding matrix is identity matrix(identity matrix): It is all on the diagonal , nothing changes when multiplied by it, and its effect is equivalent to that in numbers . Example The multiplier for that step is , corresponding to That’s it , it doesn’t matter whether you write or not.

MIT OCW Official Lecture Notes Summary Page 2/3 (18.06SC Lecture 2 Summary, CC BY-NC-SA 4.0).

Video 00:29:06 | Approximately corresponding to Section 5 “5. Write one-step elimination as a matrix”.

Video 00:31:00 | Approximately corresponding to section 5 “5. Write one-step elimination as a matrix”.
6. Associative law, permutation matrix and left multiplication and right multiplication
Two-step elimination can be written in conjunction. Take first , then multiply , get :
The bracket on the left indicates that the first step should be done first. But matrix multiplication allows the parentheses to be removed:
This property is called associative law (associative law). Its significance is not only convenient for accounting: once the brackets are moved, It becomes a separate matrix, which completes the entire elimination at once, from directly to . put two Multiplied out is
Can be verified directly . But pay attention to this The third line of is , the original multiplier and Tangled inside , it is impossible to tell which two steps Elimination has taken. This observation turns into another, smarter path in the next section.
The associative law holds, but the commutative law does not. Normally
The order of matrix multiplication cannot be changed at will. The step of elimination is to subtract the first row first, and then subtract the second row. If you reverse it, you will calculate something completely different. So the brackets can be moved, but the factors cannot: it must be done first , do it again , the matrix calculated after the order is reversed is completely different.
Another type of elementary matrix is responsible for exchanging two rows. it’s called permutation matrix (permutation matrix), recorded as . The way to find it is simple: swap the two rows of the identity matrix that need to be swapped, and the resulting matrix can do the same row swap for any matrix. to For example, the permutation matrix that swaps two rows is
its first line means “take the second row of the original matrix”, the second row It means “take the first row”, which is exactly the application of the row combination rules.
same one Placed on the right, the effect is completely different:
The right multiplication swaps the columns. The reason is still in the combination rule: when multiplying on the right, each column of the product is the column of the original matrix according to The coefficients of the corresponding columns are combined, the first column of It means “the new first column is taken from the original second column”. This gives an orientation rule that runs throughout the course:
Left multiplication performs row transformation, and right multiplication performs column transformation.
All elimination does is row transformation, so the elimination matrix is always left multiplied. This rule also explains why you cannot use a left-multiplied matrix to exchange columns: if the position is wrong, the effect will change the object. The existence of the permutation matrix just fills the gap left in Section 4 - the emergence of the pivot position The line break that was used to save the situation was a Take left .

Video 00:38:56 | Approximately corresponding to section 6 “6. Associative law, permutation matrix and left multiplication and right multiplication”.
7. Going backwards: inverse matrix and prototype
Editor’s Note: Complete Decomposition is the theme of the fourth lecture; in the end, this lecture only goes to the inverse of the elimination matrix. The second half of this section The derivation of is a supplement by the editor, just to close the intuition of elimination and inverse matrices, and it can be used as a preview of the next stage. The formal content shall be subject to Lecture 4.
Package the entire elimination element into After that, a natural thought is: can we not count it? , but directly from return to ? It is much easier to walk backwards than forwards, because the reverse movement of each step of elimination is visible at a glance.
Let’s look at the first step. What it does is “the second row subtracts times the first row”, then the action to offset it is “add back the second row times the first line”. To write it as a matrix, just put locational Change to :
Verify it: The first line of is , the third line is , the second line is , the result is exactly the identity matrix. here called of inverse matrix (inverse matrix): It is obtained by multiplying it with the original matrix , which is equivalent to undoing the original transformation. This notation reads ” The inverse of”. Its effect on the right end can also be undone: Under this multiplier it becomes , add back The first line of times is restored to .
In the same way, The inverse of locational Change to . Connect the two steps of undo in reverse order to get the total matrix The inverse of:
Note that the order is reversed: walking forward is first after , if you go backwards, you must first cancel , and then cancel , so written on the right. This matrix looks like Much cleaner: on the diagonal is , with two multipliers placed intact below and , one step at a time, without interfering with each other.
in Take left on both sides , get
is the first letter of lower, which is a lower triangular matrix with all diagonals , below is the multiplier used for elimination. Directly multiply the verification: The second line of given , exactly The second line; the third line given , exactly the third line.
this is prototype. it is related to Says the same thing but records it in the opposite way: Remember “Yes” What has been done”, the multipliers are multiplied together and lumped together; Remember that ” What is it made of?” with each multiplier in its place and left as is. The next lecture will talk about matrix multiplication and inverse matrix, and the fourth lecture will officially cover it. explained; now just remember where it comes from - by reversing each step of elimination, the multiplier goes from free it and write it directly into .

Video 00:42:56|Approximately corresponding to Section 7 “7. Going backwards: inverse matrix and “prototype” nearby.

MIT OCW Official Lecture Notes Summary Page 3/3 (18.06SC Lecture 2 Summary, CC BY-NC-SA 4.0).
Summary of this lecture
- elimination (elimination) is the solution is a general algorithm and is also the method actually used by all numerical software; it first Turn it into an upper triangle and then return it to another generation.
- pivot (pivot) is the key number used to eliminate the elements below in the current step of elimination. It cannot be ; multiplier (multiplier) is equal to the number to be eliminated divided by the pivot, The multiplier in the example is , , .
- Connect the right end as an extra column to get on the right augmented matrix;For each row change on the left end, the right end must be done simultaneously. Example became .
- forward elimination put transformed into an upper triangle , three principal elements is its diagonal element; the product of the principal elements is equal to The determinant of , here is .
- back generation (back substitution) Solve upward from the last equation: Got , Got , Got , the solution is .
- Two forms of elimination failure: The pivot position is However, there are non-zero yuan below, and exchange remedies can be carried out (such as placing Change to ); the pivot position is and all below are , then the matrix Strange (such as of Change to , only two pivots remain). Singularity is equivalent to the linear dependence of column vectors: in the above case, third column exactly equal to Times the first column minus the second column, the three column vectors are coplanar.
- Multiply the row vector by the matrix on the left to get the linear combination of each row; therefore “the second line minus Times the first line” is left multiplication ——The diagonal elements are all , only in put away .
- Depend on associative law (associative law), the brackets can be moved, so Complete all eliminations at once; but , the order of the matrices cannot be exchanged.
- permutation matrix Obtained by exchanging two rows of the identity matrix; Left multiplication performs row transformation and right multiplication performs column transformation..
- The inverse of an elimination matrix simply changes the sign of the multiplier: in write everywhere . by Got , Leave the multiplier as is below with , this is the fourth lecture The starting point of decomposition.
keywords
| English | Chinese | One sentence explanation |
|---|---|---|
| elimination | elimination | Set the coefficients below the pivot element to zero, and then Algorithm for solving upper triangle |
| forward elimination | forward elimination | Eliminate the elements column by column from the upper left to the lower right, and we get process |
| back substitution | back generation | Start with the last equation and work your way up to the unknowns one by one. |
| pivot | pivot | The current step of elimination is used to eliminate the key number of the element below, which cannot be |
| pivot row | main row | The line that remains unchanged in the current step and is used to eliminate the element below it |
| multiplier | multiplier | The “pivot row multiple” to be subtracted from a row is equal to the element to be eliminated divided by the pivot |
| augmented matrix | augmented matrix | The matrix obtained by connecting the right end column to the right side of the coefficient matrix |
| upper triangular matrix | upper triangular matrix | A matrix with all zeros below the main diagonal, the target form of elimination |
| row exchange | row swap | When the pivot position is zero, swap two rows to obtain a non-zero pivot |
| singular matrix | singular matrix | A matrix with insufficient number of pivot elements and irreversible |
| elementary matrix | elementary matrix | The matrix corresponding to a row transformation, such as , |
| permutation matrix | permutation matrix | A matrix with two rows (or two columns) swapped, obtained by swapping the rows of the identity matrix |
| identity matrix | identity matrix | All on the diagonal are matrix, equivalent to the number in multiplication |
| associative law | associative law | , the brackets can be moved, and matrix multiplication satisfies |
| commutative law | commutative law | , matrix multiplication generally does not satisfy |
| inverse matrix | inverse matrix | Multiply the original matrix to obtain the identity matrix, which is used to undo a transformation. |
| LU factorization | LU decomposition | put written as lower triangle and upper triangle The product of Record elimination multiplier |
Machine-assisted translation · Read Chinese original
