Light Switch: a solution is not always the shortest.
Retry one fixed board in eleven and five presses, inspect all 32 top-row trials, and prove which solution is shortest.
Turning every light off proves that a switch set works. It does not prove that no smaller set works. In this lesson, the first successful row-chasing trial takes eleven presses, but another trial solves exactly the same board in five. We will compare the answers, then explain why five is the minimum for this particular position.
Load the comparison board
Use Practice this example in the side panel, or choose Load shortest-solution example below the Light Switch board. The fixed pattern is shown here. Filled circles are on; dots are off. Rows and columns count from the top-left corner.
· ● · ● ● ● ● ● ● ● · ● ● ● ● ● · · ● ● ● ● · ● ●
Loading the example replaces your current puzzle and sets Moves to zero. Retry this board restores this same pattern with zero moves, including after you solve it. New puzzle creates a random pattern instead. A practice entry or refresh of that entry reloads the example; it does not remember your previous presses.
Count switches, rather than repeated attempts
Each square toggles itself and its immediate horizontal and vertical neighbors. Pressing one square twice cancels its effect. Switch effects also commute: changing their order leaves the final board unchanged.
Therefore, any planned solution with a repeated square can be shortened by deleting pairs of presses at that square. To find a minimum, we only need to compare sets in which each of the 25 switches is pressed zero or one time. This does not mean accidental presses are free: the live counter records every click, including a click used to undo a mistake.
Why 32 top-row choices cover the search
There are five switches in the top row, giving 2 × 2 × 2 × 2 × 2 = 32 possible sets. Choose one set and press it first. Then look at row 1: press directly below every light that is still on, in row 2. Repeat for rows 2, 3, and 4, pressing in the next row down.
Once the top-row set is fixed, every lower-row choice is forced. After accounting for row 1 presses, the only unchosen switch that can affect a particular light in row 1 is the one directly below it. The same argument applies to each following row. A switch farther down cannot reach back to a completed row. The resulting trial either clears the bottom row or fails; there is no sixth row to use.
Any successful zero-or-one switch set has one of those 32 top-row sets and must obey those forced lower choices. Testing all 32 therefore covers every possible reduced solution under these rules. Stopping at the first success finds an answer; comparing the counts of every success finds a minimum.
Replay the first successful trial: eleven presses
For this comparison, trial numbers run from 0 to 31. Their five-bit top-row code lists columns C1 through C5 from left to right; a 1 means press that switch. Trial 1 is 10000, trial 2 is 01000, and trial 4 is 00100. This is an enumeration label, not a picture of lights that are on.
Trials 0–4 leave lights on. Trial 5, 10100, succeeds. Load the example and follow these switches in the given order:
- Row 1: C1, C3.
- Row 2: C1, C2, C3, C5.
- Row 3: C4.
- Row 4: C1, C3, C5.
- Row 5: C3.
The counts are 2 + 4 + 1 + 3 + 1 = 11. All lights are off, and the game reports eleven moves. Keep this count in a paper note before retrying; the game does not store a history of attempts.
Replay the five-press answer
Choose Retry this board. Trial 16 has top-row code 00001, meaning only R1C5 is selected before chasing:
- Press R1C5. The first row now has only C2 lit, so press R2C2.
- Row 2 now has only C4 lit, so press R3C4.
- Row 3 is already dark. Press nothing in row 4.
- Row 4 has C1 and C5 lit. Press R5C1, then R5C5.
The sequence R1C5, R2C2, R3C4, R5C1, R5C5 turns off all 25 lights in five moves. Notice the skipped row: chasing tells you to press below lit squares, not to make a move in every row.
Check all four successful sets
For this board, exactly four top-row choices finish with an all-dark bottom row. The full trial ledger below includes failures as well as successes.
| Trial | Top-row code | Total presses |
|---|---|---|
| 5 | 10100 | 11 |
| 11 | 11010 | 9 |
| 16 | 00001 | 5 |
| 30 | 01111 | 19 |
Five is the smallest of 11, 9, 5, and 19. Because every reduced solution is covered by this search, no solution using fewer than five presses exists for this starting board. A different random board needs its own search; these four counts are not a universal rule for Light Switch.
Open the complete 32-trial checking ledger
Start from the original diagram for every row of this ledger. Press the indicated top-row switches, then chase downward. Total presses includes the top-row set and all lower-row presses. Bottom lights are listed C1–C5: 1 means on, 0 means off. Rows 1–4 are dark at the end of every trial, so bottom code 00000 marks a success.
| Trial | Top presses | Total | Bottom lights |
|---|---|---|---|
| 0 | 00000 | 10 | 10110 |
| 1 | 10000 | 7 | 11011 |
| 2 | 01000 | 12 | 01010 |
| 3 | 11000 | 13 | 00111 |
| 4 | 00100 | 12 | 01101 |
| 5 | 10100 | 11 | 00000 |
| 6 | 01100 | 10 | 10001 |
| 7 | 11100 | 9 | 11100 |
| 8 | 00010 | 12 | 10001 |
| 9 | 10010 | 13 | 11100 |
| 10 | 01010 | 12 | 01101 |
| 11 | 11010 | 9 | 00000 |
| 12 | 00110 | 10 | 01010 |
| 13 | 10110 | 13 | 00111 |
| 14 | 01110 | 18 | 10110 |
| 15 | 11110 | 13 | 11011 |
| 16 | 00001 | 5 | 00000 |
| 17 | 10001 | 10 | 01101 |
| 18 | 01001 | 11 | 11100 |
| 19 | 11001 | 12 | 10001 |
| 20 | 00101 | 13 | 11011 |
| 21 | 10101 | 16 | 10110 |
| 22 | 01101 | 15 | 00111 |
| 23 | 11101 | 10 | 01010 |
| 24 | 00011 | 15 | 00111 |
| 25 | 10011 | 16 | 01010 |
| 26 | 01011 | 11 | 11011 |
| 27 | 11011 | 16 | 10110 |
| 28 | 00111 | 15 | 11100 |
| 29 | 10111 | 14 | 10001 |
| 30 | 01111 | 19 | 00000 |
| 31 | 11111 | 18 | 01101 |
A self-check before the answer
Retry the example. Trial 11 uses top-row code 11010. Press R1C1, R1C2, and R1C4, then derive the remaining presses yourself by chasing. Which rows require no press, and does this improve on eleven moves?
Check the nine-press sequence
After the three top-row presses, use R2C2; R3C1, R3C2, R3C5; no square in row 4; then R5C2 and R5C4. The total is 3 + 1 + 3 + 0 + 2 = 9. It improves on eleven, but the five-press answer is still shorter.
What this minimum does—and does not—measure
The result minimizes the number of switch presses needed from this exact starting board, with every press costing one move. It does not measure the time needed to discover the answer, the number of failed trials, or how many intermediate lights turn on. Each Retry starts a separate counter. The live game does not calculate an optimum or rate your attempt against one.
The proof depends on a fixed 5 × 5 board with the local cross rule, no wrapping at edges, and no other constraints. Do not transfer the 32-trial search unchanged to a different-sized board, a game that toggles diagonal neighbors, or a game that changes its rules after a press. A useful next experiment is to make a paper record for a random board: first find a working set, then compare every successful top-row trial before claiming it is shortest.