Matrix Multiplication

A strategy that makes sense! No "magic" tricks to memorize, just a way to disassemble the factor matrices, calculate partial products, and reassemble the final product matrix.

Matrices are rectangular arrangements of numbers in rows and columns.  The “numbers” might be variables.  (They might also be other things that act like numbers, but that’s outside the scope of this article — however, the procedure here will work with anything that can be added and multiplied.)

The product of two matrices — let’s call them A, with dimensions mxn (m rows and n columns), and B, with dimensions nxp (n rows and p columns) — can be complicated to calculate.  Each number in it is a sum of products of entries from a row of A and a column of B.  People have come up with various ways of calculating the product for each cell, often involving using their fingers to keep track of where in the matrix they are, moving “one down and one over” to get the next numbers to multiply while keeping track of the total of partial products.  I never liked this way; it seemed too much like an arbitrary magic trick that just happened to line up with an equally arbitrary rule.

Then I found a method in which I could see what was going on.  Here’s how that method goes.

Let’s multiply a 2×3 and a 3×4 matrix.  Note that we expect the product to have dimensions mxp, or 2×4.

My first step will be to partition the first matrix into its three column vectors, and the second into its three row vectors.  (If you are not clear on what a column vector or row vector is, study the example and notice how the matrices are split.  There are more details about things that can be done with column and row vectors, but the way of splitting the matrix is all you need for matrix multiplication.)

Then I will set up the row vectors and column vectors in pairs, based on their order of appearance in the matrices, and take the product of each pair of a row and column vector.  (The product of a row vector and a column vector is the case in which it’s easy to see why the matrix multiplication definition makes sense: each entry in the product matrix is the product of a number from each of its factor vectors.)

Finally, I will take the sum of the three matrices that are the product of a column and a row.  You can think of this as re-assembling the product from the partial products that came from the partitions, especially if you like alliteration.  (Remember that matrices are added “componentwise,” meaning that the numbers in the same position get added together and their sum put in that position on the sum matrix.  For example, in the upper-left corners, 7+24+45=76.)

This method uses more paper than using your fingers to keep track and adding mentally, because each step is recorded.  If conserving paper is a concern for you, you can use an easily-erasable surface such as a whiteboard for the steps in the middle.  The advantage of this method is that it’s easy to remember how to do it, and each step seems at least somewhat reasonable from the step before.  Also, if you make a small mistake, it is easier to find and correct in this method.

Of course people can use any strategy they prefer for multiplying matrices, including using a computer algebra system like SAGE if the situation allows them to use a computer.  However, I believe this method is the preferable method with which to learn and teach matrix multiplication, because other methods, if wanted, can then be taught as shortcuts to a method that makes sense

Liked it
No Responses to “Matrix Multiplication”
Post Comment
comments powered by Disqus