First we make some useful observations that will simplify the problem:
* The order in which the buttons are pressed is not relevant to the final state. We only care about the number of times each button was pressed.
* Since pressing the same button twice makes no changes, we can assume that each button was pressed 0 or 1 times.
a. The answer is no. We proceed by contradiction. Suppose that there is a way to turn every lamp on after pressing some buttons.
We denote by a,b,c,d,e,f,g,h,i the number of times each button was pressed, as shown in the figure.
Since the upper left corner cell must be turned on, we know that b+d must be odd. Also, since the lower right cell must be turned on, we have that f+h must be odd. This means that b+d+f+h must be even. On the other hand, since the central cell must be turned on, b+d+f+h has to be odd, but this is a contradiction. Therefore, it is not possible to ensure that all lamps are turned on after pressing some buttons.
b. We start by observing that there are
29 ways to press the buttons, since each of the nine buttons can be pressed 0 or 1 times. However, this does not mean that there are
29 different board states that can be achieved, because there may be repetitions. So let's find out, for any given board state, how many times it appears among those
29 results.
To do that, given a fixed board state, we need to count in how many ways we can press the buttons to return to the original board state at the end. Suppose that we press a sequence of buttons that returns to the original board state, where we name
a,b,c,d,e,f,g,h,i the number of times each button was pressed as we did in (a). For the corner cells to return to their original state, we need
b+d,d+h,h+f, and
f+b to be even. This happens if and only if
b,d,h,f have the same parity, and since their possible values are 0 or 1, they must be equal. Note that this also implies that the central cell returns to its original state after pressing the buttons, since
b+d+h+f=4b is even.
On the other hand, since the neighbors of the central cell must also return to their initial state, we need
a+c+e,c+e+i,g+e+i and
a+e+g to be even. Subtracting
(a+c+e)−(c+e+i)=a−i we get that
a has the same parity as
i, so
a=i. Similarly, we get
c=g and also that
e has the same parity as
a+c.
We conclude that if we choose
a,b and
c arbitrarily, we can fix the other numbers to satisfy the conditions needed to return to the original board state after pressing the buttons, so every fixed board state appears
23 times in the
29 possible results after pressing buttons. Therefore, there are
2329=26 different board states that can be achieved.