Matrix multiplication
Suppose we have a matrix and a vector that acts upon. We have written “” for the output vector given by letting act on .
Matrices act by sending vectors to other vectors. It is useful to consider another matrix that acts upon the output vector. For example, if , and if is a matrix that acts upon , we can write . (The colon in means “ is defined as .”)
Suppose we define , so that . Then we say that is the output of under a composition of actions of the matrices and . It turns out that if we start with two matrices and , the composition action (letting the matrices act consecutively) can itself be represented by a single matrix. (The composition of linear transformations is a linear transformation.) Let us find this matrix in the case when and are matrices.
Suppose the entries of and are given by
Now compute the action of followed by the action of on the vector :
Therefore, we define the product matrix by this formula:
With this definition and the above reasoning, we have that .
(Because of this equality, we can omit the parentheses and write simply , since the result is the same whether you act first by and then by or instead you first multiply the matrices and then act by .)
Just as for the formula for a matrix acting on a vector, we have multiple ways to interpret the formula for the matrix .
- Each entry of the product matrix is given by taking the dot product of a row of with a column of .
- Each column of the product matrix is given by letting act upon the corresponding column vector of . In other words, . (Recall that the action of upon has two interpretations of its own!)
- Each row of the product matrix is given by letting the entries in the corresponding row vector of provide the coefficients for a linear combination of the rows of .
The first of these interpretations is best for doing calculations, and the second is best for understanding abstract theory.
Bottom-Right Method for computing :

E.g.:

Max Born, Nobel Prize lecture:

Matrix multiplication (part 2)
Identity matrix
Notice that the diagonal matrix with ’s on the diagonal acts upon another vector or matrix by doing nothing:
This matrix is called the identity matrix, since it preserves the identity of whatever it acts upon. It is frequently written “”, regardless of the size of the matrix. So for any .
Sometimes is written more specifically as , where is the number of rows or columns. (Identity matrices always have the same number of rows and columns.)
Matrices acting on matrices
It is useful to think of matrices as acting upon other matrices by multiplying on the left. The effect is the same as the effect of acting on a vector, but it performs this (same) action on each column vector separately. The action is therefore the same across any given row.
Diagonal matrices
When two diagonal matrices are multiplied, the result is a diagonal matrix. The diagonal entries of the product are simply the products of the diagonal entries:
A consequence is that diagonal matrices commute with each other: when are both diagonal. (As seen with 3D rotations, frequently this is not true for matrix multiplication.)
Row-scale matrices
The diagonal matrices
have the effect of scaling rows (respectively) by the number , without changing other rows, when they are multiplied on a vector or a matrix on the left. These matrices are called row-scale matrices.
Permutation matrices
When two permutation matrices are multiplied, the result is a permutation matrix. For example:
Matrices acting on matrices (part 2)
Row-swap matrices
A permutation matrix acts upon another matrix (multiplying on the left) by permuting the rows of the matrix, in the same way that it would permute the rows of a vector:
The most important permutation type is one which simply swaps two rows and leaves the others unchanged. This type of matrix is called a row-swap matrix.
The row-swap action is performed by a permutation matrix which has ’s on the diagonal except for two rows. In these two rows, the ones from a diagonal matrix are swapped with each other.
Matrices acting on matrices (part 3)
Row-add matrices
A matrix that has ’s on the diagonal and the other entries ’s, except for a single additional entry , is called an elementary shear matrix, or a row-add matrix:
If the entry is in the row and column, this matrix acts by taking the row (of a matrix or vector that it’s acting upon) and adding it into the row with a coefficient:
Remember that when a matrix is multiplied on the left on a vector or a matrix, the top row of the matrix controls the top row of the output.
Matrix algebra
Matrix addition and scaling
Matrices can be added, subtracted, and multiplied by scalers, just like vectors. These operations are done componentwise:
In terms of the actions performed by these matrices, addition is like addition of functions: the action of a sum of matrices is to give the sum of the outputs under the actions of the separate matrices. For functions, this would be written . For matrices, we write , and similarly for subtraction, scalar multiples, and other variations on basic algebra operations.
Matrix distributivity
It is important to notice that matrix multiplication is compatible with matrix addition in the usual sense of distributivity:
One way to prove this formula is to show that it is true after both sides are applied to an arbitrary vector . (To complete the proof, let take the specific value of each standard basis vector in turn, and you find that column of the matrices on each side must agree.) To show the equality after multiplying both sides on an arbitrary , we need to check distributivity of matrix actions on vectors in general:
Matrix algebra (part 2)
Matrix division
For real numbers, division and multiplication are inverse processes, meaning that division “undoes” the action of multiplication, and vice versa.
Any number can divide another number provided it is not zero. For matrices, the situation is more complex, because “being zero” is more complex. Many matrices have non-zero entries, yet they “act as zero” upon certain other vectors. When this happens, the action cannot be “undone”, because you cannot divide by the zero action performed on those vectors.
Matrix algebra (part 3)
So, some matrices can be divisors. These are called invertible matrices. Others cannot, and these are called non-invertible matrices. A matrix is invertible when the inverse matrix exists.
When it exists, an inverse matrix acts by undoing multiplication by . Concretely, this means:
Notice in the second formula that the action of can be undone before even acts. (Ordinary division also works like this!) Another way to look at it is that acts by undoing the effect of . (Ordinary division: multiplication by undoes the effect of multiplying by .)
Recall the “identity matrix” which satisfies for any . So we can write the above formula using matrices:
Notice that we have to write both formulas because matrix multiplication is not commutative! (Ordinary division: and are equivalent because for any numbers.)
Inverse of matrices
There is a general formula for the inverse of any matrix that should be memorized:
Matrix algebra (part 4)
The inverse of is useful for finding a vector which is sent to a given vector by the action of a given matrix :
If we know and , and we want , this method will give us .
Matrix algebra (part 5)
Determinant of matrices
The determinant of a matrix , written , is a single number that is associated to the matrix.
For a matrix, the determinant is given by the formula in the divisor of the formula for :
We will learn many things about determinants. The important thing for now is that exists if and only if .
Optional: interpretation of determinant
Just for fun, here is a visual proof (by S. Golomb) that gives the area of the parallelogram spanned by the column vectors of , namely and :

