TITLE: When will matrix multiplication become just "concatenation"?
QUESTION [16 upvotes]: Saw below entertaining matrix multiplication examples.

Obviously they are just coincidences. But I am curious when does below hold?
\begin{equation}
\begin{pmatrix}
a_1 & b_1 \\
c_1 & d_1 
\end{pmatrix} \times \begin{pmatrix}
a_2 & b_2 \\
c_2 & d_2 
\end{pmatrix} = \begin{pmatrix}
\overline{a_1 a_2} & \overline{b_1 b_2} \\
\overline{c_1 c_2} & \overline{d_1 d_2}
\end{pmatrix}
\end{equation}
here $\overline{a_1 a_2}$ means gluing the integers together, not multiplications.. assuming we are working on integer matrices.

REPLY [21 votes]: Let $A$ denote the first matrix in the product, and let $B$ denote the second.
I will consider only the case in which the entries of $B$ have one digit.
In this case, the "gluing" property of this matrix multiplication can be written as
$$
AB = 10A + B.
$$
Note that this equation can be rearranged into
$$
AB - 10 A - B + 10I = 10I \implies\\
(A - I)(B - 10 I)= 10 I,
$$
where $I$ denotes the identity matrix. Now, suppose that we select a matrix $B$ and we want a corresponding matrix $A$. We have
$$
(A - I)(B - 10 I) = 10 I \implies\\
A = 10(B - 10 I)^{-1} + I.
$$
Note that this equation only has a solution if $\det(B - 10 I) \neq 0$. Now, a question remains: how do we ensure that $10 (B - 10 I)^{-1}$ is an integer matrix? As it turns out, this will hold for a given integer matrix $B$ if and only if the determinant of $B - 10 I$ divides $10$.
In fact, we can generate pairs of matrices with non-negative integer entries that have the gluing property via the following steps:

Find a matrix $C$ whose diagonal entries satisfy $-10 \leq c_{ii} \leq -1$ and whose off-diagonal entries are a single digit positive number such that the determinant of $C$ is either $-1$, $-2$, $-5$, or $-10$.
Take $B = 10 I + C$ and $A = 10C^{-1} + I$.


For example, the matrix
$$
C = \pmatrix{-4 & 3\\7 &-4}
$$
has determinant $16 - 21 = -5$, which divides $10$. The corresponding matrix $B$ is
$$
B = 10 I + \pmatrix{-4 & 3\\7 &-4} = \pmatrix{6&3\\7&6}.
$$
The associated matrix $A$ is
$$
10C^{-1} + I = \frac{10}{-5} \cdot \pmatrix{-4 & -3\\-7 & -4} + \pmatrix{1&0\\0&1} 
= \pmatrix{9 & 6\\14 & 9}.
$$
If we compute the product, we indeed find that
$$
\pmatrix{\color{blue}{9} & \color{blue}{6}\\
\color{blue}{14} & \color{blue}{9}} \cdot 
\pmatrix{\color{green}{6} & \color{green}{3}\\
\color{green}{7} & \color{green}{6}} = 
\pmatrix{\color{blue}{9}\color{green}{6} & \color{blue}{6}\color{green}{3}\\
\color{blue}{14}\color{green}{7} & \color{blue}{9}\color{green}{6}}.
$$

An interesting phenomenon: if $B$ is a single digit matrix for which there exists an $A,B$ pair with this "gluing" property, we will have $A = B$ if and only if $B$ is a "vampire matrix" (cf. my comment on the question), which holds if and only if $B$ has eigenvalues $0,11$, which holds if and only if $C = B - 10 I$ has eigenvalues $-10,1$, which holds if and only if $C$ has determinant $-10$ and trace $-9$.

REPLY [10 votes]: Call the two matrices (in blue and in green respectively) $A$ and $B$. Assuming for simplicity that we want $B$ to consist of single digits only, we can write the property we're looking for as a matrix equation: $AB = 10A + B$.
Moving everything to one side, we can add a fourth term to make things easier to factor: $AB - 10A - B + 10I = 10I$. This can be written as $(A - I)(B - 10I) = 10 I$. So, in terms of $B$, we have $$A = 10(B - 10 I)^{-1} + I.$$
This gives us a formula for $A$ no matter which $B$ we pick, though out of $10^4$ possibilities for $B$, my computer only found $429$ for which $A$ consists of nonnegative integers.