You're reading: Travels in a Mathematical World

Matrix multiplication doesn’t work like that

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

Matrix multiplication practice worksheet, Peter Rowlett, 5 August 2024

Twenty questions, each of which is one two by two matrix multiplied by another.

Question 1
first row: 4 8
second row: 2 3
times
first row: 8 8
second row: 2 7

Question 2
first row: 3 4
second row: 6 3
times
first row: 9 2
second row: 3 9

Question 3
first row: 2 3
second row: 4 3
times
first row: 8 3
second row: 4 9

Question 4
first row: 7 5
second row: 8 6
times
first row: 5 5
second row: 8 4

Question 5
first row: 5 2
second row: 9 3
times
first row: 8 2
second row: 9 6

Question 6
first row: 5 9
second row: 2 3
times
first row: 8 9
second row: 2 6

Question 7
first row: 2 2
second row: 8 7
times
first row: 4 2
second row: 8 9

Question 8
first row: 7 2
second row: 8 2
times
first row: 9 2
second row: 8 4

Question 9
first row: 4 5
second row: 5 6
times
first row: 5 5
second row: 5 7

Question 10
first row: 8 5
second row: 9 6
times
first row: 5 5
second row: 9 3

Question 11
first row: 5 6
second row: 3 3
times
first row: 8 6
second row: 3 6

Question 12
first row: 2 3
second row: 3 5
times
first row: 2 6
second row: 6 8

Question 13
first row: 9 9
second row: 2 2
times
first row: 9 9
second row: 2 2

Question 14
first row: 3 2
second row: 7 3
times
first row: 8 2
second row: 7 8

Question 15
first row: 4 4
second row: 2 2
times
first row: 8 8
second 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.

(will not be published)

$\LaTeX$: You can use LaTeX in your comments. e.g. $ e^{\pi i} $ for inline maths; \[ e^{\pi i} \] for display-mode (on its own line) maths.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>