So I'm writing an exam about matrices in a few weeks time, and I'd like to know if anybody has any tips about multiplying matrices.

  • 1
    $\begingroup$ Your title is somewhat suggestive but your body question is quite vague. What do you hope to include in terms of "memorisation"? And do you mean that term in the sense of computer science dynamic programming? $\endgroup$ Apr 15, 2015 at 19:12
  • $\begingroup$ Are you having trouble remembering the definition of matrix multiplication? $\endgroup$
    – GFauxPas
    Apr 15, 2015 at 19:13
  • $\begingroup$ @GFauxPas I have an extensive training but I have no recollection of how "memorisation" canonically and unambiguously relates to matrix multiplication. Perhaps you can enlighten me. $\endgroup$ Apr 15, 2015 at 19:15
  • 1
    $\begingroup$ @user2566092 I'm not sure what you're saying. You can memorize the chain rule, phone numbers, and your wedding anniversary. I'm thinking the OP wants a mnemonic. $\endgroup$
    – GFauxPas
    Apr 15, 2015 at 19:18
  • 1
    $\begingroup$ Like remembering how to multiply two matrices which are both greater than or equal to 2x2. Also, the rules about which matrices can be multiplied together, but I guess if I know how to multiply them, it would come naturally. $\endgroup$ Apr 15, 2015 at 19:29

1 Answer 1


There are a couple of different ways to think about matrix multiplication. Here is what I usually do.

To multiply two matrices $A$ and $B$, you should see $A$ as a stack of rows and $B$ as a sequence of columns. I.e. think in the following way:

$$ A = \begin{pmatrix} a_1 \\ a_2 \\ \vdots \\a_n \end{pmatrix} ~~~~ B = \begin{pmatrix} b_1 & b_2 & \cdots & b_k \end{pmatrix} $$

Note that $k$ can be different from $n$, but the $a$ and $b$-vectors need to have the same length for the multiplication to be valid.

Now you only have to remember how to do a dot product since your matrix product will be: $$AB = \begin{pmatrix} a_1 \cdot b_1 & a_1 \cdot b_2 & \cdots & a_1 \cdot b_k \\ a_2 \cdot b_1 & a_2 \cdot b_2 & \cdots & a_2 \cdot b_k \\ \vdots & \vdots & \vdots & \vdots \\ a_n \cdot b_1 & a_n \cdot b_2 & \cdots & a_n \cdot b_k \end{pmatrix} $$ and the rule to remember is that the element at row $i$ and column $j$ will be the dot product of $a_i$ and $b_j$. I usually then calculate $AB$ row by row, keeping the $a$-vector fixed and changing the $b$-vector as I progress over the column. Then I pick the next $a$, calculate the dot product with each $b$ over the columns, etc.

An example. Let $$A = \begin{pmatrix} 1 & 2 \\ -1 & 1 \end{pmatrix} ~~~~ B = \begin{pmatrix} 2 & 3 & -1 \\ 1 & 1 & 1 \end{pmatrix} $$ so with the notation above (I don't suggest you do this when doing the calculations, this is just for clarity): $$\begin{align} a_1 &= \begin{pmatrix} 1 & 2 \end{pmatrix} \\ a_2 &= \begin{pmatrix} -1 & 1 \end{pmatrix} \end{align}$$ and $$\begin{align} b_1 &= \begin{pmatrix} 2 \\ 1 \end{pmatrix} \\ b_2 &= \begin{pmatrix} 3 \\ 1 \end{pmatrix} \\ b_3 &= \begin{pmatrix} -1 \\ 1 \end{pmatrix} \end{align}$$

So, the first row of $AB$ will be (note that we only use $a_1$ here): $$\begin{align} (AB)_{1,1} &= a_1 \cdot b_1 = 1 \cdot 2 + 2 \cdot 1 = 4 \\ (AB)_{1,2} &= a_1 \cdot b_2 = 1 \cdot 3 + 2 \cdot 1 = 5 \\ (AB)_{1,3} &= a_1 \cdot b_3 = 1 \cdot (-1) + 2 \cdot 1 = 1 \end{align}$$

Then we move on to the second row (here we only use $a_2$): $$\begin{align} (AB)_{2,1} &= a_2 \cdot b_1 = -1 \\ (AB)_{2,2} &= a_2 \cdot b_2 = -2 \\ (AB)_{2,3} &= a_2 \cdot b_3 = 2 \end{align}$$

I usually do these dot products in my head as I go along. As a more physical remainder of how to do things, I usually trace over the $a$-row I am using with the pencil (moving the pencil horizontally), then trace over the $b$-column I am using (moving the pencil vertically).

I like this method because you only need to keep one accumulating value in your head at a time. When you're done with a dot product, write it down and move to the next.

Also, if you think you have calculated the element at row $i$ and column $j$ of $AB$ wrong, it's easy to think in reverse: $(AB)_{i,j}$ is just the dot product of row $a_i$ and column $b_j$. Calculate it again and check the result.

  • $\begingroup$ Thanks so much, this is so much more than I hoped for when asking the question :) $\endgroup$ Apr 15, 2015 at 19:45
  • $\begingroup$ Great answer! I stumbled on this looking for info on people who can do matrix multiplication in their heads but happy to have found such a well crafted answer $\endgroup$ Feb 22, 2017 at 21:37
  • $\begingroup$ @R.ShaneDavis, thank you, nice to hear! $\endgroup$
    – Calle
    Feb 22, 2017 at 22:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .