3

I'm new to matrix multiplication and was trying to generate a sequence of consecutive numbers from the product of two $2 \times 2$ matrices and noticed this pattern. Let

$$ A = \begin{pmatrix} n & n+1 \\ n+2 & n-1 \end{pmatrix}, \quad B = \begin{pmatrix} m & m-1 \\ m-1 & m \end{pmatrix}, \quad C = AB $$

Compute

\begin{align*} C &= \begin{pmatrix} n & n+1 \\ n+2 & n-1 \end{pmatrix} \begin{pmatrix} m & m-1 \\ m-1 & m \end{pmatrix} \\ &= \begin{pmatrix} nm + (n+1)(m-1) & n(m-1) + (n+1)m \\ (n+2)m + (n-1)(m-1) & (n+2)(m-1) + (n-1)m \end{pmatrix} \\ &= \begin{pmatrix} 2nm - n + m - 1 & 2nm + m - n \\ 2nm + m - n + 1 & 2nm + m - n - 2 \end{pmatrix} \end{align*}

Let $k = 2nm + m - n$, then

$$ C = \begin{pmatrix} k - 1 & k \\ k + 1 & k - 2 \end{pmatrix} $$

which yields consecutive numbers $k-2,k-1,k,k+1$.

Example

Let $n=150, m=16$. Then multiplying

$$ \begin{pmatrix} 150 & 151 \\ 152 & 149 \\ \end{pmatrix} \cdot \begin{pmatrix} 16 & 15 \\ 15 & 16 \\ \end{pmatrix} = \begin{pmatrix} 4665 & 4666 \\ 4667 & 4664 \\ \end{pmatrix} $$

gives $k=4666$ with consecutive numbers $4664, 4665, 4666, 4667$. WolframAlpha

Questions

Can that method be generalized to two $n \times n$ matrix products, resulting in $n^2$ consecutive numbers?

Aside, is there a way to ensure the $n^2$ consecutive numbers are always composite?

vengy
  • 1,903

1 Answers1

2

Your example works because $$\eqalign{A &= n \pmatrix{1 & 1\cr 1 & 1\cr} + \pmatrix{0 & 1\cr 2 & -1\cr}\cr B &= m \pmatrix{1 & 1\cr 1 & 1\cr} + \pmatrix{0 & -1\cr -1 & 0\cr}}$$ and $$ \pmatrix{0 & 1\cr 2 & -1\cr} \pmatrix{1 & 1\cr 1 & 1\cr} = \pmatrix{1 & 1\cr 1 & 1\cr}$$ (because both row sums of $\pmatrix{0 & 1\cr 2 & -1\cr}$ are $1$), while $$ \pmatrix{1 & 1\cr 1 & 1\cr} \pmatrix{0 & -1\cr -1 & 0\cr} = \pmatrix{-1 & -1\cr -1 & -1\cr}$$ (because both column sums of $\pmatrix{-1 & 0\cr 0 & -1\cr}$ are $1$), $$\pmatrix{0 & 1\cr 2 & -1\cr} \pmatrix{0 & -1\cr -1 & 0\cr} = \pmatrix{-1 & 0\cr 1 & -2\cr} $$ and $$\pmatrix{1 & 1\cr 1 & 1\cr} \pmatrix{1 & 1\cr 1 & 1\cr} = \pmatrix{2 & 2\cr 2 & 2\cr} $$ so $$A B = (n m - n + 2) \pmatrix{1 & 1\cr 1 & 1\cr} + \pmatrix{-1 & 0\cr 1 & -2\cr}$$ has its entries four consecutive integers.

For a similar pattern in $n \times n$ matrices, let $E$ be the $n \times n$ matrix whose entries are all $1$. We want $F$ be an $n \times n$ matrix whose entries are $n^2$ consecutive integers, with all row sums equal. Note that the sum of $n^2$ consecutive integers starting with $a$ is $S(a,n) = ((n^2 + a)^2 - n^2 - a^2)/2$. The row sums would have to be $S(a,n)/n = (n^3 - n)/2 + a n$. Since $n^3 - n$ is always even, that is always an integer. For example, for $n = 5$ one possibility is $$ F = \pmatrix{14 & 16 & 13 & 10 & 12\cr 11 & 7 & 22 & 19 & 6\cr 18 & 17 & 21 & 4 & 5\cr 20 & 9 & 25 & 8 & 3\cr 23 & 24 & 15 & 2 & 1\cr}$$ And let $G$ be a permutation matrix. Then $A = x E + F$, $B = y E - G$ will work.

Robert Israel
  • 448,999