9
$\begingroup$

An n x n matrix is said to be completely-odd if:

the numbers in the matrix are either 0 or 1

and

for every number in the matrix, the sum of the numbers in its neighborhood is odd where the neighborhood of a number includes the number itself and its horizontally and vertically adjacent numbers.


EXAMPLE:

Shown below are three views of the same 4x4 completely-odd matrix:

The number in row 1 column 1 with its neighborhood highlighted has a neighborhood sum of 1+0+0=1 which is odd:

4x4 matrix with 3 entries highlighted

The number in row 1 column 2 with its neighborhood highlighted has a neighborhood sum of 1+0+1+1=3 which is odd:

same matrix but 4 entries highlighted

The number in row 3 column 2 with its neighborhood highlighted has a neighborhood sum of 1+1+1+1+1=5 which is odd:

same matrix but 5 entries highlighted


PUZZLES:

Can you construct a 5x5 completely-odd matrix?
Can you construct a 6x6 completely-odd matrix?

$\endgroup$
4
  • 2
    $\begingroup$ Going out on a tangent some of you might be interested in, how to just pick solutions up to the full square symmetry? I have ended up asking it on the Mathematics site. $\endgroup$ Commented Oct 27 at 17:04
  • $\begingroup$ This puzzle is also known as "Lights Out". $\endgroup$
    – lily
    Commented Oct 28 at 14:50
  • $\begingroup$ Wouldn't this just reduce to finding solutions to a certain set of linear equations in 25 (resp. 36) variables in \$\mathbb{F}_2\$ which is straightforward to analyze with simple linear algebra? $\endgroup$ Commented Oct 28 at 22:52
  • $\begingroup$ @DanielSchepler For me it is not much fun to set up a system with 25 or more variables. But if others enjoy doing it that way, it’s fine by me. $\endgroup$ Commented Oct 29 at 3:17

4 Answers 4

6
$\begingroup$

$n=6$:

$$\begin{matrix}1 & 0 & 1 & 1 & 0 & 1\\0 & 1 & 1 & 1 & 1 & 0\\1 & 1 & 1 & 1 & 1 & 1\\1 & 1 & 1 & 1 & 1 & 1\\0 & 1 & 1 & 1 & 1 & 0\\1 & 0 & 1 & 1 & 0 & 1\end{matrix}$$


Just wanted to add a bit more about my thoughts on how to construct a solution for any $n$:

First, I want to assume that the matrix is symmetric. This is certainly true in most of the answers here, and my goal isn't to construct all possible solutions anyway. With this assumption, it is clear that all the entries in the diagonal must be $1$. By the symmetry, we can focus only on the lower triangle. Let the entries in the diagonal below the principal diagonal be $a_1,\ldots,a_{n-1}$. The lower triangle of the matrix looks like this now $$\begin{matrix} 1 \\ a_1 & 1 \\ & a_2 & 1 \\ & & \ddots & \ddots \\ & & & a_{n-1} & 1\end{matrix}$$ Everything after this point is completely determined in terms of $a_i$'s by the odd-sum constraints. For instance, the entry below $a_1$ must be $1 + a_1 \pmod 2$ so that the sum of all neighbours of $a_1$ (including itself) is $1 \pmod 2$. However, $a_i$'s are not all arbitrary. To fill up the entire (lower triangle of the) matrix, we use only the odd-sum constraints up to $n-1$th row. The odd-sum constraints of the $n$th row give $n-1$ equations in $a_i$'s. I don't yet have a proof that these $n-1$ equations have a solution for any $n$, but for $n\le 6$, it gives precisely the answers here (up to reflections/rotations of the matrix).

$\endgroup$
1
  • 2
    $\begingroup$ Welcome to PSE (Puzzling Stack Exchange)! $\endgroup$ Commented Oct 27 at 2:37
5
$\begingroup$

$5\times5$

\begin{matrix}0&0&0&1&1\\1&1&0&1&1\\1&1&1&0&0\\0&1&1&1&0\\1&0&1&1&0\end{matrix}

$\endgroup$
2
$\begingroup$