Here is another visual for parallelograms from obtuse vectors:

Eigenvectors, eigenvalues
We saw that standard basis vectors are eigenvectors for diagonal matrices, and the diagonal entries are the eigenvalues. If has diagonal entries , then .
Now consider the problem of finding eigenvectors and eigenvalues for a non-diagonal matrix . This means finding a vector and a scalar such that .
Suppose we start with a hypothetical . Write for the matrix . So we wish to solve , which is equivalent to . Now write . So we wish to find such that .
Notice that if is invertible, then there is no solution. (The only solution would be and that is not allowed for an eigenvector.) The reason is that if exists, we can let it act upon both sides of the equation to obtain . Therefore, we only have a chance of solving this if is non-invertible. Recall from above that is non-invertible precisely when .
It turns out we can solve the equation if . Let us do this by hand for matrices.
Derivation that if then can be solved with
Let . Assume , which means or or . Write for the common ratio . Thus , and now we wish to solve the equation:
This means and . Dividing the latter by we arrive at the former, so we can take any that satisfy . Let us choose . You can now check directly that it works:
If , there must be a vector such that for some scalar
Proof: Define , and so
Suppose . By the formula for , this means . That is a quadratic equation in and could be rewritten as . By the quadratic formula, the solutions are . Write these two solutions as and .
So we have found and with and . In either case we can solve for a such that and a such that using the method in the box above.
Summary
- Matrices can be multiplied by each other. Express as a row of column vectors; then is the matrix which is the row of column vectors . In other words, is computed by letting act upon the columns of .
- Matrices acting on vectors satisfy , and acting on matrices they satisfy .
- The identity matrix has the property that and for any other matrix .
- Row-scale matrices act on a matrix (or vector) by scaling a chosen row. Row-swap matrices act by swapping two rows. Row-add matrices act by adding one row into another.
- An “invertible” matrix is one having an inverse , which has the property that . (Here is an matrix.) For a matrix, its inverse is given by a formula:
- The inverse matrix can be used to solve for in the equation , where and are both given and is sought.
- The determinant for the matrix (as above) is the number . The matrix is invertible if and only if .
- Given the matrix , an eigenvector is a vector () such that for some scalar called the eigenvalue corresponding to .
- We can find eigenvalues and eigenvectors by: setting and solving a quadratic equation to find , , then plugging these in for and writing and , and then manually solving for vectors and satisfying and . This is possible using the fact that one row of will be a multiple times the other row.