Sotiri's Doku Squares

A Doku Square is an n × n n \times n array containing all integers from 0 0 to n 1 n-1 exactly once in each column and each row. The entry in the i i th row and j j th column of Doku Square A A is denoted by A i , j A_{i,j} .

We call two n × n n \times n Doku Squares A A and B B friendly if all n 2 n^2 ordered pairs ( A i , j , B i , j ) (A_{i,j},B_{i,j}) are distinct.

What is the maximum number of 73 × 73 73 \times 73 Doku Squares, such that any two of them are friendly?

This problem is shared by Sotiri K .

Details and assumptions

As an explicit example, the two squares 0 1 2 1 2 0 2 0 1 \begin{array} { | l | l | } \hline 0 & 1 & 2 \\ \hline 1 & 2 & 0 \\ \hline 2 & 0 & 1 \\ \hline \end{array} and 0 1 2 2 0 1 1 2 0 \begin{array} { | l | l | } \hline 0 & 1 & 2 \\ \hline 2 & 0 & 1 \\ \hline 1 & 2 & 0 \\ \hline \end{array}

are 2 friendly 3 × 3 3 \times 3 Doku squares.


The answer is 72.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Since there are still no solutions, I guess there's no harm in posting mine.

The solution boils down to answering two questions about Doku Squares (which will be referred to as DSs from now on). Firstly, is there an upper bound on the maximum number of n × n n \times n DSs that are pairwise-friendly, and secondly, if there is, which values of n n (if any) actually achieve that upper bound?

The first question has a fairly simple answer.

Lemma 1 An upper bound on the number of n × n n \times n DSs that are pairwise-friendly is n 1 n-1 .

Proof We note that taking any DS and permuting its elements (that is, taking every instance of i i in the DS and replacing it with j j and vice versa) will not change the fact that it is a DS. This means that we can make the first row of any DS be whatever we want it to be (by permuting multiple times), and from this point forward, we will call DSs that have their first row in increasing order "happy." That is, if A is a happy DS, then A 1 , 1 = 0 , A 1 , 2 = 1 , . . . , A 1 , n = n 1 A_{1,1}=0,A_{1,2}=1,...,A_{1,n}=n-1 .

