Section MM Matrix Multiplication
We know how to add vectors and how to multiply them by scalars. Together, these operations give us the possibility of making linear combinations. Similarly, we know how to add matrices and how to multiply matrices by scalars. In this section we mix all these ideas together and produce an operation known as “matrix multiplication.” This will lead to some results that are both surprising and central. We begin with a definition of how to multiply a vector by a matrix.
Subsection MVP Matrix-Vector Product
We have repeatedly seen the importance of forming linear combinations of the columns of a matrix. As one example of this, the oft-used Theorem SLSLC, said that every solution to a system of linear equations gives rise to a linear combination of the column vectors of the coefficient matrix that equals the vector of constants. This theorem, and others, motivate the following central definition.
Definition MVP Matrix-Vector Product
Suppose $A$ is an $m\times n$ matrix with columns $\vectorlist{A}{n}$ and $\vect{u}$ is a vector of size $n$. Then the matrix-vector product of $A$ with $\vect{u}$ is the linear combination \begin{equation*} A\vect{u}= \vectorentry{\vect{u}}{1}\vect{A}_1+ \vectorentry{\vect{u}}{2}\vect{A}_2+ \vectorentry{\vect{u}}{3}\vect{A}_3+ \cdots+ \vectorentry{\vect{u}}{n}\vect{A}_n \end{equation*}
So, the matrix-vector product is yet another version of “multiplication,” at least in the sense that we have yet again overloaded juxtaposition of two symbols as our notation. Remember your objects, an $m\times n$ matrix times a vector of size $n$ will create a vector of size $m$. So if $A$ is rectangular, then the size of the vector changes. With all the linear combinations we have performed so far, this computation should now seem second nature.
Example MTV A matrix times a vector
We can now represent systems of linear equations compactly with a matrix-vector product (Definition MVP) and column vector equality (Definition CVE). This finally yields a very popular alternative to our unconventional $\linearsystem{A}{\vect{b}}$ notation.
Theorem SLEMM Systems of Linear Equations as Matrix Multiplication
The set of solutions to the linear system $\linearsystem{A}{\vect{b}}$ equals the set of solutions for $\vect{x}$ in the vector equation $A\vect{x}=\vect{b}$.
Example MNSLE Matrix notation for systems of linear equations
The matrix-vector product is a very natural computation. We have motivated it by its connections with systems of equations, but here is another example.
Example MBC Money's best cities
Later (much later) we will need the following theorem, which is really a technical lemma (see Proof Technique LC). Since we are in a position to prove it now, we will. But you can safely skip it for the moment, if you promise to come back later to study the proof when the theorem is employed. At that point you will also be able to understand the comments in the paragraph following the proof.
Theorem EMMVP Equal Matrices and Matrix-Vector Products
Suppose that $A$ and $B$ are $m\times n$ matrices such that $A\vect{x}=B\vect{x}$ for every $\vect{x}\in\complex{n}$. Then $A=B$.
You might notice from studying the proof that the hypotheses of this theorem could be “weakened” (i.e. made less restrictive). We need only suppose the equality of the matrix-vector products for just the standard unit vectors (Definition SUV) or any other spanning set (Definition SSVS) of $\complex{n}$ (Exercise LISS.T40). However, in practice, when we apply this theorem the stronger hypothesis will be in effect so this version of the theorem will suffice for our purposes. (If we changed the statement of the theorem to have the less restrictive hypothesis, then we would call the theorem “stronger.”)
Sage MVP Matrix-Vector Product
Subsection MM Matrix Multiplication
We now define how to multiply two matrices together. Stop for a minute and think about how you might define this new operation.
Many books would present this definition much earlier in the course. However, we have taken great care to delay it as long as possible and to present as many ideas as practical based mostly on the notion of linear combinations. Towards the conclusion of the course, or when you perhaps take a second course in linear algebra, you may be in a position to appreciate the reasons for this. For now, understand that matrix multiplication is a central definition and perhaps you will appreciate its importance more by having saved it for later.
Definition MM Matrix Multiplication
Suppose $A$ is an $m\times n$ matrix and $\vectorlist{B}{p}$ are the columns of an $n\times p$ matrix $B$. Then the matrix product of $A$ with $B$ is the $m\times p$ matrix where column $i$ is the matrix-vector product $A\vect{B}_i$. Symbolically, \begin{equation*} AB=A\matrixcolumns{B}{p}=\left[A\vect{B}_1|A\vect{B}_2|A\vect{B}_3|\ldots|A\vect{B}_p\right]. \end{equation*}
Example PTM Product of two matrices
Is this the definition of matrix multiplication you expected? Perhaps our previous operations for matrices caused you to think that we might multiply two matrices of the same size, entry-by-entry? Notice that our current definition uses matrices of different sizes (though the number of columns in the first must equal the number of rows in the second), and the result is of a third size. Notice too in the previous example that we cannot even consider the product $BA$, since the sizes of the two matrices in this order are not right.
But it gets weirder than that. Many of your old ideas about “multiplication” will not apply to matrix multiplication, but some still will. So make no assumptions, and do not do anything until you have a theorem that says you can. Even if the sizes are right, matrix multiplication is not commutative — order matters.
Example MMNC Matrix multiplication is not commutative
Subsection MMEE Matrix Multiplication, Entry-by-Entry
While certain “natural” properties of multiplication do not hold, many more do. In the next subsection, we will state and prove the relevant theorems. But first, we need a theorem that provides an alternate means of multiplying two matrices. In many texts, this would be given as the definition of matrix multiplication. We prefer to turn it around and have the following formula as a consequence of our definition. It will prove useful for proofs of matrix equality, where we need to examine products of matrices, entry-by-entry.
Theorem EMP Entries of Matrix Products
Suppose $A$ is an $m\times n$ matrix and $B$ is an $n\times p$ matrix. Then for $1\leq i\leq m$, $1\leq j\leq p$, the individual entries of $AB$ are given by \begin{align*} \matrixentry{AB}{ij} &= \matrixentry{A}{i1}\matrixentry{B}{1j}+ \matrixentry{A}{i2}\matrixentry{B}{2j}+ \matrixentry{A}{i3}\matrixentry{B}{3j}+ \cdots+ \matrixentry{A}{in}\matrixentry{B}{nj}\\ &= \sum_{k=1}^{n}\matrixentry{A}{ik}\matrixentry{B}{kj} \end{align*}
Example PTMEE Product of two matrices, entry-by-entry
Theorem EMP is the way many people compute matrix products by hand. It will also be very useful for the theorems we are going to prove shortly. However, the definition (Definition MM) is frequently the most useful for its connections with deeper ideas like the null space and the upcoming column space.
Sage MM Matrix Multiplication
Subsection PMM Properties of Matrix Multiplication
In this subsection, we collect properties of matrix multiplication and its interaction with the zero matrix (Definition ZM), the identity matrix (Definition IM), matrix addition (Definition MA), scalar matrix multiplication (Definition MSM), the inner product (Definition IP), conjugation (Theorem MMCC), and the transpose (Definition TM). Whew! Here we go. These are great proofs to practice with, so try to concoct the proofs before reading them, they will get progressively more complicated as we go.
Theorem MMZM Matrix Multiplication and the Zero Matrix
Suppose $A$ is an $m\times n$ matrix. Then
- $A\zeromatrix_{n\times p}=\zeromatrix_{m\times p}$
- $\zeromatrix_{p\times m}A=\zeromatrix_{p\times n}$
Theorem MMIM Matrix Multiplication and Identity Matrix
Suppose $A$ is an $m\times n$ matrix. Then
- $AI_n=A$
- $I_mA=A$
It is this theorem that gives the identity matrix its name. It is a matrix that behaves with matrix multiplication like the scalar 1 does with scalar multiplication. To multiply by the identity matrix is to have no effect on the other matrix.
Theorem MMDAA Matrix Multiplication Distributes Across Addition
Suppose $A$ is an $m\times n$ matrix and $B$ and $C$ are $n\times p$ matrices and $D$ is a $p\times s$ matrix. Then
- $A(B+C)=AB+AC$
- $(B+C)D=BD+CD$
Theorem MMSMM Matrix Multiplication and Scalar Matrix Multiplication
Suppose $A$ is an $m\times n$ matrix and $B$ is an $n\times p$ matrix. Let $\alpha$ be a scalar. Then $\alpha(AB)=(\alpha A)B=A(\alpha B)$.
Theorem MMA Matrix Multiplication is Associative
Suppose $A$ is an $m\times n$ matrix, $B$ is an $n\times p$ matrix and $D$ is a $p\times s$ matrix. Then $A(BD)=(AB)D$.
Since Theorem MMA says matrix multipication is associative, it means we do not have to be careful about the order in which we perform matrix multiplication, nor how we parenthesize an expression with just several matrices multiplied togther. So this is where we draw the line on explaining every last detail in a proof. We will frequently add, remove, or rearrange parentheses with no comment. Indeed, I only see about a dozen places where Theorem MMA is cited in a proof. You could try to count how many times we avoid making a reference to this theorem.
The statement of our next theorem is technically inaccurate. If we upgrade the vectors $\vect{u},\,\vect{v}$ to matrices with a single column, then the expression $\transpose{\conjugate{\vect{u}}}\vect{v}$ is a $1\times 1$ matrix, though we will treat this small matrix as if it was simply the scalar quantity in its lone entry. When we apply Theorem MMIP there should not be any confusion. Notice that if we treat a column vector as a matrix with a single column, then we can also construct the adjoint of a vector, though we will not make this a common practice.
Theorem MMIP Matrix Multiplication and Inner Products
If we consider the vectors $\vect{u},\,\vect{v}\in\complex{m}$ as $m\times 1$ matrices then \begin{align*} \innerproduct{\vect{u}}{\vect{v}} &=\transpose{\conjugate{\vect{u}}}\vect{v} =\adjoint{\vect{u}}\vect{v} \end{align*}
Theorem MMCC Matrix Multiplication and Complex Conjugation
Suppose $A$ is an $m\times n$ matrix and $B$ is an $n\times p$ matrix. Then $\conjugate{AB}=\conjugate{A}\,\conjugate{B}$.
Another theorem in this style, and it is a good one. If you have been practicing with the previous proofs you should be able to do this one yourself.
Theorem MMT Matrix Multiplication and Transposes
Suppose $A$ is an $m\times n$ matrix and $B$ is an $n\times p$ matrix. Then $\transpose{(AB)}=\transpose{B}\transpose{A}$.
This theorem seems odd at first glance, since we have to switch the order of $A$ and $B$. But if we simply consider the sizes of the matrices involved, we can see that the switch is necessary for this reason alone. That the individual entries of the products then come along to be equal is a bonus.
As the adjoint of a matrix is a composition of a conjugate and a transpose, its interaction with matrix multiplication is similar to that of a transpose. Here is the last of our long list of basic properties of matrix multiplication.
Theorem MMAD Matrix Multiplication and Adjoints
Suppose $A$ is an $m\times n$ matrix and $B$ is an $n\times p$ matrix. Then $\adjoint{(AB)}=\adjoint{B}\adjoint{A}$.
Notice how none of these proofs above relied on writing out huge general matrices with lots of ellipses (“…”) and trying to formulate the equalities a whole matrix at a time. This messy business is a “proof technique” to be avoided at all costs. Notice too how the proof of Theorem MMAD does not use an entry-by-entry approach, but simply builds on previous results about matrix multiplication's interaction with conjugation and transposes.
These theorems, along with Theorem VSPM and the other results in Section MO, give you the “rules” for how matrices interact with the various operations we have defined on matrices (addition, scalar multiplication, matrix multiplication, conjugation, transposes and adjoints). Use them and use them often. But do not try to do anything with a matrix that you do not have a rule for. Together, we would informally call all these operations, and the attendant theorems, “the algebra of matrices.” Notice, too, that every column vector is just a $n\times 1$ matrix, so these theorems apply to column vectors also. Finally, these results, taken as a whole, may make us feel that the definition of matrix multiplication is not so unnatural.
Sage PMM Properties of Matrix Multiplication
Subsection HM Hermitian Matrices
The adjoint of a matrix has a basic property when employed in a matrix-vector product as part of an inner product. At this point, you could even use the following result as a motivation for the definition of an adjoint.
Theorem AIP Adjoint and Inner Product
Suppose that $A$ is an $m\times n$ matrix and $\vect{x}\in\complex{n}$, $\vect{y}\in\complex{m}$. Then $\innerproduct{A\vect{x}}{\vect{y}}=\innerproduct{\vect{x}}{\adjoint{A}\vect{y}}$.
Sometimes a matrix is equal to its adjoint (Definition A), and these matrices have interesting properties. One of the most common situations where this occurs is when a matrix has only real number entries. Then we are simply talking about symmetric matrices (Definition SYM), so you can view this as a generalization of a symmetric matrix.
Definition HM Hermitian Matrix
The square matrix $A$ is Hermitian (or self-adjoint) if $A=\adjoint{A}$.
Again, the set of real matrices that are Hermitian is exactly the set of symmetric matrices. In Section PEE we will uncover some amazing properties of Hermitian matrices, so when you get there, run back here to remind yourself of this definition. Further properties will also appear in Section OD. Right now we prove a fundamental result about Hermitian matrices, matrix vector products and inner products. As a characterization, this could be employed as a definition of a Hermitian matrix and some authors take this approach.
Theorem HMIP Hermitian Matrices and Inner Products
Suppose that $A$ is a square matrix of size $n$. Then $A$ is Hermitian if and only if $\innerproduct{A\vect{x}}{\vect{y}}=\innerproduct{\vect{x}}{A\vect{y}}$ for all $\vect{x},\,\vect{y}\in\complex{n}$.
So, informally, Hermitian matrices are those that can be tossed around from one side of an inner product to the other with reckless abandon. We will see later what this buys us.