Matrix multiplication doesn’t work like that

The Aperiodical 2024-08-08

Earlier this week I posted a matrix multiplication worksheet on Mastodon.

Matrix multiplication practice worksheet, Peter Rowlett, 5 August 2024Twenty questions, each of which is one two by two matrix multiplied by another.Question 1first row: 4 8second row: 2 3timesfirst row: 8 8second row: 2 7Question 2first row: 3 4second row: 6 3timesfirst row: 9 2second row: 3 9Question 3first row: 2 3second row: 4 3timesfirst row: 8 3second row: 4 9Question 4first row: 7 5second row: 8 6timesfirst row: 5 5second row: 8 4Question 5first row: 5 2second row: 9 3timesfirst row: 8 2second row: 9 6Question 6first row: 5 9second row: 2 3timesfirst row: 8 9second row: 2 6Question 7first row: 2 2second row: 8 7timesfirst row: 4 2second row: 8 9Question 8first row: 7 2second row: 8 2timesfirst row: 9 2second row: 8 4Question 9first row: 4 5second row: 5 6timesfirst row: 5 5second row: 5 7Question 10first row: 8 5second row: 9 6timesfirst row: 5 5second row: 9 3Question 11first row: 5 6second row: 3 3timesfirst row: 8 6second row: 3 6Question 12first row: 2 3second row: 3 5timesfirst row: 2 6second row: 6 8Question 13first row: 9 9second row: 2 2timesfirst row: 9 9second row: 2 2Question 14first row: 3 2second row: 7 3timesfirst row: 8 2second row: 7 8Question 15first row: 4 4second row: 2 2timesfirst row: 8 8second row: 4 4

If you do some of these, you might spot what’s funny about them. For example.

\[ \Large \begin{bmatrix} \color{navy}{4} & \color{navy}{8}\\ \color{navy}{2} & \color{navy}{3} \end{bmatrix} \begin{bmatrix} \color{cyan}{8} & \color{cyan}{8}\\ \color{cyan}{2} & \color{cyan}{7} \end{bmatrix} = \begin{bmatrix} \color{navy}{4}\color{cyan}{8} & \color{navy}{8}\color{cyan}{8}\\ \color{navy}{2}\color{cyan}{2} & \color{navy}{3}\color{cyan}{7} \end{bmatrix} \]

That is, the answer to each question can be made by treating the element in the first matrix as the first digit and the corresponding element in the second matrix as the second digit in the answer element. This is not how matrix multiplication works, and ought to be funny if I hadn’t totally over-explained the joke!

I saw one of these in a meme that Katie posted in the Finite Group chat and it got me thinking about how these work.

If we set up the matrices like this

\[ \begin{bmatrix} a & b\\ c & d \end{bmatrix} \begin{bmatrix} e & f\\ g & h \end{bmatrix} = \begin{bmatrix} 10a+e & 10b+f\\ 10c+g & 10d+h \end{bmatrix} \]

Then we establish four equations with eight unknowns.

\[ \begin{align*} ae + bg &= 10a+e\\ af+bh &= 10b+f\\ ce+dg &= 10c+g\\ cf+dh &= 10d+h \end{align*}\]

Since there are more unknowns than equations, these don’t have a single solution. What I wanted was to find integer solutions with all values single-digits. I wrote some Python code to find these. I removed some that look overly symmetrical – either the rows of the matrix are identical, or the same matrix is repeated. This left 73 items.

From these 73 items, I wrote a second Python script that picks 20 of them at random and builds these into a LaTeX worksheet. For the Mastodon post I reformatted this into the shape and size that I thought would display better on social media, and added in one of the squared matrices for an extra hint something weird is up, hoping people might notice this isn’t just a boring post about matrix multiplication practice!

You can view these scripts and associated files on GitHub.