Lecture 3 · Matrix multiplication and inverse matrix
Understand matrix multiplication from four perspectives, and master the existence conditions and methods of finding inverse matrices.
On this page
Multiplication and inverse matrices | Gilbert Strang | MIT 18.06 Linear Algebra
Lecture 3 / Total 35 Lectures |Part 1 · Elimination and Vector Spaces
Video of this lecture: Bilibili p3 · Matrix multiplication and inverse matrix ↗(46:49)| 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
In the previous lecture, each step of elimination was written as a matrix, and finally we got . Matrix multiplication has been used repeatedly there, but there is no explicit explanation of the rules. This lecture first makes up for this lesson: how to multiply two matrices. It is worth pondering that there are five different views of the same thing - counting by elements, counting by columns, counting by rows, counting by columns multiplied by rows, and counting by blocks. The five algorithms give the same matrix, but each illuminates one side of the result: looking column by column, the column of the product is The combination of columns; looking row by row, the rows of products are The combination of rows; looking at column multiplication rows, the product is split into a series of simplest matrix sums. Being able to calculate is just the starting point. Being able to read the same product from five directions is preparing for the subsequent column space, rank and matrix decomposition.
The second half of this lecture turns to inverse matrices. The definition is only one line , the real questions are two: What kind of square matrix has no inverse at all? How to calculate it when there is a reverse? The answer to the first question would translate “irreversible” into several equivalent terms - column vectors are linearly related (in appears as two collinear columns), there is a non-zero vector that is sent to zero, and (as you will see in Lecture 18) the determinant is zero. The second question is answered by Gauss-Jordan elimination: put with Connect them side by side to form a long matrix, and perform elimination on the left half until it becomes , the right half will automatically become .
The two halves are not independent. The reason why Gauss-Jordan is established depends on block multiplication and associative law: each step of elimination is regarded as a left-multiplied elementary matrix, and the multiplication of all is written as , then . In other words, the inverse matrix is “the disappear into That whole set of row transformations”.

MIT OCW Official Lecture Notes Summary Page 1/3 (18.06SC Lecture 3 Summary, CC BY-NC-SA 4.0).
1. The first view: multiply rows and columns to calculate each element
Set is matrix, is Matrix, the product is written as . of the line of work The elements of the column are denoted as , the line number comes first and the column number comes last. This is a unified convention throughout the course. Its algorithm is a familiar saying: of the line with of the Dot product of columns.
Take a specific location, such as . it comes from The third line of and the fourth column. The first term of the dot product is : is the first number in the third row, is the top number in the fourth column. The second item is , the third item is , all the way to the end of the row and the bottom of the column. Written as a summation, it is
subscript along walk in rows, along walking, both sides advance simultaneously, so the upper limit of the sum is .
This formula also stipulates the premise of multiplication. A row of number, There is also a column of Number, the dot product requires both sides to be the same length: The number of columns must equal number of rows. After being satisfied, of The rows determine how many rows the product has, of The columns determine how many columns the product has, is of; each element is accumulated term, the entire product has elements.
Element-wise calculation is a standard algorithm, and it is followed for both hand calculation and writing programs. But it focuses all its attention on the subscripts and cannot see the overall structure clearly. There is no room for choice in this definition: there is only one algorithm for matrix multiplication, and the following four views are just different readings of it; if any of the readings calculates different numbers, then it does not calculate the same number. . The following four views no longer focus on a single position, but regard the entire row, column or block as the unit of operation. They must give the same answer as the element-wise algorithm, the difference is only in the grouping method.

