# Prime matrices II

Someday soon I'll have a post where figures will be useful. Until then, more New England.

Yesterday, I asked for the “smallest” 3×3 singular matrix, each of whose entries is a distinct prime.  By “smallest”, I am adding all the entries in the matrix.

It turns out that there is an optimal matrix, by which I mean there is a way to arrange the smallest 9 primes so that the matrix is singular, and the sum is 100.  One such way (remember, we can exchange rows, exchange columns, or take transposes and still have a solution) is this:

$M=\begin{bmatrix}3 & 2 & 5\\ 11 & 13 & 7\\ 19 & 17 & 23\end{bmatrix}$

As to how I found this solution, I used the following observation for such a solution MThe columns of M are linearly dependent over the integers.  Thus I wrote a short program in MATLAB that looked through the first primes, took them two at a time, say and q, and then checked whether  ap+bq was a prime, for parameters a and b that I could change.

Using a=1, b=-2, I found the optimal matrix is

$M=\begin{bmatrix}11 & 2 & 7\\ 23 & 3 & 17\\ 31 & 13 & 5\end{bmatrix},$

So much New England.

whose sum is 112, and I thought this was pretty good, since it only missed 19 and 29.  The next choice of a = 3, b = -2 turned out to be the winner above (notice, as expected, that 3 times the first column minus twice the second is the third).  I was also surprised to find that choosing a = 5, b = -6 did very well, with a matrix total of 106 (this is, by necessity, the second best answer, since it only swaps out a 23 for a 29).
Since yesterday, I was able to use the same sort of ad-hoc method to find a similarly optimal 4×4 “prime” matrix (again, “optimal” means I use only the first 16 primes):

$M=\begin{bmatrix}7 & 3 & 2 & 13\\ 23 & 5 & 11 & 29\\ 31 & 19 & 17 & 47\\ 43 & 41 & 37 & 53\end{bmatrix},$

which is enough for me to ask the following question, verified only for the first two cases:

For n > 2, is there a singular n x n matrix whose entries are the first n^2 prime numbers?

Too much New England! Creepy woods women!