# All neighbor sum is 0 on a chessboard

Neighbor cells of a matrix are defined as all the cells that share a common edge. A matrix is formed by putting real numbers in each cell.

Form an $$8 \times 8$$ matrix (like a chessboard) where sum of all neighbors of each cell is $$0$$.

What is the fewest 0-valued cells possible after forming the matrix?

This works for any given $$a,b,c,d$$:

$$\begin{array} {|c|c|c|c|c|c|c|c|}\hline a&b&c&d&d&c&b&a\\\hline -b&-a-c&-b-d&-c-d&-c-d&-b-d&-a-c&-b\\\hline c&b+d&a+c+d&b+c+d&b+c+d&a+c+d&b+d&c\\\hline -d&-c-d&-b-c-d&-a-b-c-d&-a-b-c-d&-b-c-d&-c-d&-d\\\hline d&c+d&b+c+d&a+b+c+d&a+b+c+d&b+c+d&c+d&d\\\hline -c&-b-d&-a-c-d&-b-c-d&-b-c-d&-a-c-d&-b-d&-c\\\hline b&a+c&b+d&c+d&c+d&b+d&a+c&b\\\hline -a&-b&-c&-d&-d&-c&-b&-a\\\hline \end{array}$$

so:

zero zeroes are needed (for example, $$a,b,c,d\gt0$$)

Following @Jaap's comment:

$$\begin{array} {|c|c|c|c|c|c|c|c|}\hline a&h&c&g&d&f&b&e\\\hline -h&-a-c&-h-g&-c-d&-f-g&-b-d&-e-f&-b\\\hline c&g+h&a+c+d&f+g+h&b+c+d&e+f+h&b+d&f\\\hline -g&-c-d&-f-g-h&-a-b-c-d&-e-f-g-h&-b-c-d&-f-h&-d\\\hline d&f+g&b+c+d&e+f+g+h&a+b+c+d&f+g+h&c+d&g\\\hline -f&-b-d&-e-f-g&-b-c-d&-f-g-h&-a-c-d&-g-h&-c\\\hline b&e+f&b+d&f+h&c+d&g+h&a+c&h\\\hline -e&-b&-f&-d&-g&-c&-h&-a\\\hline \end{array}$$

• You could consider the white squares of the chessboard separately from the black squares, treating them as independent, identical puzzles. You have given those two sets the same (mirrored) solution, but you can choose different $a,b,c,d$ for them. This gives you the most generic parametric solution, with 8 variables on the first row of the board. – Jaap Scherphuis Jan 7 '19 at 12:55

Least amount of zero valued cells is

zero

One such possible grid is:

Because the grid size is even in both directions, I used the following algorithms to fill it:

1. Fill 1 in first two cells. Some other number will also work.
2. Copy the same number to the second end of row and additive inverse in opposite col (or vice versa).
3. Fill rest of the number in a way that constraints are met.
4. If any of the cells is zero, try with different numbers.

I got the above algorithm as an intuition. I am still figuring an easy way to explain/prove why does it work?