Video 00:04:41|Approximately corresponding to section 1 “1. The first view: multiply rows and columns, calculate each element”.
2. The second and third views: multiplying by columns and multiplying by rows
Let’s talk about columns first. put Cut into columns and record as , then
The reason is very straightforward: Which column of only participates in In which column, other columns cannot enter. So count It does not need to be regarded as a new task, as long as you can calculate “matrix times a column vector”, and then do the side-by-side Just do each column once. Multiplying matrices by vectors is something we have long been familiar with: is The linear combination of each column (linear combination), the coefficient is of each component. So we get the first conclusion of this lecture: product Each column of is combination of columns, the combination coefficient is written in in the corresponding column. The shape also matches: The columns are number, The columns also have The number and length remain unchanged.
Say it again. put cut in rows, of the Multiply the entire row to the left , get of the OK. In the previous lecture, we have clarified the effect of left multiplication of a row vector: it The rows are mixed by coefficient. So product Each line of is combination of rows, the coefficient is written in in the corresponding row. rows have number, There are also rows of The number and length are also consistent.
The elimination matrix in the previous lecture relies on this rule: Each row of is a set of coefficients, left multiplied by Just The rows are reorganized according to this set of coefficients, so “the second row minus three times the first row” is written as a matrix. The row view makes this clear—elimination is never changing the numbers, but the way in which rows are combined.
The two views add up to a symmetrical statement: The columns are taken from columns, The rows are taken from OK. This is not a coincidence, but a division of labor in multiplication - the matrix on the left provides the recipe, and the matrix on the right provides the materials; whether the action is on columns or rows depends on which side you look at.
3. The fourth view: multiply the columns by rows, and use the outer product to spell out the product
In the first view, multiplying rows and columns results in a number. Now reverse the order: columns times rows. One of the columns is , The line is , multiplied by the two to get a matrix, not a number. This difference in shape is worth pausing for a moment: the shapes of the two factors are reversed, and the result changes from a scalar to an entire matrix.
Use a short example to see the structure clearly. Get columns ride , this kind of “one column times one row” multiplication is also called outer product:
Read line by line: The first line is multiply Got , the second line is multiply Got , the third line is multiply Got . Read column by column: The first column is times , the second column is times . So the three rows of this matrix all fall into On the same straight line of , both columns fall through on the same straight line. This is exactly consistent with the rule of Section 2: the column of the product is A combination of columns, here With only one column, the combinations degenerate into multiples; the rows of products are The combination of rows also leaves only multiples.
put Adding up these “column multiplication rows”, we get the fourth algorithm:
Verify it. take
The first item is calculated above multiply ;The second item is multiply , due to Each component of is zero, and this entry is a zero matrix. The addition of the two terms is still
Check by element: location , location , location , all three elements match.
The fourth view splits the product into The sum of the simplest things: each term is a column with A small matrix obtained by multiplying one row of , and each small matrix has only one straight line in its row space and column space. This matrix, obtained by multiplying one column by one row, has the least amount of information and will later be called a rank-one matrix. Think of it as building blocks and any product can be built.

Video 00:13:41|Approximately corresponds to Section 3 “3. The fourth view: multiplying columns by rows, using outer products to spell out the product”.

Video 00:14:03|Approximately corresponds to Section 3 “3. The fourth view: multiply columns by rows, use outer products to spell out the product”.
4. The fifth view: block multiplication
There is one algorithm left that cuts the matrix into chunks neither by individual elements nor by entire rows and columns. For simplicity, let , They are all square arrays and the same size, each cut into four pieces:
The rule is: Treat each block as a number, and multiply the rows and columns as usual. The upper left corner of the product is equal to
because The first block of rows is , The first block of columns is , the paired sum is exactly these two items. The shape is also right: with They are all block sizes and can be added directly.
The chunks don’t have to be the same size, just “match”: The width of each column must be equal to The height of the corresponding block row, otherwise Such a product simply does not exist. The most common case is when all blocks are the same size, e.g. The matrix is cut into The four blocks of , at this time the product of each block is , the rules are the neatest.
Block multiplication is not a new operation, it just regroups the same batch of multiplications and additions. Section 1’s summation keys Accumulate item by item, multiply by blocks Packing segment by segment, first calculating within blocks, then calculating between blocks, the result remains unchanged. Because of this, this rule is particularly useful in proofs: as long as the matrix is regarded as a block matrix divided into two, the overall statement can often be reduced to the blocks.
The five views are unified at the level of segmentation. Cut the block to a single element, and the block multiplication is the element-wise algorithm of Section 1; The blocks are taken into whole columns, The blocks of are taken into full rows, and the sum of the block products is the column-row formula of Section 3. The thickness of the blocks can be freely selected, which shows that the five views describe the same operation, but are grouped in different ways.
So far, five methods are available: by element, by column, by row, by column multiplied by row, and by block. Their calculation formulas are different and they do the same batch of multiplications and additions, so the answers must be the same.

