Given $2018 \times 4$ grids and tint them with red and blue. So that each row and each column...

173 Views Asked by At

Given $2018 \times 4$ grids and tint them with red and blue. So that each row and each column has the same number of red and blue grids, respectively. Suppose there're $M$ ways to tint the grids with the mentioned requirement. Determine $M \pmod {2018}$.

Solution?: Each column can be colored such as $$(R,R,B,B),(R,B,R,B),(R,B,B,R),$$$$(B,B,R,R),(B,R,B,R),(B,R,R,B)$$ Say the column colorings appears $a,b,c,a',b',c'$ respectively.

Clearly we must have $a+b+c= a'+b'+c'$ since $R$ appears the same times as $B$ in first row. Simillary we have $a+b'+c' = a'+b+c$ which implies $a=a'$. The same is true for $b=b'$ and $c=c'$. So we have that $a+b+c=1009$ and thus $$M =\sum_{a+b+c=1009}\frac{2018!}{a!^2b!^2c!^2} \equiv ?\pmod{2018}$$

Edit: after Ross Millikan answer.

My question here is: is this is correct and seeking for an alternative solution via generating functions.

3

There are 3 best solutions below

3
On

As I read the problem this is not correct. Once you have $a,b,c$ which sum to $1009$ you still need to choose the $a$ columns of type $a$ etc. This gives $$\frac {2018!}{a!^2b!^2c!^2}$$ ways for each choice of $a,b,c$

Now argue that this is equivalent to $0 \pmod {2018}$ unless one of $a,b,c=1009$ because you have two extra factors of $1009$ in the numerator and plenty of $2$s as well, so we want $$3\frac{2018!}{1009!^2} \pmod {2018}$$

1
On

This is only a response to if your way of thinking about the problem is correct.

Let's consider this a slightly different way:

$$\hat{v_1} = \begin{pmatrix}R \\ R \\ B \\ B\end{pmatrix}, \hat{v_2} = \begin{pmatrix}R \\ B \\ R \\ B\end{pmatrix}, \hat{v_3} = \begin{pmatrix}R \\ B \\ B \\ R\end{pmatrix}, \hat{v_4} = \begin{pmatrix}B \\ R \\ R \\ B\end{pmatrix}, \hat{v_5} = \begin{pmatrix}B \\ R \\ B \\ R\end{pmatrix}, \hat{v_6} = \begin{pmatrix}B \\ B \\ R \\ R\end{pmatrix}$$

Then let $v_i$ be the number of columns of type $\hat{v_i}$.

We have:

$$\sum_{i=1}^6 v_i = 2018$$

$$v_1+v_2+v_3=v_4+v_5+v_6$$

$$v_1+v_4+v_5=v_2+v_3+v_6$$

$$v_2+v_4+v_6=v_1+v_3+v_5$$

$$v_3+v_5+v_6=v_1+v_2+v_4$$

This is five equations in six variables.

In augmented matrix form:

$$\left[\begin{array}{cccccc|c}1 & 1 & 1 & 1 & 1 & 1 & 2018 \\ 1 & 1 & 1 & -1 & -1 & -1 & 0 \\ 1 & -1 & -1 & 1 & 1 & -1 & 0 \\ -1 & 1 & -1 & 1 & -1 & 1 & 0 \\ -1 & -1 & 1 & -1 & 1 & 1 & 0\end{array} \right]$$

And according to Wolframalpha, in Row Echelon form:

$$\left[ \begin{array}{cccccc|c}1 & 0 & 0 & 0 & 0 & -1 & 0 \\ 0 & 1 & 0 & 0 & -1 & 0 & 0 \\ 0 & 0 & 1 & -1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 1 & 1 & 1009 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0\end{array}\right]$$

So, this looks conclusive that your assumption was correct.

I do not have a solution involving generating functions, though.

Edit: Wolframalpha did find a closed form for this, though:

$$\sum_{a+b+c=n} \dfrac{(2n)!}{(a!)^2(b!)^2(c!)^2} = \dfrac{16^n\Gamma\left(n+\dfrac{1}{2}\right)^2 {_3}F_2\left(-n,-n,-n;1,\dfrac{1}{2}-n;\dfrac{1}{4}\right)}{\pi \Gamma (n+1)^2}$$

1
On

We are required to count the number of colourings of a $2018 \times 4$ grid with two colours (red & blue). Well not quite count them all ... just calculate how many there are modulo $2018$. (... Oh yes, forgot to mention the equal number of blues & reds in each row & column constraint).

You state the $6$ possible configurations for each column in your solution and these will be useful later. But we shall first consider the rows.

The first row can be chosen in $ \binom{2018}{1009}$ ways. The second row can also be chosen in $ \binom{2018}{1009}$ ways. but we cannot simply choose the third & fourth rows like this, indeed looking at the $6$ possible configurations for the columns shows that there are two possibilities. EITHER the first two entries are the same colour and so the third & fourth entries will need to be the other colour OR they are different colours and then third & fourth entries will also need to be different colours. So given the first row, we need to keep track of how many colours are the same or different in the second row; how will we do this ? ... remember the combinatorial identity \begin{eqnarray*} \sum_{i=0}^{n} \binom{n}{i}^2= \binom{2n}{n}. \end{eqnarray*} This identity counts how many pairs need to be toggled to get from one binary string with an equal number of $1$'s & $0$'s to another. Now in our situation there will be $2i$ place where the first two colours are different & then the third and fourth are also different. Half of these $2i$ can be chosen arbitarily and the other half will be forced in order to ensure the third & fourth rows have equal numbers of each colour. So the total number of configurations is \begin{eqnarray*} \binom{2018}{1009} \sum_{i=0}^{1009} \binom{1009}{i}^2 2^i. \end{eqnarray*} But we only want this value modulo $2018$ ... & at this point we consult Wolfy https://www.wolframalpha.com/input/?i=+binom%282018%2C1009%29+sum%28+binom%281009%2Ci%29%5E2+2%5Ei%2C%7Bi%2C0%2C1009%7D%29+mod+2018 So the answer to the question is $\color{red}{6}$.