We also note that these permutations preserve friendliness. This is because if we have (for example) the ordered pairs ( a , a ) , ( a , b ) , ( a , c ) , ( b , a ) , ( b , b ) , ( b , c ) , ( c , a ) , ( c , b ) , ( c , c ) (a,a),(a,b),(a,c),(b,a),(b,b),(b,c),(c,a),(c,b),(c,c) (which would be the ones generated by two friendly 3 × 3 3 \times 3 DSs, applying a permutation such as a c , c a , b b a \to c,c \to a,b \to b on one of them (say the first one) gives the ordered pairs ( c , a ) , ( c , b ) , ( c , c ) , ( b , a ) , ( b , b ) , ( b , c ) , ( a , a ) , ( a , b ) , ( a , c ) (c,a),(c,b),(c,c),(b,a),(b,b),(b,c),(a,a),(a,b),(a,c) , which is clearly the same set of ordered pairs, and so the permuted first DS is still friendly with the original second DS. This is important because it tells us that if we have a set of n × n n \times n DSs which are pairwise-friendly, we can make each of them happy and be sure that they are still all pairwise-friendly.

Let N N be a set of happy pairwise-friendly n × n n \times n DSs and let A , B A,B be members of N N . Looking at the first row of A A and B B , we find that ( A 1 , 1 , B 1 , 1 ) = ( 0 , 0 ) , . . . , ( A n , n , B n , n ) = ( n 1 , n 1 ) (A_{1,1},B_{1,1})=(0,0),...,(A_{n,n},B_{n,n})=(n-1,n-1) . Now let A 2 , 1 = a A_{2,1} = a . a a , of course, cannot be 0 0 , as 0 0 is already present in the first column of A A . But now note that B 2 , 1 B_{2,1} cannot be a a , as the ordered pair ( a , a ) (a,a) is already found by comparing the first rows of A A and B B . By extension, any two DSs in N N must have distinct elements in the cell ( 2 , 1 ) (2,1) , and this cell has n 1 n-1 possible values 1 , 2 , . . . , n 1 1,2,...,n-1 . Therefore, the set N N can't possibly have n n elements, and so n 1 n-1 is an upper bound on the maximum number of pairwise-friendly n × n n \times n DSs. \square

\\

Now that we've established that there is, in fact, an upper bound, we proceed to find values which achieve this upper bound. We will show that for all primes p > 2 p > 2 , there is a set of p 1 p-1 pairwise-friendly p × p p \times p DSs.

Lemma 2 If p > 2 p>2 is a prime, there exists a set of p 1 p-1 pairwise-friendly DSs.

Proof We will construct the set we want, thus proving its existence.

Consider a set S S of p 1 p-1 empty p × p p \times p arrays numbered from 1 1 to p 1 p-1 . Let S t S^t represent the array in the t t th position in the set.

We proceed by filling in all the elements of S S in the following manner: 1 i , j p , S ( i , j ) t = i t + j ( m o d p ) \forall 1 \leq i,j \leq p,S^t_{(i,j)}=i \cdot t + j \pmod{p} . It is evident that the only numbers we can have in the array are the integers from 0 to p−1.

First, let's confirm that t , S t \forall t,S^t is, in fact, a DS. It suffices to show that if i t + j i t + j ( m o d p ) i \cdot t + j \equiv i' \cdot t + j' \pmod{p} and i = i i = i' , then j = j j = j' and vice versa. Essentially, if we have two of some value in the same row, then they are also in the same column (which means they are the same position).

i t + j i t + j ( m o d p ) t ( i i ) j j ( m o d p ) i \cdot t + j \equiv i' \cdot t + j' \pmod{p} \to t(i - i') \equiv j-j \pmod{p} . We remind ourselves that t 0 t \neq 0 . If we let either j j j' - j or i i i - i' be 0 0 modulo p p (which means they equal 0 since they are less than p p in absolute value), then the other must also equal 0 (again, because they are less than p p , and the fact that p is prime guarantees that we won't have t ( i i ) = p 0 t(i-i′) = p \neq 0 ). Therefore, if the value of two positions in the same row/column are the same, they are the same position, and so all the S t S^t are DSs.

Finally, we want to show that all the S t S^t are pairwise-friendly. Consider S a S^a and S a S^{a'} with a a a \neq a' . We want the following to be true: if i a + j i a + j ( m o d p ) i \cdot a + j \equiv i' \cdot a + j' \pmod{p} and i a + j i a + j ( m o d p ) i \cdot a' + j \equiv i' \cdot a' + j' \pmod{p} , then i = i i = i' and j = j j = j' . Essentially, if we pick two sets of corresponding positions in S a S^a and S a S^{a'} and they end up corresponding to the same ordered pair, they are the same corresponding positions.

i a + j i a + j ( m o d p ) a ( i i ) j j ( m o d p ) i \cdot a + j \equiv i' \cdot a + j' \pmod{p} \to a(i - i') \equiv j'-j \pmod{p} and i a + j i a + j ( m o d p ) a ( i i ) j j ( m o d p ) i \cdot a' + j \equiv i' \cdot a' + j' \pmod{p} \to a'(i - i') \equiv j'-j \pmod{p} . Then we have a ( i i ) a ( i i ) ( m o d p ) a'(i - i') \equiv a(i - i') \pmod{p} by the transitive property of congruence. But we know that a a a \neq a' and so i i 0 ( m o d p ) i = i i - i' \equiv 0 \pmod{p} \to i = i' and then j = j j = j' (because once again all of i , j , i , j , a , a p i, j, i', j', a, a' \leq p ). Thus, if two sets of corresponding positions make the same ordered pair, the two sets are the same.

This result proves that all the S t S^t are, in fact, pairwise-friendly, and therefore, there is a set of p 1 p-1 pairwise-friendly p × p p \times p DSs. \square

\\

Therefore, for any prime p > 2 p > 2 , we have that the maximum number of pairwise friendly p × p p \times p DSs is equal to p 1 p -1 , and so because 73 73 is a prime, the answer is 73 1 = 72 73 - 1 = \fbox{72} .

\\

Further information: The Doku Squares in this problem are, in fact, well-known objects in mathematics called Latin Squares. "Friendly" Latin Squares are called "orthogonal." The result presented in this solution about all primes can actually be extended to all prime powers, but for a general composite number n n , the maximum number of n × n n \times n orthogonal Latin Squares is not known.

Moderator note:

Great job!

In the literature, Friendly Doku squares are also known as Orthogonal Latin Squares.

Oh, your solution made my day :) Well done

Fariz Azmi Pratama - 7 years, 9 months ago

Log in to reply

Thanks a lot :)

Sotiri Komissopoulos - 7 years, 9 months ago

I'm very much impressed by your proof! It's very clear and well structured. Thanks for the good read!

Nitpicking: there's an apostrophe missing in the 10th line of the proof of lemma 2 (it currently says j j j-j where it should say j j j'-j ).

Ton de Moree - 7 years, 9 months ago

Log in to reply

Thanks and you're very welcome! :) I had already written most of it for when I submitted the problem, but I added a lot of narration to make it clearer.

ARGHHHHHH stupid apostrophe! Oh well. Thanks for pointing it out. I also made another minor mistake in the second line of the third paragraph of the proof of lemma 1, where I said "members of M M " rather than "members of N N ". :P

Sotiri Komissopoulos - 7 years, 9 months ago

Amazing solution. Really well done Sotiri :)

Ivan Sekovanić - 7 years, 9 months ago

Log in to reply

Thanks! :) I'm glad you liked it and I hope you enjoyed the problem, too!

Sotiri Komissopoulos - 7 years, 9 months ago

Log in to reply

I enjoyed it really much, although I was unable to provide a thorough proof as you did. Keep these coming! :)

Ivan Sekovanić - 7 years, 9 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...