# Curios observation about a special grid - Why?

[0,1,6,4,3]
[4,5,6,0,9]
[9,9,0,1,1]
[1,0,4,5,6]
[7,6,4,9,0]


This 5x5 table has unique properties.
Each number in a cell means :

The cell = last digit of (sum of its neighbour (including diagonals))

or

The cell = The remainder of the sum of its neighbour divided by 10

Here is another example

 [0,1,6,4,8]   [1,2,1,3,2]   [1,0,9,0,1]
[4,5,6,0,4]   [4,5,1,0,9]   [6,5,9,5,6]
[4,4,0,6,6]   [3,3,0,7,7]   [5,5,0,5,5]
[1,0,4,5,1]   [1,0,9,5,6]   [9,0,1,0,9]
[2,1,4,4,0]   [8,7,9,8,9]   [4,5,1,5,4]


What surprised me is, every table like this will follow this :

• The middle cell is always 0.
• Any other cell $(i,j)$ and $(6-i, 6-j)$ adds upto 0 modulo 5
That means, $(i,j) + (6-i, 6-j)$ is completely divisible by 5.

I have checked this with my computer.

Why this happens ?

• and I guess (2,3)+(4,3) is always 0 or 10 and more... – Jonathan Allan Oct 10 '16 at 7:21
• @ArbitraryKangaroo I do not agree with your 2nd edit. – Jamal Senjaya Oct 10 '16 at 8:16
• @JamalSenjaya: Yes, that's right, and that edit was nonsese. I have made my final edit, and I don't know if it contains any mistake or not. – user27395 Oct 10 '16 at 8:29
• @ArbitraryKangaroo You can put your analysis as answer, or partial answer, not editing the question to far. – Jamal Senjaya Oct 10 '16 at 8:35
• @ArbitraryKangaroo maybe you are right, but your edit make the puzzle much easier to solve. So I reject it. – Jamal Senjaya Oct 10 '16 at 8:41

Here is an almost-insight-free but perfectly straightforward proof. It involves computer calculation, but there's nothing here that couldn't be done unaided by a human with a reasonably high boredom threshold.

First of all, we're just working modulo 5 here. Your condition on each cell's relation to its neighbours is a mod-10 condition, which is equivalent to one mod 2 and one mod 5. The mod 2 one is irrelevant to the puzzle.

Now, think of possible grids as 25-element vectors. Our condition on each cell gives a linear constraint on these vectors. We have 25 constraints and a 25-dimensional space of vectors.

"In general" this setup will leave us with a 0-dimensional space of solutions, in other words no solutions but the trivial one where (when we're working mod 5) all cells' entries are multiples of 5. But in this case it happens that the conditions are not quite independent, and in fact there are two linearly independent solutions; every solution is a linear combination of these (mod 5), so there are $5^2=25$ solutions mod 5. (One of them is the trivial one.)

How do we determine that there are two linear solutions and find what they are? We ask a computer. In my case, I asked Mathematica. The code is boring and ugly:

m = ConstantArray[0, {25, 25}]
For[i = 0, i <= 4, i++,
For[j = 0, j <= 4, j++,
For[di = -1, di <= 1, di++,
For[dj = -1, dj <= 1, dj++,
ii = i + di; jj = j + dj;
If[0 <= ii <= 4 && 0 <= jj <= 4,
m[[5 i + j + 1, 5 ii + jj + 1]] =
If[di == 0 && dj == 0, 4, 1]]
]]]]
NullSpace[m, Modulus -> 5]


(here the cleverness, such as there is, lies inside the invocation of NullSpace; as mentioned above, doing by hand what this does by machine is boring but not difficult) and the answer is

{{4, 0, 1, 0, 4, 4, 0, 1, 0, 4, 0, 0, 0, 0, 0, 1, 0, 4, 0, 1, 1, 0, 4, 0, 1}, {0, 4, 4, 1, 2, 1, 0, 4, 0, 1, 1, 1, 0, 4, 4, 4, 0, 1, 0, 4, 3, 4, 1, 1, 0}}


meaning that the solutions mod 5 are the linear combinations of these grids

4 0 1 0 4
4 0 1 0 4
0 0 0 0 0
1 0 4 0 1
1 0 4 0 1


and

0 4 4 1 2
1 0 4 0 1
1 1 0 4 4
4 0 1 0 4
3 4 1 1 0


and since each of these satisfies the given anti-symmetry condition, so does any linear combination of them, QED.

• Your second matrix looks a bit random, but it would become much neater if you were to add the first matrix to it. This problem and your linear algebra solution is very similar to Lights Out (for which in a blatant bit of self-promotion I refer you to my website: jaapsch.net/puzzles/lomath.htm ) – Jaap Scherphuis Oct 10 '16 at 15:31
• Oh yes, once you've seen the first one it's obvious that its transpose must also be valid and that the two are independent. But I wanted to present an absolutely minimal-thought approach, and for that you don't need to notice that :-). – Gareth McCaughan Oct 10 '16 at 15:33