MIT OCW Official Lecture Notes Summary Page 2/3 (18.06SC Lecture 3 Summary, CC BY-NC-SA 4.0).
5. Inverse matrix: What kind of square matrix does not have an inverse?
Now let’s change the topic. Set It’s a square formation. If there is a matrix such that
Just call it invertible(invertible), called of inverse matrix (inverse matrix); an irreversible square matrix is called singular matrix (singular matrix), the reversible square matrix is also called non-singular (non-singular).
For an invertible square matrix, the left inverse and the right inverse are the same matrix: as long as you find a such that , it will automatically have . This fact is not obvious and requires proof, but it does hold. It is not true for rectangular matrices - the shape of a rectangle simply does not allow both sides to be true at the same time, and there will be a situation where there is only the left inverse or only the right inverse. Only the phalanx is discussed here.
Whether or not there is an inverse is the most important property of the square matrix. There is no need to wait for the algorithm to judge it. Each of the several opinions can give a reason. take
From a determinant perspective, , a square matrix with zero determinant is irreversible; however, the determinant will not officially appear until later in the course, so note this signal first.
From a column perspective, the two columns are with , while , they fall on the same straight line passing through the origin. Section 2 said that the column of products is The combination of columns, so no matter what matrix is multiplied on the right, each column of the result is still on this straight line. The first column of the identity matrix is not on it, therefore Impossible. If the columns are all crowded together on a line, the matrix will lose the other direction in the plane, and it cannot be made up no matter how much you multiply it.
From the perspective of equations, this reason is the most powerful. put the non-zero vector Send to zero:
In the language of columns, this is ” times the first column minus times the second column is equal to the zero column”. hypothesis exist, in Take left on both sides , we get on the left , we get on the right , so , with contradictory, so It cannot exist.
This argument also explains why the inverse matrix cannot be saved: put Pressed to zero, and any matrix multiplied by zero will get zero, There is no way of knowing which vector this zero comes from. So we get the most important criterion of this lecture: The square matrix is irreversible, which is equivalent to the existence of non-zero vectors such that ; In column language, it is equivalent to the existence of a set of coefficients that are not all zero, so that Each column of is combined into a zero column according to this set of coefficients, that is, each column is linearly dependent.

Video 00:30:26 | Approximately corresponding to Section 5 “5. Inverse Matrix: What kind of square matrix does not have an inverse”.
6. Gauss-Jordan elimination: solve all right-hand ends at once
Let’s take an example with an inverse:
two columns with The directions are different and no longer collinear. Their combination can cover the entire plane, so it should be reversible this time. The question is how to Figure it out.
By definition, is an unknown matrix. Four numbers are required, which can be found in columns. Set
The first column is , the second column is . Using the column point of Section 2, Reading in columns is two equations:
Generally, multiply of the column, equal to of the columns. Inverting a matrix is therefore equivalent to solving systems of equations that share the same coefficient matrix , just replace the right-hand vector with the columns of the identity matrix. There are two points to remember here: the coefficient matrices are the same, so the elimination steps can be shared; on the right end there is one, not one.
When Gauss solves a system of equations, the right end is used as an extra column after the coefficient matrix, and is modified along with the row transformation. This is the augmented matrix used in the previous lecture. Jordan’s advice is to Connect all the right ends and eliminate them all at once. So put with Writing growth matrices side by side
The left half is , the right half is . The goal is to turn the left half into , the right half will become .
The first step is to eliminate elements, eliminate locational : The second row subtracts Double the first row and do the same subtraction on the right half simultaneously. The first line does not move; the second line subtract , get
The left half is already an upper triangle. Gauss stops here and goes back to generation; Jordan’s approach is to continue and eliminate from bottom to top. now to locational Eliminate: subtract the first row Times the second row. The second line is , Times , subtracted to get
The left half is done , the right half is what you want:
Check multiplication and check the four items one by one:
location , location , location , location , all established.
In this example, both pivots happen to be , so the step of “dividing the pivot row by the pivot” is omitted. The main element is not When . On the other hand, if the elimination is stuck in the middle, the left half cannot be eliminated , then this It is impossible for a system of equations to have solutions simultaneously. It is also irreversible - the criterion of Section 5 is repeated here by the algorithm itself.

Video 00:37:14 | Approximately corresponding to Section 6 “6. Gauss-Jordan Elimination: Solving All Right Ends at One Time”.

Video 00:37:27 | Approximately corresponding to Section 6 “6. Gauss-Jordan Elimination: Solving All Right Ends at One Time”.
7. Why can elimination squeeze out
The above set of operations looks like magic: the right half is originally just the identity matrix, but after a series of transformations, it becomes the inverse matrix. The reason can be explained clearly using the language used in the previous lecture.
Each elimination is a left multiplication of the elementary matrix. Step 1 “Subtract the second line Times the first line “corresponds to
Step 2 “Subtract the first row Times the second line “corresponds to
Multiply the entire sequence of operations and note , it completes all steps at once. Pay attention to the order: do it first , do later , the latest step is written on the far left.
Yes Complete elimination is equal to left multiplication . When elimination is complete, the left half of this long matrix is , the right half is some unknown matrix; block multiplication will figure out who the right half is. put Seen as a block matrix, the two blocks are with , then
This step uses block multiplication, and the right block is multiply , the result is still . When elimination is completed, the left half of this long matrix is , so . According to the definition of inverse matrix, where and Multiply to get The matrix is , so
The right half records exactly , of course it is . This is the principle of the Gauss-Jordan method: the right half does not become right by chance, what it records along the way is the product of the serial transformation , while Be determined as .
In this case, put two Multiply it out and you can check this conclusion:
It is exactly the same as the right half obtained by elimination.
This proof also explains why it is necessary to pick up to the right and do the same row transformation on both halves. If only form Without recording the transformation, it is equivalent to calculating throw it away again; throw it away Bring it with you, are completely preserved. In other words, Gauss-Jordan is solved in one elimination at the same time. A system of equations sharing a common coefficient matrix, we get The columns in order are of columns.

