How to solve Lights Out (and the maths behind it)
Lights Out is a grid of lights. Pressing a light switches it and its neighbours (above, below, left and right) between on and off. The goal is to turn every light off. It became popular as a handheld electronic game in the 1990s, and it hides some neat maths that makes it much easier to solve.
Two facts that change everything
Pressing a light twice does nothing. The second press undoes the first. So in any solution, each light is pressed either once or not at all.
Order doesn't matter. Every press just flips the same five lights no matter when you do it. Pressing A then B gives exactly the same result as B then A. So a solution is really just a set of squares to press, not a sequence.
These two facts mean you can stop worrying about "undoing" moves and think about which squares belong in your set.
The chase-the-lights method
- Look at the top row. For every light that is on in the top row, press the light directly below it in the second row. This turns off the top row.
- Now do the same for the second row: for every light still on, press the one below it in the third row.
- Keep going down the board, row by row. You'll end up with all rows off except, possibly, the bottom row.
If the bottom row is off too, you've won. If not, the pattern left on the bottom row tells you which squares to press in the top row before chasing again. Every board size has its own small table of bottom-row patterns and matching top-row presses. With a bit of practice you can work them out by experimenting: press a top-row light, chase all the way down, and see what bottom pattern it creates.
Why this works
Once the top row's presses are decided, every other press is forced: there's only one way to clear each row using the row below. So the whole puzzle comes down to choosing the top row. On a 5 by 5 board there are only 32 possible top rows, which is why the method always gets there.
The maths name for it
Mathematicians solve Lights Out with linear algebra over two numbers, 0 and 1, where 1 + 1 = 0 (two presses cancel). Each light becomes an equation and each button a variable. That sounds advanced, but it's the same idea as the chase method, written down in a way computers can solve instantly. It also proves that some starting patterns can never be solved, which is why puzzle makers generate boards by pressing random buttons on a dark board instead of switching random lights on.
Practise
In Lights Out on the Hub, the grid grows from 3 by 3 up to 5 by 5. Try the chase method on the small boards first and you'll find the bigger ones much less scary.