Problem:
Each square in a grid is colored black or white. Let be the number of ways this can be done in such a way that no five squares in an 'X' configuration (as shown by the black squares below) are all white or all black. Determine .

Problem:
Each square in a grid is colored black or white. Let be the number of ways this can be done in such a way that no five squares in an 'X' configuration (as shown by the black squares below) are all white or all black. Determine .

Solution:
Note that we may label half of the cells in our board the number and the other half , in such a way that squares labeled are adjacent only to squares labeled and vice versa. In other words, we make this labeling in a 'checkerboard' pattern. Since cells in an 'X' formation are all labeled with the same number, the number of ways to color the cells labeled is , and the same is true of coloring the cells labeled .
Let be the number of ways to color the squares labeled in a by grid without a monochromatic 'X' formation; we want to find . Without loss of generality, let the rightmost column of our grid have two cells labeled . Let be the number of such colorings on a by grid which do not have two black squares in the rightmost column and do not contain a monochromatic 'X', which we note is also the number of such colorings which do not have two white squares in the rightmost column.
Now, we will establish a recursion on and . We have two cases:
- Case 1: All three squares in the last two columns are the same color. For , there are ways to color these last three squares, and for there is way to color them. Then, we see that there are ways to color the remaining columns.
- Case 2: The last three squares are not all the same color. For , there are ways to color the last three squares, and for there are ways to color them. Then, there are ways to color the remaining columns.
Consequently, we get the recursions and . From the first equation, we get that . Plugging this into the second equation results in the recursion
Now, we can easily see that and , so we compute .