11
$\begingroup$

In how many ways can a $4 \times 4$ square grid be coloured using four different colours so that no colour is repeated in any row, column, or along the two main diagonals. For clarity, one valid solution to this problem is shown below.

enter image description here

I am after unique solutions, so:

  1. rotations of the grid through angles of $90^\circ, 180^\circ$, and $270^\circ$, and
  2. reflections about the horizontal, vertical, and the two main diagonals

are not considered different.

I am guessing this problem is perhaps well known, so I apologise in advance, but have not been able to make much progress towards its solution. It may even go by a well known name, making it easier to identify, and if this is indeed the case I would be interested in knowing what it is called.

$\endgroup$
  • $\begingroup$ So reflections are not count right? $\endgroup$ – Trần Thúc Minh Trí Apr 27 '18 at 6:12
  • $\begingroup$ Yes, I should have added this. No reflections either. $\endgroup$ – omegadot Apr 27 '18 at 6:16
  • 1
    $\begingroup$ All different rotations and reflections of one grid must be unequal because all the corner tiles must have different colours. So the number of different colourings with rotations/reflections considered distinct is 8 times the binder of colourings with them considered not distinct. I think it's easiest to count of we first consider them distinct. $\endgroup$ – Arthur Apr 27 '18 at 6:17
  • 1
    $\begingroup$ This might help you. $\endgroup$ – Thomas Bladt Apr 27 '18 at 6:17
  • $\begingroup$ First, there are 16 ways to paint with one colour. once this color is chosen, now we have 6 remaining spots to paint with the other colours, pick one and then for the third one only 2 spots are available. We have then $16 \cdot 6 \cdot 2 $ ways to paint $\endgroup$ – James Apr 27 '18 at 6:19
8
$\begingroup$

Your requirements for the placement of colors is equivalent to the requirements for a diagonal Latin square, or as it used to be called, a double diagonal Latin square. According to OEIS, there are just $48$ diagonal Latin squares of order $4$, i.e. of size $4$ x $4$.

As @Arthur pointed out, if rotations and reflections are not considered distinct, we must divide this number by $8$. Hence, there are just $6$ distinct solutions.

EDIT

Just made a brute force program to check that I was right, and it gave the answer $12$, not $6$. Manual checking of the program's answer seems to show the program is correct. Here is the program's answer:

enter image description here

None of these appear to be rotations or reflections of each other. What did I miss?

EDIT 2

As @omegadot points out, the solutions above include reflections about the main diagonals. Removing these cases gives the following:

enter image description here

$\endgroup$
  • 2
    $\begingroup$ Reflections about the main diagonals. For example, the two squares appearing in the top left corner are reflections of each other about the main diagonal running from the top left to bottom right. Remove these and you will get your 6. Great solution by way! $\endgroup$ – omegadot Apr 27 '18 at 13:21
  • $\begingroup$ @omegadot: Thanks! Reflections now removed. $\endgroup$ – Jens Apr 27 '18 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.