We are going to define a way to multiply certain matrices together.After that we will see several different ways to understand thisdefinition, and we will see how the definition arises as a kind offunction composition.
Definition 3.2.1.
Let be a matrix and be an matrix. Then the matrix product is defined to bethe matrix whose entry is
(3.1) |
Before we even start thinking about this definition we record one keypoint about it. There are two s in the definition above: one is thenumber of columns of and the other is the number of rows of .These really must be the same. We only define the matrixproduct when the number of columns of equals the number of rowsof . The reason for this will become clear when we interpret matrixmultiplication in terms of function composition later.
Example 3.2.1.
The entry of a matrix product is obtained by putting and in the formula (3.1).If is and is thenthis is
You can see that we are multiplying each entry in the first row of by the corresponding entry in the second column of andadding up the results. Ingeneral, the entry of is obtained by multiplying theentries of row of with the entries of column of andadding them up.
Example 3.2.2.
Let’s look at an abstract example first. Let
The number of columns of equals the number of rows of , so thematrix product is defined, and since (in the notation of thedefinition) , the size of is which is . From the formula, we get
Example 3.2.3.
Making the previous example concrete, if
then is , is , so thematrix product is defined and will be another matrix:
Matrix multiplication is so important that it is helpful to have severaldifferent ways of looking at it. The formula above is useful when wewant to prove general properties of matrix multiplication, but we canget further insight when we examine the definition carefully fromdifferent points of view.
3.2.1 Matrix multiplication happens columnwise
A very important special case of matrix multiplication is when wemultiply a matrix by an column vector.Let
Then we have
Another way to write the result of this matrix multiplication is
showing that the result is obtained by adding up scalar multiples of thecolumns of . If we write for the th column of then the expression
where we add up scalar multiples of the s, is called alinear combination of , , and. Linear combinations are a fundamental idea and we willreturn to them again and again in the rest of MATH0005.
This result is true whenever we multiply an matrix and an column vector, not just in the example above.
Proposition 3.2.1.
Let be an matrix and an column vector with entries . If are the columns of then
Proof.
From the matrix multiplication formula(3.1) we get
The column vector whose entries are , , … is exactly the th column of , so this completes theproof.∎
Definition 3.2.2.
For a fixed , the standard basis vectors are the vectors
The vector with a 1 in position and zeroeselsewhere is called the th standard basis vector.
For example, if then there are three standard basis vectors
The special case of the proposition above when we multiply a matrix by astandard basis vector is often useful, so we’ll record it here.
Corollary 3.2.2.
Let be a matrix and the thstandard basis vector of height . Then is equalto the th column of .
Proof.
According to Proposition 3.2.1 we have where is the thentry of and is the th column of. The entries of are all zero except for the thwhich is 1, so
Example 3.2.4.
Let . You should verify that equals the first column of and equals the second column of .
Proposition 3.2.1 is important it lets us show thatwhen we do any matrix multiplication , we can do the multiplicationcolumn-by-column.
Theorem 3.2.3.
Let be an matrix and an matrix withcolumns . Then
The notation means that the first column of is equal to what you getby multiplying into the first column of , the second column of is what you get by multiplying into the second column of ,and so on. That’s what it means to say that matrix multiplication workscolumnwise.
Proof.
From the matrix multiplication formula(3.1) the th column of hasentries
(3.2) |
The entries for are exactly the entriesin column of , so (3.2) is as claimed.∎
Corollary 3.2.4.
Every column of is a linear combination of the columns of .
Proof.
Theorem 3.2.3 tells us that each column of equals for certain vectors , andProposition 3.2.1 tells us that any such vector is a linear combination of the columns of .∎
Example 3.2.5.
Let’s look at how the Proposition and the Theorem in this sectionapply to Example 3.2.3, when was and the columns of are and .
You can check that
and that these are the columns of we computed before.
3.2.2 Matrix multiplication happens rowwise
There are analogous results when we multiply an row vectorand an matrix.
Proposition 3.2.5.
Let be a row vector with entries and let be an matrix with rows . Then .
Proof.
From the matrix multiplication formula(3.1) we get
In particular, is a linear combination of the rows of.
Theorem 3.2.6.
Let be a matrix with rows and let be an matrix. Then
The notation is supposed to indicate that the first row of is equalto , the second row is equal to , and soon.
Proof.
From the matrix multiplication formula(3.1), the th row of hasentries
(3.4) | |||
(3.6) |
Row of is , so agrees with (3.6)by Proposition 3.2.5.∎
The theorem combined with the proposition before it show that ingeneral the rows of are always linear combinations of the rows of.
Example 3.2.6.
Returning to the example where
the rows of are and and the rows of are and . We have
and these are the rows of the matrix product .
Example 3.2.7.
When the result of a matrix multiplication is a matrix wewill usually just think of it as a number. This is like a dot product,if you’ve seen those before.
Example 3.2.8.
Let , a matrix, and , a column vector. The number of columns of and the number of rows of are equal, so we can compute.
Example 3.2.9.
Let
is , is , so the matrixproduct is defined, and is a matrix.The columns of are , , and . The product is therefore
Example 3.2.10.
Let
Then is , is , so thematrix product is defined and will be another matrix:
3.2.3 Matrix multiplication motivation
In this section we’ll try to answer two questions: where does this strange-looking notion of matrix multiplication comefrom? Why can we only multiply and if the number of columns of equals the number of rows of ?
Definition 3.2.3.
Let be a matrix. Then is the function defined by
Notice that this definition really does make sense. If then it is an column vector, so the matrixproduct exists and has size , so it is an element of.
Now suppose we have an matrix and a matrix, so that and . Can we form the composition ? The answer is no, unless , that is, unless the number ofcolumns of equals the number of rows of . So let’s assume that so that is and the composition
makes sense. What can we say about it?
Theorem 3.2.7.
If is and is then .
You will prove this on a problem sheet.
The theorem shows that matrix multiplication is related to compositionof functions. That’s useful because it suggests something: we know thatfunction composition is always associative, so can we use that to showmatrix multiplication is associative too? That is, if the products and make sense, is equal to ? This is not exactlyobvious if you just write down the horrible formulas for the , entries of both matrices. If we believe the theorem though it’s easy: weknow
because function composition is associative, and so
If then (for example, you could evaluate at thestandard basis vector to see that the th column of equals the th column of for any ), so we get .
Since we didn’t prove the theorem here, we’ll prove the associativityresult in a more pedestrian way in the next section.