## Solutions to Lights Out

I’ll briefly introduce the Lights Out puzzle: the game is played on an *n*-by-*n* grid of buttons which, when pressed, toggle between a lit and unlit state. The twist is that toggling a light *also* toggles the state of its neighbors (above, below, right, left—although, on the boundary, lights have fewer neighbors). All the buttons are lit when the game begins, and the goal is to turn all the lights off.

There are two key observations:

- toggling a light twice amounts to doing nothing,
- toggling light $A$ and then light $B$ has the same effect as toggling $B$ and then toggling $A$.

**the order in which we press the buttons is irrelevant.**So to solve the

*n*-by-

*n*puzzle, we just need to know whether a button needs to be pressed. My old website had some pictures I made showing solutions for boards of various sizes—pictures where a white pixel meant “press” and a black pixel meant “don’t press.” I assembled these pictures into a video, showing solutions to the Lights Out puzzle for $n \leq 200$:

For as cool as that looks, there’s not much to be discovered (as far as I can tell) from watching these frames flash by. But it does look like about half the buttons have to be pressed to solve the puzzle: why is that?

The still frames of the movie are available here as PNGs in a zipped archive. Here is a solution to the 400-by-400 board:

Finding that solution involved row-reducing a $(400 \cdot 400 + 1)$-by-$400 \cdot 400$ matrix—that’s a matrix with over 25 billion entries. On the other hand, each entry is one bit, so that matrix fits (not coincidentally) in 3 gigabytes of memory. One could surely do better, considering how sparse the matrix is: perhaps we could have a little contest for solving very large Lights Out games.

Besides the fact that all these pictures look awesome, Lights Out is a neat example to motivate some linear algebra over a finite field. It illustrates how satisfying an “easy” local condition (each light must be turned off) might require a globally complicated solution—a lesson for mathematics and for life!

**Posted:** Monday, July 21, 2008 9:32:40pm

**Category:** Personal, Mathematics

Permalink and Comments

CommentfromCarlosTime:Saturday, November 15, 2008 11:07:27pmThese patterns are obviously symmetrical and beautiful. As compared to if each dot is black (or white) with p=0.5 over the area*, I would say the patterned solution is "entropically" less, because it is more "ordered." Nothing immediately pops into mind regarding how to measure the deviation from * (entropically-speaking), but it's perhaps an interesting question to consider. Also: why is the proportion of the solution 50/50? - It doesn't necessarily make intuitive sense to me!