Turn on!

There are 16 16 lamps in a 4 × 4 4\times 4 square, initially all turned off, as is shown in the figure below.

The way the switches of the lamps are designed to work is as follows:

If we change the status of any lamp (if it is turned on, then we turn it off; if it is turned off, then we turn it on), then the statuses of all the other lamps in the same row or column change at the same time.

If we call this one step, what is the minimum number of steps we need to switch on all of the lamps?


The answer is 16.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Jonathan Quarrie
Jul 1, 2017

@Marta Reece has already provided the mathematics behind this problem, give her solution an upvote.

I just have a penchant for imagery.

Marta Reece
Jul 1, 2017

If every light switched is worked exactly once, in any order, the result will be switching of all the lights to opposite setting, since each one will be switched 7 times and that is an odd number.

There is not a shorter solution because 7 and 16 are coprime.

I can't see the connection between there are no shorter solution, then 16, and 7 and 16 are coprime. Can you explain me?

Áron Bán-Szabó - 3 years, 11 months ago
Shaun Leong
Jul 5, 2017

My classmate gave this solution:

Define toggling a square to mean changing the statuses of the 7 lamps in its row and column.

Note that the sequence of toggles does not matter as they are independent. Also, toggling the same square twice wastes moves without changing the grid.

Hence, each square is toggled at most once. Also, we can take any sequence of toggles longer than 16 and remove repeats, to give a sequence of toggles with length not more than 16.

The first step is to show that all configurations of lamps can be achieved. It suffices to show that it is possible to switch a single lamp without affecting the rest of the grid. Once we can do so, we can simply flip each square that we want individually, to get a desired configuration of lit light bulbs.

This gives a combined sequence of toggles that is too long, but from above, this can be shortened to length not more than 16.

Indeed, to switch a single lamp, we can toggle the 7 squares in its row and column.

Hence we have established that any final configuration of lamps can be reached by a sequence of not more than 16 toggles.

The second step is to show that if we are restricted to toggling without wasteful moves, then any configuration of lamps has a unique sequence of toggles which produce it (as order does not matter).

The number of sequences of toggles without repeats is 2 1 6 2^16 , since each square can either be toggled or not. The number of configurations of lamps is also equal to this number.

From the first step, every configuration of lamps has at least 1 sequence producing it, and a sequence of toggles results in a unique configuration. We can conclude that there must exist a one-to-one correspondence between a sequence of toggles and a lamp configuration.

(Each element of set A has exactly one arrow pointing out, and each element of set B has at least one arrow pointing to it)

Therefore a lamp configuration has a unique sequence of toggles producing it. This shows that the answer is 16 \boxed{16} , and the construction is toggling every square once.

On a side note, there is a way to generate the unique sequence of toggles given a configuration. Treat the configuration as a sequence of toggles, meaning that if a lamp is lit then toggle that square. This yields another configuration of lamps, the lit ones telling us the squares to toggle.

For example, if we want to light up the top left corner alone, we can toggle the left column and top row, which would be the positions of lit lamps if we merely toggled the top left corner.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...