Painting chess board
I'll just give some hints that will allow you to easily deduce the formula that user14111 gave in a comment. Call any pair of adjacent squares a domino, which can be horizontal or vertical. Call two dominos neighbours if their union is a $2\times2$ square. Call a domino monochromatic for a colouring if its squares have the same colour.
- If a colouring has some monochromatic domino, then so is any neighbour of it (and it has the opposite colour).
- If there is any monochromatic hoizontal domino, then there is one in each row (in the same pair of columns)
- If there is any monochromatic vertical domino, then there is one in each column (in the same pair of rows).
- Both these conditions cannot be met simultaneously.
- Therefore it suffices to count the following cases, and add up the results:
- There is at least one monochromatic horizontal domino
- There is at least one monochromatic vertical domino
- There are no monochromatic dominoes.
- A solution for case 1. is completely determined by the colouring of its first row, a solution for case 2. is completely determined by the colouring of its first column, and a solution for case 3. is completely determined by the colouring of its top-left corner square.
For an $m\times n$ chessboard there are $2^m+2^n-2$ ways.
Case I. There are two horizontally adjacent squares of the same color: $2^m-2$ ways.
Case II. There are two vertically adjacent squares of the same color: $2^n-2$ ways.
Case III. None of the above: $2$ ways.
Hint for Case I: There are $2^m-2$ ways to color one row so that two adjacent squares have the same color. The rest of the coloring is determined from that; colors must alternate in each column. (Note, therefore, that Cases I and II do not overlap.)