For the 6x6 case,

we can reuse some corners from the 4x4:enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ What do you mean by this? Neither of the two assignments of colours to numbers seem to work. $\endgroup$ Commented Oct 27 at 3:38
  • 4
    $\begingroup$ @BenjaminWang white is 1, black is 0, and the 6x6 is the central 6x6 squares in the bigger 8x8 cells, so the outer black ring is just border not part of the 6x6 required. (also, this is essentially the same answer as Pranay, posted less than one minute apart) $\endgroup$
    – justhalf
    Commented Oct 27 at 8:08
  • $\begingroup$ It is the only solution anyway. $\endgroup$
    – Florian F
    Commented Oct 27 at 22:35
1
$\begingroup$

$5 \times 5$:

AAOBB
AOOOB
OOOOO
COOOD
CCODD

AAEBB
AEEEB
COEOD
CCFDD
CFFFD

The Os can be vertically aligned instead if the diagram is rotated by 90 degrees, so the sum of the middle square's neighbors is even, making this square's value 1. Also, the sum of the squares from A to F is even because there are 6 groups.

AACBB
ACCCB
GO1OG
DFFFE
DDFEE

The sum of the groups from A to F is also even but 1 is odd, which means the sum of the G cells is odd (opposites).

A B X C D
E F G H I
Z J 1 K 1-Z
L M N O P
Q R 1-X S T

A+B+E = A+B+F+X = 1 (mod 2)
E = F+X (mod 2)

A.........Z+F...X.....H+1-Z D
F+X......F......G.....H........X+H
Z.........J.........1.....K.......1-Z
1+M-X..M......N.....O........1+O-X
Q..........Z+M..1-X 1+O-Z T

G = X+F+H (mod 2)

A.........Z+F...X..........H+1-Z.....D
F+X......F......X+F+H.....H........X+H
Z.......F+Z+M..1.....H+O+1-Z....1-Z
1+M-X..M....M+O+1-X...O...1+O-X
Q..........Z+M..1-X.....1+O-Z.....T

A+Z+X = odd
X+D-Z = X+D+Z = even
D = 1-A (mod 2)

A.........Z+F...X..........H+1-Z.....1-A
F+X......F......X+F+H.....H........X+H
Z.......F+Z+M..1.....H+O+1-Z....1-Z
1+M-X..M....M+O+1-X...O...1+O-X
1-A..........Z+M..1-X.....1+O-Z.....A

5F+2Z+2X+H+M = F+H+M = odd
H+F+O = odd, M= O

A.........Z+F...X....F+1-Z.....1-A
F+X......F......X.....F........X+F
Z..........Z......1....1-Z....1-Z
1+F-X..F......1-X...F......1+F-X
1-A......Z+F...1-X..1+F-Z.....A

F=1

A.........Z+1...X....Z.....1-A
1+X......1......X.....1........X+1
Z..........Z......1....1-Z....1-Z
X...........1......1-X.....1......X
1-A......Z+1...1-X..Z.....A

The only rule left is A+Z+X = 1 (mod 2). Let A=1:

11000
11011
00111
01110
01101

$6 \times 6$:

here

$\endgroup$
8
  • $\begingroup$ Are you sure that your second deduction (re: G cells) is correct? I get that you have four odd groups, two even groups, a 1, and the G group adding to an even sum. $\endgroup$ Commented Oct 27 at 1:24
  • $\begingroup$ Sorry, fixed it. $\endgroup$
    – Nautilus
    Commented Oct 27 at 13:35
  • $\begingroup$ Might be interesting to note that your $5\times5$ answer is the same as Daniel’s answer after flipping the matrix horizontally. $\endgroup$
    – Pranay
    Commented Oct 27 at 15:43
  • 1
    $\begingroup$ Well, any solution can be mirrored and it'll be another unless it's completely symmetrical. $\endgroup$
    – Nautilus
    Commented Oct 27 at 17:27
  • $\begingroup$ Doing out the linear algebra, the 6*6 is unique and the 5*5 has 4 solutions. $\endgroup$
    – xnor
    Commented Oct 28 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.