[Math] Mathematical reasoning question

combinatoricscontest-math

I was giving a look at my country's mathematical olympiads, and I found this problem

If I want to color a $4\times 4$ grid with black and white squares, in how many ways
can I paint it such that every row and every column has 2 squares of each color?

After thinking for a while, I decided to code a program that gave me insights about the problem by reverse-engeneering the answer.No success.Aparently, the answer is $90$, but how does the mathematical way of doing this goes?

Best Answer

Another method is to recognise that, up to permutations of the rows and columns, there are only two inequivalent squares:

$$ \begin{array}{|cccc|} \hline 1 & 1 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 1 & 1 \\ \hline \end{array} \quad\quad\quad\text{and}\quad\quad\quad \begin{array}{|cccc|} \hline 1 & 1 & 0 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 0 & 1 & 1 \\ 1 & 0 & 0 & 1 \\ \hline \end{array} $$ These are the biadjacency matrices of the vertex-coloured bipartite graphs:

enter image description here $\quad\quad\quad\text{and}\quad\quad\quad$ enter image description here

respectively. So the number of such matrices is equal to the number of (vertex-coloured, labelled) graphs isomorphic to one of the two bipartite graphs above.

By the Orbit Stabiliser Theorem, we can compute the sizes of these isomorphism classes by computing the sizes of the automorphism groups (which can be done by hand). Thus, these have isomorphism classes of size:

$$\frac{4!^2}{2^5} \quad\quad\quad\text{and}\quad\quad\quad \frac{4!^2}{8}$$ respectively. These sum to $90$.

Related Question