How To Multiply Matrices Quickly and Correctly in Six Easy Steps

Posted by Jesse on 9/26/18 8:11 PM

math-3

Step 0  Make Sure the product makes sense!

Say we’re given two matrices A and B, where

Screen Shot 2018-09-26 at 6.29.09 PM

and we’ve been asked to find the product AB. To see if AB makes sense, write down the sizes of the matrices in the positions you want to multiply them. In this case, we write

Screen Shot 2018-09-26 at 6.31.15 PM

To check that the product makes sense, simply check if the two numbers on the inside agree. If they do, the product can be taken, if they don’t agree, the product doesn’t make sense. For instance, even though the product AB makes sense, the product BA does not. Indeed, the inside numbers of

Screen Shot 2018-09-26 at 6.32.25 PMdon’t match up.

Step 1  If the product makes sense, find the dimensions of your answer

Again, we can make use of the technique of writing down the dimensions in order. Let’s take the same A and B from above. We write down

Screen Shot 2018-09-26 at 6.34.41 PM

The outside numbers, in order, give the dimensions of the product. Reading the outside numbers left to right, we get 1 × 3, which is the dimension of

Screen Shot 2018-09-26 at 7.27.01 PM

or the product AB. We’ll compute this ourselves in a minute! To recap,

• Write down the dimensions of the two matrices A and B. 

Screen Shot 2018-09-26 at 7.27.54 PM

• Check if the inside numbers agree.

Screen Shot 2018-09-26 at 7.28.27 PM

• If they agree, read the dimensions of the answer off the outside numbers

Screen Shot 2018-09-26 at 7.29.30 PM

Special Case – Multiplying a row vector by a matrix

Step 2 – Write out the rows of the matrix on the right

In our example, we would write

Screen Shot 2018-09-26 at 7.30.49 PM

Make sure you write them in the order they appeared!

Step 3 – Multiplication

Multiply the first row of B by the first entry of A, the second row by the second entry, and so on.

Screen Shot 2018-09-26 at 7.32.26 PMwhich equals

Screen Shot 2018-09-26 at 7.34.39 PM

Step 4 – Addition

Add up the rows you got in step 3 to get your answer

Screen Shot 2018-09-26 at 7.40.32 PM

General Case -- Two Matrices

Now let's say we want to multiply a new matrix A' by the same matrix B, where

Screen Shot 2018-09-26 at 7.43.01 PM

Doing steps 0 and 1, we see

Screen Shot 2018-09-26 at 7.43.47 PMthe product makes sense and the output should be 3 X 3.  We'll find the output row by row.

Step 5 – Break both matrices into rows

In our example, we would write

Screen Shot 2018-09-26 at 7.48.59 PM
Step 6 – Repeat Steps 1-4 for each row of A'

To find the first row of our 3x3 answer, compute the product Screen Shot 2018-09-26 at 7.53.09 PM, the first row of A' times B.

Screen Shot 2018-09-26 at 7.54.46 PM

which is the problem we just solved. So, the first row of our answer is

Screen Shot 2018-09-26 at 7.56.45 PMTo find the second row of our 3x3 answer, compute Screen Shot 2018-09-26 at 7.57.57 PM, which I'll leave the reader to verify is 

Screen Shot 2018-09-26 at 7.59.12 PM

Finally, the third row of our 3x3 answer is Screen Shot 2018-09-26 at 8.00.42 PM, so we multiply

Screen Shot 2018-09-26 at 8.01.20 PMand then add

Screen Shot 2018-09-26 at 8.01.56 PM

We've found the three rows of our solution matrix and we conclude

Screen Shot 2018-09-26 at 8.04.23 PM

The common way of stating this perspective is that in the multiplication of AB, A acts on B by row operations. We view B as a collection of row vectors and the rows of A have us take linear combinations of the row vectors in B to form the rows of the solution. There is an equivalent perspective of column operations. Each has their place. Stay tuned for a follow-up post about how each of these perspectives comes into play when solving the matrix equation Ax = b.

Are you interested in connecting with a mathematics tutor like Jesse?

Contact Us!

Tags: math