Return to the Purplemath home page


Return to the Lessons Index  | Do the Lessons in Order  |  Print-friendly page

Matrix Multiplication Defined (page 2 of 3)

Just as with adding matrices, the sizes of the matrices matter when we are multiplying. For matrix multiplication to work, the columns of the second matrix have to have the same number of entries as do the rows of the first matrix.

    AB =

    [[ 1  0  -2 ][ 0  3  -1 ]]  [[ 0  3 ][ -2  -1 ][ 0  4 ]]

If, using the above matrices, B had had only two rows, its columns would have been too short to multiply against the rows of A. Then "AB" would not have existed; the product would have been "undefined". Likewise, if B had had, say, four rows, or alternatively if A had had two or four columns, then AB would not have existed, because A and B would not have been the right sizes.

In other words, for AB to exist (that is, for the very process of matrix multiplication to be able to function sensibly), A must have the same number of columns as B has rows; looking at the matrices, the rows of A must be the same length as the columns of B.

You can use this fact to check quickly whether a given multiplication is defined. Write the product in terms of the matrix dimensions. In the case of the above problem, A is 23 and B is 32, so AB is (23)(32). The middle values match:


    (23)(32): the inner dimensions match, so the product is defined the multiplication is defined. By the way, you will recall that AB, the product matrix, was 22. You can also see this on the dimensions:

    (23)(32): the outer dimensions determine that the product will be 22

Using this, you can see that BA must be a different matrix from AB, because:

    (32)(23): the inner dimensions match; the outer dimensions indicate a 33 product

The product BA is defined (that is, we can do the multiplication), but the product, when the matrices are multiplied in this order, will be 33, not 22. In particular, matrix multiplication is not "commutative"; you cannot switch the order of the factors and expect to end up with the same result. (You should expect to see a "concept" question relating to this fact on your next test.)

  • Given the following matrices, find the product BA.
    • A = [[ 1  0  -2 ][ 0  3  -1 ]] ,  B = [[ 0  3 ][ -2  -1 ][ 0  4 ]]

    The multiplication works the same way as the previous problem, going across the rows and down the columns. I won't try drawing my hands again, but you can see the computations in the colors below:   Copyright Elizabeth Stapel 2003-2011 All Rights Reserved

      Demonstrates, using color, the process of matrix multiplication.

    Then the answer is:

      BA = [[ 0  9  3 ][ -2  -3  5 ][ 0  12  -4 ]]

Matrix multiplication is probably the first time that the Commutative Property has ever been an issue. Remember when they made a big deal, back in middle school or earlier, about how "ab = ba" or "56 = 65"? That "rule" probably seemed fairly stupid at the time, because you already knew that order didn't matter in multiplication. Introducing you to those rules back then was probably kind of pointless, since order didn't matter for anything you were multiplying then. Well, now the Law of Commutativity does matter, because order does matter for matrix multiplication. Always keep in mind that, for matrices, AB almost certainly does not equal BA.

<< Previous  Top  |  1 | 2 | 3  |  Return to Index  Next >>

Cite this article as:

Stapel, Elizabeth. "Matrix Multiplication Defined." Purplemath. Available from Accessed


The "Homework

Study Skills Survey

Tutoring from Purplemath
Find a local math tutor

   Copyright © 2021  Elizabeth Stapel   |   About   |   Terms of Use   |   Linking   |   Site Licensing


Contact Us