The Rotating Square

On the table in front of you there is a square with 4 coins placed on its vertices. You are blindfolded and are given the task to turn all of the coins with either heads up or tails up. Every time you turn few of the coins however, the square rotates arbitrarily on the table. Find a strategy, such that no matter the starting arrangement of the coins and no matter how the square rotates after every flip of coins, eventually you will turn all of the coins with the same face up.


First assume that there is even number of tails and even number of heads on the table - 2 of each kind. Flip 2 opposite coins. If after that not all coins have the same face up, the coins' faces along the square's corners show T-T-H-H. Now flip 2 adjacent coins. If after that not all coins have the same face up, the coins' faces along the square's corners show T-H-T-H. Now flip again 2 opposite coins and you are done.

Next assume that there were intially odd number of tails and odd number of heads on the table. Then after applying the moves described above, flip one of the coins upside down. Now there is even number of heads and even number of tails on the table, so you can repeat the same procedure and accomplish the task.