# Puzzle | Toggling CCTV cameras in a museum

A museum is fitted with 16 surveillance CCTV cameras each of which is switched on or off by a different switch.

Say, switch 1 controls CCTV camera-1, switch 2 controls CCTV camera-2, …, and switch 16 controls CCTV camera-16.

Each separate region of the museum is covered by multiple CCTV cameras than required and that configuration can not be changed now.

For the sake of meeting the limits of data storage without compromising the surveillance of any area in the museum, and due to other constraints, the surveillance manager created a plan to toggle (switch ON or OFF) the cameras at the start of any day as explained below with the help of a 4×4 table of switches 1 to 16:

(i) Start of any day, switches in any one of the rows or columns chosen randomly in the table shown above can be toggled all at once (toggle here means if they were ON yesterday, they will be OFF today and vice versa). Or, none of them may be toggled at all.

(ii) No toggling can be done during the day.

**Example-1:**

Assuming that on a day ‘n’ all the sixteen cameras are ON, on the next day ‘n+1’, cameras 5, 6, 7 and 8 can be OFF while all the remaining cameras can be ON. In this case, the second row is chosen to be toggled at the start of the day ‘n+1’.

**Example-2:**

Assuming that on a day ‘n’ cameras 1 and 5 are ON and all others are OFF, then on the next day ‘n+1’, cameras 9 and 13 can be ON while all the remaining cameras can be OFF. In this case, the first column is chosen to be toggled at the start of the day ‘n+1’.

**The surveillance manager had started off the first day of operation (the initial condition) with cameras 1, 7 and 14 being OFF while all other cameras being ON.**

**Question:**

a) Is it possible that after some days, the cameras 10, 11, 12 and 13 are ON while all other cameras are OFF?

b) Is it possible that after some days, cameras 1, 2, 3, 4, 5, 6 and 7 are OFF while all others are ON?

**Answer:**

a) No

b) No

**Solution:**

Applying each toggle by selecting a row or column and trying to get to the given final conditions as in questions a) and b) is a big task and hence we are forced to think of a strategy and observe carefully what happens after each toggle and if can get some clues, that will be of help to us.

As each switch can only be either ON or OFF, we tend to solve the problem by denoting ON and OFF by 1 and 0 or + and – signs and observing what happens to the sum of values or product of signs after each toggle.

Now we realize that + and – are more helpful as the number of elements in any row or column is even number (4). Because toggle of all signs of a collection of some positive signs and some negative signs both adding up to an even number will not change the resulting sign of their product. Let us examine this strategy further.

**Example – 1** : Product of the signs in the collection {+, -} is -ve. After a toggle it becomes {-, +} and the product of the signs in the collection still remains the same.

**Example – 2 **: Product of the signs in the collection {+, -, +, -} is +ve. After a toggle it becomes {+, -, +, -} and the product of the signs in the collection still remains the same.

**Example – 3** : Product of the signs in the collection {-, -, +, +, +, +, +, -} is -ve. After a toggle it becomes {+, +, -, -, -, -, -, +} and the product of the signs in the collection still remains the same.

Let us assign positive sign for a switch that is ON and negative sign for a switch that is OFF. Then the given initial configuration is as shown below:

We know the only valid toggling of the switches/cameras is by choosing a row or column and toggling **all** the switches in that row or column. As the number of switches in any row or column is **even**, a valid toggle will not change the product of the signs of the chosen row or column compared to the product of the signs in that row or column that was existing on the previous day.

We observe that the product of signs of all the switches in the 4×4 table is nothing but the product of signs of the products of all the four rows or equivalently all the four columns. Hence, we can also deduce that the product of signs of all the switches in the entire table before and after a valid toggle remains the same.

This is illustrated with and example in the diagram below:

**To answer a)**, we observe that in the given initial configuration **the product of signs of the entire table is -ve **as shown on the left side of the above figure.

The final configuration sought has cameras 10, 11, 12 and 13 are ON and all others OFF. That can be illustrated following our strategy of sign allocations as shown below:

**As shown above, the product of signs of the entire table is +ve.**

So, no matter how many days (how many valid toggles), one can not obtain the final configuration as the initial product of signs of the entire table is **-ve** and final product of signs of the entire table is **+ve**.

**To answer b)**, if we try the previous method of product of signs of entire table, it does not help because 1, 2, .., 7 are OFF and all others are ON. It means the final configuration has product of signs of the entire table is **-ve** which is same as the product of signs of the entire table of the initial configuration. So, it looks like obtaining the configuration in b) is possible but to prove that we need to find a sequence of toggles that achieves this. But before we take up that task, let us try if we can find a different collection of switches that doesn’t change its product of signs and which helps to solve this part of the problem.

We can think of collection of alternative rows as a candidate for our choice. That is, say, all the signs of Row-1 and Row-3 is called an odd collection and all the signs of Row-2 and Row-4 is called an even collection. Though a valid toggle does not change the product of all the signs in that collection, these collections have a drawback. For example, toggling row 2 does not have any impact on the odd collection.

So, let us think of forming two regions as in chess board pattern. As we have 4 switches in each row and column, number of switches of same color in each row or column is two, which is again **even**. So, this thought process may be helpful. The full table is divided into two regions **‘white region’** and **‘green region’** as shown below.

We can observe that

i) Any valid toggle does not change the product of all the signs of white region

i) Any valid toggle does not change the product of all the signs of green region

This is illustrated with an example of toggling a column in the following figure.

The left configuration of the above figure actually corresponds to the **initial configuration, which has a + sign in the GREEN region and a – sign in the WHITE region**.

The required final configuration of part b) (cameras 1, 2, 3, 4, 5, 6 and 7 are OFF while all others are ON) has a – sign in the GREEN region and a + sign in the WHITE region as shown below:

As the GREEN region has different signs in the initial and final configurations and WHITE region also has different signs in the initial and final configurations, this final configuration **can not be obtained **after any number of days.

This problem and solution are based on ‘**principle of invariance**‘.

**When things are seemingly changing continuously, look for what core values (though hidden) are not changing.**

## Recommended Posts:

- Puzzle 76 | Toggling prison cell
- Puzzle 51| Cheryl’s Birthday Puzzle and Solution
- Puzzle 34 | (Prisoner and Policeman Puzzle)
- Puzzle 81 | 100 people in a circle with gun puzzle
- Puzzle 85 | Chain Link Puzzle
- Puzzle | 3 Priests and 3 devils Puzzle
- Puzzle 15 | (Camel and Banana Puzzle)
- Puzzle 39 | (100 coins puzzle)
- Puzzle | Elevator Puzzle
- Puzzle 24 | (10 Coins Puzzle)
- Puzzle 27 | (Hourglasses Puzzle)
- Puzzle 36 | (Matchstick Puzzle)
- Puzzle 33 | ( Rs 500 Note Puzzle )
- Puzzle 31 | (Minimum cut Puzzle)
- Puzzle 29 | (Car Wheel Puzzle)

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.