Maths Olympiad Prep

Library / /269 of 377

Combinatorics Difficulty 5.4 AIME, harder Prove it United States

Problem:

How many ways can one color the squares of a 6×66 \times 6 grid red and blue such that the number of red squares in each row and column is exactly 22?

Solution

Solution:

Answer: 6795067950

Assume the grid is n×nn \times n. Let f(n)f(n) denote the number of ways to color exactly two squares in each row and column red. So f(1)=0f(1)=0 and f(2)=1f(2)=1. We note that coloring two squares red in each row and column partitions the set 1,2,,n1,2, \ldots, n into cycles such that ii is in the same cycle as, and adjacent to, jj iff column ii and column jj have a red square in the same row. Each ii is adjacent to two others (or the same one twice in a 22-cycle).

Now consider the cycle containing 11, and let it have size kk. There are (n2)\binom{n}{2} ways to color two squares red in the first column. Now we let the column that is red in the same row as the top ball in the first column be the next number in the cycle. There are n1n-1 ways to pick this column, and n2n-2 ways to pick the second red square in this column (unless k=2k=2). Then there are (n2)(n3)(n-2)(n-3) ways to pick the red squares in the third column, and (nj)(nj+1)(n-j)(n-j+1) ways to pick the jjth ones for jk1j \leq k-1. Then when we pick the kkth column, the last one in the cycle, it has to be red in the same row as the second red square in column 11, so there are just nk+1n-k+1 choices. Therefore, if the cycle has length kk there are
n(n1)2×(n1)(n2)××(nk+1)(nk+2)×(nk+1) \frac{n(n-1)}{2} \times (n-1)(n-2) \times \ldots \times (n-k+1)(n-k+2) \times (n-k+1)
ways, which equals:
n!(n1)!2(nk)!(nk)!. \frac{n!(n-1)!}{2(n-k)!(n-k)!}.
Summing over the size of the cycle containing the first column, we get
f(n)=k=2n12f(nk)n!(n1)!(nk)!(nk)!2nf(n)n!n!=k=2nf(nk)(nk)!(nk)!2nf(n)n!n!2(n1)f(n1)(n1)!(n1)!=f(n2)(n2)!(n2)! \begin{gathered} f(n)=\sum_{k=2}^{n} \frac{1}{2} f(n-k) \frac{n!(n-1)!}{(n-k)!(n-k)!} \\ \frac{2 n f(n)}{n!n!}=\sum_{k=2}^{n} \frac{f(n-k)}{(n-k)!(n-k)!} \\ \frac{2 n f(n)}{n!n!}-\frac{2(n-1) f(n-1)}{(n-1)!(n-1)!}=\frac{f(n-2)}{(n-2)!(n-2)!} \end{gathered}
We thus obtain the recursion:
f(n)=n(n1)f(n1)+n(n1)22f(n2) f(n)=n(n-1) f(n-1)+\frac{n(n-1)^{2}}{2} f(n-2)
Then we get:
f(1)=0f(2)=1f(3)=6f(4)=12×6+18=90f(5)=20×90+40×6=2040f(6)=30×2040+75×90=67950 \begin{aligned} & f(1)=0 \\ & f(2)=1 \\ & f(3)=6 \\ & f(4)=12 \times 6+18=90 \\ & f(5)=20 \times 90+40 \times 6=2040 \\ & f(6)=30 \times 2040+75 \times 90=67950 \end{aligned}

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.