Video 00:42:08|Approximately corresponding to Section 7 “7. Why can elimination “Squeeze out” nearby.

MIT OCW Official Lecture Notes Summary Page 3/3 (18.06SC Lecture 3 Summary, CC BY-NC-SA 4.0).
Summary of this lecture
- Matrix multiplication request The number of columns is equal to Number of rows: for , for time for , elements consisting of given, that is of the line with of the Dot product of columns.
- View by column, ;Each column of the product is The combination of columns, the coefficients come from corresponding column.
- Looking row by row, each row of the product is The combination of rows, the coefficients come from corresponding row. The five views do the same batch of multiplication and addition, so the answers must be the same.
- Multiplying the columns by rows yields the complete matrix: multiply given , all three lines have passed On the straight line, both columns pass , which is a rank 1 matrix.
- equal to Each column of The sum of the products of each corresponding row of . Block multiplication treats each block as a number, and the upper left block is ;The block sizes only need to match, not necessarily be the same.
- square array Reversible refers to existence such that ; The left inverse is the right inverse of a reversible square matrix. A rectangular matrix does not have this symmetry.
- Irreversible: the two columns are collinear, the product column cannot escape from this straight line, and the columns of the identity matrix cannot be made up; the more essential reason is , if Existence brings out , contradiction.
- Irreversible equivalence characterization: the existence of non-zero such that , that is, the column vectors are linearly related; It also shows that the determinant is zero.
- Gauss-Jordan inversion: write side by side , eliminate elements downward to create the upper triangle, and then upward to clear the above diagonal line to zero; the left half becomes The right half of the time is . Example Got .
- Principle: All elimination synthesis , by block multiplication , the left half gives , so , right half Naturally it is the inverse matrix.
keywords
| English | Chinese | One sentence explanation |
|---|---|---|
| matrix multiplication | Matrix multiplication | Do a dot product between rows and columns, requiring the number of columns of the left matrix to be equal to the number of rows of the right matrix |
| dot product | dot product | Multiply the corresponding components of two equal-length vectors and add them together to get a number. |
| inner dimension | inner dimension | The number of columns and The number of rows of , the two must be equal to be multiplied |
| column view | column view | Reading multiplication column by column, the product of each column is linear combination of columns |
| row view | row view | Reading multiplication row by row, the product of each row is linear combination of rows |
| outer product | outer product | Multiply one column by one row to get a complete matrix instead of a number |
| rank-one matrix | rank 1 matrix | Obtained by multiplying one column by one row, both row space and column space degenerate into a straight matrix |
| block multiplication | Block multiplication | Cut the matrix into blocks and multiply the blocks as numbers according to the same rules. |
| invertible | invertible | Multiply the existing matrix with the original matrix to get the identity matrix |
| non-singular | Not strange | Another name for reversible square matrix |
| singular | Strange | Irreversible, there is a non-zero vector that is sent to zero |
| inverse matrix | inverse matrix | with Multiply to get matrix, denoted as |
| identity matrix | identity matrix | The diagonal element is , a matrix with the remaining zeros, equivalent to numbers in multiplication |
| Gauss-Jordan elimination | Gauss-Jordan elimination | in Up elimination, convert the left half into , the right half is |
| augmented matrix | augmented matrix | The long matrix obtained by connecting the right end (can have multiple columns) to the right side of the coefficient matrix |
| elementary matrix | elementary matrix | The matrix corresponding to a single elimination, multiplying it by the left is equal to a row transformation |
| row space | row space | The set of all linear combinations of rows of a matrix |
| column space | column space | The set of all linear combinations of the columns of a matrix |
| linearly dependent | linearly dependent | There are coefficients that are not all zero so that the combination of vectors is zero |
Machine-assisted translation · Read Chinese original
