Linear Algebra used to solve hotel room light switch question There is a special suite of rooms designed with light switches in an odd way.  Our goal is to turn off all of the the lights.
There are 25 rooms in the suite arranged in a square of five by five rooms:

1  2  3  4  5 

6  7  8  9  10

21 22 13 14 15

16 17 18 19 20

21 22 23 24 25

If you switch the light switch in any room, it toggles the lights in the adjacent room.  For example,
-assuming all of the lights are on and you switch the switch in room 1, the lights in room 2 and 6 are turned off and there is no other change in the status of the lights.
-or assuming all of the light are on and you switch the switch in room 18, the lights in room 13, 17, 19, 23 are all turned off and there is no other change in the status of the lights.


*

*Assuming all of the lights are on, please advise on how to turn off all of the lights.  You can use a web app for row reduction.

*Assuming all of the lights in even number rooms are on, please advise on how to turn off all of the lights.
After row reduction, we get a free column where, 
$$x_4 =  t$$
$$x_1 = -2 + t$$
$$x_2 =  2 - t$$
$$x_3 =  1 - t$$
Can anyone help out with the rest?  
 A: I will solve the simpler $2 \times 2$ case, but the technique is the same for  $5 \times 5$
So we have a matrix
$$
\begin{pmatrix}
a_1 & a_2 \\
a_3 & a_4
\end{pmatrix}
$$
Where each $a_i$ is a hotel room. To show whether the light in the room is on or off, we will let $a_i \in \mathbb{Z}_2$
By your description of the problem, turning on the light in each room results in the following configurations
$$
A_1 = \begin{pmatrix}
      1 & 1 \\
      1 & 0
      \end{pmatrix} \\
A_2 = \begin{pmatrix}
      1 & 1 \\
      0 & 1
      \end{pmatrix} \\
A_3 = \begin{pmatrix}
      1 & 0 \\
      1 & 1
      \end{pmatrix} \\
A_4 = \begin{pmatrix}
      0 & 1 \\
      1 & 1
      \end{pmatrix}
$$
Now we want to find a linear combination of $ \left \{ A_1, A_2, A_3, A_4 \right \} $ such that
$$
\sum_{i}c_iA_i = \begin{pmatrix}
                 1 & 1 \\
                 1 & 1
                 \end{pmatrix}
$$
This involves solving a linear system of 4 equation in 4 unknowns
$$
\begin{pmatrix}
1 & 1 & 1 & 0 \\
1 & 1 & 0 & 1 \\
1 & 0 & 1 & 1 \\
0 & 1 & 1 & 1
\end{pmatrix}
\cdot
\begin{pmatrix}
c_1 \\
c_2 \\
c_3 \\
c_4
\end{pmatrix}
=
\begin{pmatrix}
1 \\
1 \\
1 \\
1
\end{pmatrix}
$$
Solving this system gives
$$
\mathbf{c} = \begin{pmatrix}
             1 \\
             1 \\
             1 \\
             1
             \end{pmatrix}
$$
So for the simple $2 \times 2$ case if we just flip each switch once we will turn off all of the lights.
