# the number of ways of shading a grid

In how many ways can we shade exactly two squares of the nine squares on a $3\times 3$ grid such that the two shaded squares have no side in common?

• Couldn't you just count? The answer is 16. – ghosts_in_the_code Dec 3 '14 at 9:53

there are $9\choose 2$ ways of selecting 2 squares in a $3 \times 3$ grid

this is $\frac{9!}{2!7!} = \frac{9\times 8}{2} = 9 \times 4 = 36$

now you can count how many different ways there are where 2 squares touch for example: if we label the squares as follows:

S1 S2 S3

S4 S5 S6

S7 S8 S9

then there are 12 combinations where the squares share a common side, can you see it? It's quite easy to count seeing as the grid is only 9 squares

now the answer is $36 - 12 = 24$

• Yes, I see. For the $4\times 4$ grid, my ans is 96. – Thumbolt Dec 3 '14 at 15:07
• Yes, I accepted it. Then I used your idea to solve the $4\times 4$ grid. – Thumbolt Dec 3 '14 at 15:29