## Domino Magic Square

Consider a small set of dominoes with only one, two, or three dots on each side. A full set then contains only six dominoes: 1-1, 1-2, 1-3, 2-2, 2-3, 3-3. Take one full set plus two duplicate dominoes from a second set. Lay the eight dominoes into a four-by-four grid such that the sum of the dots in any row, column, or major diagonal is the same. You may choose any two dominoes from the second set, as long as they are different.

I know of solutions for at least two different pairs of duplicate dominoes.

#### Source: Original. Used in "Ken's Puzzle of the Day" March 2, 1995

Solution:
The sum of all the dots on the original six dominoes is 24. Adding two more dominoes could add as much as 11 (3-3, 3-2) and as little as 5 (1-1, 1-2). The total sum must still be divisible by 4, though, since there are four rows in the diagram, so the duplicate dominoes must have a total of 8 dots. This can only happen with the pairs (1-1, 3-3), (1-2, 2-3), (1-3, 2-2).
 ```1-1 3-3 2-3 2-1 3-1 2-2 2-3 1-2 ``` Lynne Onitsuka found this solution. The duplicate dominoes are 1-2 and 2-3. ```1-2 3-2 3-3 1-1 1-2 2-3 3-1 2-2 ``` A variation that I found with the same duplicates.

On 10/17/97, I received the following from Wilfred Theunissen. He says his program found 31 total possible solutions, disregarding flips and rotations.
```Dear Ken,

The right answer to this problem is here.

If we add the 1-1 and 3-3 from the second grid, there's only one
solution! This one is:

+++++++++
+1 1+3 3+
+++++++++
+2+3+1 2+
+ + +++++
+2+1+3 2+
+++++++++
+3 3+1 1+
+++++++++

Any other solution with a 1-1 and a 3-3 added, is a rotation or a
mirroring from this solution.

If we add the 1-3 and 2-2 from the second grid, no solutions are found
by my program, so there aren't any solutions.

With the 1-2 and the 2-3 added, my program found 30 different solutions.

this
+++++++++
+1 1+3 3+
+++++++++
+3 2+1+2+
+++++ + +
+2 2+3+1+
+++++++++
+2 3+1 2+
+++++++++

and
+++++++++
+3 2+1 2+
+++++++++
+1 1+3 3+
+++++++++
+3+2 2+1+
+ +++++ +
+1+3 2+2+
+++++++++

and
+++++++++
+1 3+1+3+
+++++ + +
+3 2+1+2+
+++++++++
+2+2+3+1+
+ + + + +
+2+1+3+2+
+++++++++

are 3 of them.```

On 8/17/97, I received the following from Kirk Bresniker. He says it's complete, but I wonder if a different configuration of dominos might still yield another solution. (This is why I haven't yet marked this puzzle as completely solved.)
```Ken,

Here's output of a program that calculates all the eight magic squares:
[I think these are the solutions for this particular configuration of
dominos.  Wilfred, above, shows other configurations, too. - KD]

equi-sum=8                     /* this is the one Lynne found */
1 - 1   3 - 3
2 - 3   2 - 1
3 - 1   2 - 2
2 - 3   1 - 2

equi-sum=8
1 - 1   3 - 3
3 - 2   1 - 2
2 - 2   3 - 1
2 - 3   1 - 2

equi-sum=8                      /* this is the variant you found */
3 - 1   2 - 2
1 - 2   2 - 3
3 - 3   1 - 1
1 - 2   3 - 2

equi-sum=8
1 - 3   2 - 2
3 - 2   2 - 1
1 - 1   3 - 3
3 - 2   1 - 2

equi-sum=8
2 - 2   3 - 1
1 - 2   2 - 3
3 - 3   1 - 1
2 - 1   2 - 3

equi-sum=8
2 - 2   1 - 3
3 - 2   2 - 1
1 - 1   3 - 3
2 - 3   2 - 1

equi-sum=8
3 - 3   1 - 1
2 - 1   2 - 3
1 - 3   2 - 2
2 - 1   3 - 2

equi-sum=8
3 - 3   1 - 1
1 - 2   3 - 2
2 - 2   1 - 3
2 - 1   3 - 2
```

On 8/19/97, Craig Gentry sent the following analysis:
```You wouldn't think that such a complicated problem has a somewhat
elegant solution, but it does.  First, the grid must have either four or
six 2's, because there must be an even number of 2's among the two extra
dominoes and because four or more 2's among the extras is impossible.
Assume there are four 2's.  For the moment, we'll ignore the diagonals
and just try to configure the rows and columns so that they all have a
total of 8.  Also, we'll consider two grids to be equivalent if you can
transform the first into the second through a series of row and/or
column switches.  Then, any grid that is a solution is equivalent to a
grid in which all four 2's are in the upper left quadrant, because the
only way for each row and each column to have an even number of 2's (a
necessary condition) is for exactly two rows to have exactly two 2's and
exactly two columns to have exactly two 2's.  Up to equivalence, the
upper right quadrant can be either
13      or      13
13              31.
If the former, the bottom half, up to equivalence, is:
1331
3131,
so that the overall grid looks like:
2213
2213
1331            Grid #1
3131.
If the latter, the bottom half, up to equivalence, is:
1313
3131,
so that the overall grid looks like:
2213
2231            Grid #2
1313
3131.
Now we start to worry about the diagonals.  We will adopt the following
notation: "wxyz" is the foursome comprising the number in the first
column and wth row (from the top), that in the second column and xth
row, third column yth row, fourth column zth row.  So, "1234" is the
diagonal running from the upper left to the lower right.
Consider Grid #1.  We want to find all sets of four numbers from that
Grid such that their sum is 8 and no two of the numbers are in the same
row or column.    For Grid #1, the following acceptable foursomes have a
total of 8:
1234    1243    2134    2143.
{{Parenthetical.  Suppose you put the two main diagonals through a
series of row and column operations.  If the first diagonal now looks
like wxyz, then the other diagonal has 3 possible configurations: xwzy,
yzwx, or zyxw.  This is left as an exercise to the reader.}}
The following two pairs can be complementary diagonals:
(1234, 2143) and (1243, 2134).
Recognizing that we have to put the 2's together to create a 2-2 domino,
we create from these pairs (I won't belabor the process), the following
grid, which is unique up to flips and rotations:
3131
1223
1223
3311.
However, this grid is not divisible into an permissible set of dominoes.
For Grid #2, the following foursomes have a total of 8:
3421    4312.
As complementary diagonals, they create 2 grids:
3221            3221
1133    and     3131
3311            1313
1223            1223.
The first is not divisible into dominoes, but the second is:
abbc
efgh
efgh.
Through flips and rotations, 4 different grids are created.

If the grid has six 2's, then exactly three rows have exactly two 2's
and exactly three columns have exactly two 2's.  Therefore, all
solutions with six 2's are equivalent to:
2213
2321
1223
3131,
where equivalents includes not only row and column switches, but also a
1 <-> 3 transformation where all 1's are changed to 3's and vice versa.
The acceptable foursomes for diagonals are:
1234    1423    4132    2431.
Only the pair (1423, 4132) can be complementary diagonals.  We get two
grids, which generate many more solutions:
2213            2132
1223    and     2231
3131            3212
2321            1313.
The first grid can be divided into dominoes in 7 different ways, which
because it can also be flipped, rotated, and 1 <-> 3'ed, generates 7x16
= 112 solutions.  The second can be divided into dominoes in two ways,
for 32 solutions.  Altogether, unless I've made an error somewhere,
there are 112 + 32 + 4 = 148 solutions.  So much for elegance.

-Craig Gentry

```

Mail to Ken