# The Anti-Magic Square Project: Construction

Madachy asks "Are there any systematic methods by which antimagic squares may be constructed?" It seems that up until now, no such method was known. Here, we present several constructions discovered this summer. ## How to Border an Antimagic Square

Bordering an antimagic square to produce a larger antimagic square is only slightly more difficult than bordering a magic square to produce a larger magic square, at least in the even case. Since examples are easier to understand than ultra-formal incomprehensible math-speak we'll give some examples, and since magic squares often illustrate the concepts more clearly we'll start with these.

### Differences and Relative Entries

Consider the problem of bordering a MS(6) (magic square of order 6) to produce a MS(8). The MS(6) uses numbers 1 to 36, and a MS(8) uses numbers 1 to 64. The magic constants for these squares are 111 and 260 respectively. Now given any 8 x 8 square filled with the numbers 1 to 64 and a row sum, r, we measure how far r is from the magic constant 260 by taking the difference 260-r. We can do this for all the row sums, column sums and diagonal sum to get a total of 18 differences . For a MS(8) all 18 differences are 0. The average size of an entry in a MS(8) is 32.5, and the relative value of a number x between 1 and 64 (inclusive) is the difference x-32.5. So the relative value of 1 is -31.5, and the relative value of 40 is 7.5. If we add up the relative values of all of the entries in a row of a square (magic or not!) we get the difference associated with that row; and similarly for columns and diagonals. ### Bordering a Magic Square

Now to begin the construction. Take a MS(6) and add 14 (= 2*6+2) to each of the entries. This gives a 6 x 6 square filled with numbers 15 to 50. Place this square in the center of an empty 8 x 8 square. Notice that if we add the relative values in any row, column or diagonal of the 6 x 6 subsquare we get 0, which says that the sums in the subsquare contribute to the sums of the larger square just as if the 6 x 6 subsquare were entirely filled with the average entry. There are 28 empty cells left to be filled, this is the border , and we are to fill it with the numbers 1 to 14 and 51 to 64. Write down these numbers in two columns as in figure 1.

The red numbers are small and the blue numbers are big, but if we add a red and a blue that are beside each other then the sum is exactly what two average entries would give us, that is the sum of the relative values is 0. If we put a number into an empty corner cell, say we put 6 into the upper right corener, cell (1,8), then we agree to put the number it is paired with, 59 , in the opposite corner, cell (8,1) (bottom left). This ensures that the differences on the diagonals will be 0, since the diagonals on the 6 x 6 subsquare already have differences 0. If we put a number into an empty cell that is not a corner cell, say we put 53 into cell (1,5), then we agree to put the number it is paired with, 12, in the opposite border cell which in this case is cell (8,5). This ensures that the differences in rows 2 to 7 and columns 2 to 7 will be 0, since the rows and columns of the 6 x 6 subsquare already have differences 0. The only difficulty now is to ensure that rows 1 and 8, and also columns 1 and 8 each have difference 0.

There is a nice way to visually keep track of the process of trying to get the last 4 differences to work out to 0. Let's say we are trying to make row 1 add to 0. If we put 1 and 63 (somewhere) in the first row then we see that the relative values add up to -32.5 + 31.5 = -1 . This is exactly the slope of a line drawn from 1 to 63: the "rise" is -1 and the "run" is +1, so slope= rise/run = -1. This works for any two numbers of different colors; so if we put 13 and 54 in the same row of the border then they will contribute +2 to the final difference in that row or column. (It's a bit like playing golf: you're either over, under or even par on a green, and your total score is the sum of all your scores on all the greens.)

Now we can easily find a filling of the top row to give difference 0. For example, The pairs ( 1,63), (62,4), (5,59), (58,8) have slopes -1, +1, -1, +1; and these add up to 0. We can see these pairs in figure 2, where the ± 1's are the slopes of the green lines.  So, the eight numbers we have chosen can be put into the top row in any order and the first row will have difference 0. It is convenient to choose an ordering where the 8 and the 58 are put into the corner cells, for reasons we shall see later. Here is one such ordering. Of course we have no choice regarding the bottom row; we must fill it in as indicated. Notice that for every line in our drawing that connects a red and a blue number in the top row there is a line that connects the blue and red numbers opposite them, and that the slope of this "opposite" line is minus the slope of the original line. From this we immediately see that the bottom row must also have difference 0.

We already have 7, 8 in the first column, it would be good to "neutralize" these with two blues; 56, 55 are free so we make pairs ( 7,56) and (8,55), each with slope -2. We now have a -4 contribution to the first column, so we need a +4 to get a difference 0 in the first column. The +4 is easily gotten with the pairs ( 13,54) and (14,53). Of course visually what we are doing is drawing the picture in figure 3.  Now we can fill in the first column so that it will have difference 0, and of course the last column is forced and also has difference 0. Here is a finished border design based on what we've done so far: So that's it: Take your favourite magic square of side 6, add 14 to each entry and place the resulting square into the border design at right. It does not matter how you orient your 6 x 6 subsquare, the result will be always be an 8 x 8 magic square.

The entire construction of the border design can be encoded by putting together the two line diagrams we drew earlier. Now it should be clear why we put the 7 and the 8 in the corners, because then the two diagrams fit nicely together into one diagram (except for one unsightly edge crossing): If at this point the reader is eager to go ahead and try bordering magic squares of other orders then this section has served its purpose! Some techniques for making line diagrams are given in the next section.

### Sliding Line Bundles

Suppose we are making a bordering of an 8 x 8 square and we decide to use just the top six rows of the two column array when we draw our lines. What kinds of totals could we get for the slopes of the lines? Well, we can easily get the differences -1, -3 -5 -7 and -9 with the drawings below, and by reflecting the lines through a vertical line we can get totals 1, 3, 5, 7 and 9. There is nothing special about the odd numbers we get from the above configurations, one may just as easily make configurations that give consecutive sequences of even numbers. Any configuration of lines such as the ones we have exhibited is called a line bundle (not to be confused with the other kinds of line bundles!). Line bundles are useful because if you know how to make them you can save a portion of a column for later use and construct the appropriate line bundle on it when the time comes to use that portion of the column. Line bundles can slide up and down the columns and the totals of the slopes in the line bundle will not change. For example we can slide the bundle below that gives -7 down one position to leave the numbers 1, 100, 8 and 93 free, or we can slide this bundle down a bit further to free up the numbers 1, 100, 2 and 99. We'll apply these techniques to the more difficult problem of bordering an antimagic square in the next section.

### Bordering Antimagic Squares

Consider the problem of bordering a negative AMS(8) to get a negative AMS(10). For definitness take the square below to be the AMS(8) we shall border.  The differences in this square are 0, ± 1, ± 2, ..., ± 8 and -9. Just as in the case of a magic square we add 18 to each entry and place the resulting square in the middle of an empty 10 x 10 square, leaving the numbers 1 to 18 and 83 to 100 free for putting into the border. All that really matters now is how we modify the differences from the 8 x 8 subsquare. We'll write "?" in the border cells, because we don't know what to put there yet, and we'll add an extra row and column in color to indicate the differences we get from the 8 x 8 subsquare.

Now, we are trying to get the differences 0, ± 1, ± 2, ..., ± 10 and -11 in the finished square. If we use red and blue pairs as we did before then we're sunk right away; for example a 1 in the top right corner and the corresponding 100 in the bottom left corner give a final difference of -9 on the back diagonal. Somehow we need to get a -11 in the finished square, and we can't get -11 by adding 0 to the negative differences that we already have from the subsquare. The solution to the problem is to introduce an "X" into the construction, as in figure 7:

The X is a special line bundle whose lines have slopes ± 2. In the position it occupies in figure 7 it indicates that if we put 4 somewhere on the border then we must put 95 in the opposite cell (instead of putting 97 in the opposite cell). Similarly the 6 and the 97 must be put in opposite cells. Using the line of slope -2 we can change the -9 on the diagonal to a -11, and the +8 we already have can be turned into a +10 by using the line of slope +2.

In the case of a magic square the only real concern is to make sure that the row and column sums on the border have difference 0. In the present situation we already have differences 0, ± 1, ..., ± 8, -9 from the subsquare. The -9 will become a -11 and the 8 will turn into a 10; all the other differences we already have will remain unchanged since a red and a blue pair that sum to 0 will go into the two empty cells associated with these differences. So far we have anticipated obtaining the differences 0, ± 1, ..., ± 7, -8, 10 and -11. Our job then is to produce the differences +8, ± 9 and -10 in the border of the finished AMS(10).

It is useful to slide the X until it is as close to the center of the column as it can be, since this leaves room at the top and the bottom for making various kinds of line bundles. Here is how we will begin: We'll go ahead and put the ends of the X into the border, and while we're at it we'll add an extra row and column to the square to show what the final differences are.

 -11 -9 ? ? ? ? ? ? ? ? ? 8 93 34 67 33 73 64 55 59 27 10 8 10 ? 41 40 72 68 39 45 28 78 ? 7 ? 58 62 35 37 74 46 77 20 ? 5 ? 54 36 75 43 32 53 31 82 ? 2 ? 38 61 29 60 63 49 81 21 ? -2 ? 69 24 65 50 42 57 22 70 ? -5 ? 47 71 25 51 56 19 80 48 ? -7 ? 66 44 76 26 30 79 23 52 ? -8 91 ? ? ? ? ? ? ? ? ? 3 1 6 4 -4 -1 -3 -6 0

Let's try for a difference of -9 in the first column. We add two green lines to the X like this for a total of -2. We will put the pairs of numbers 7 ,93 and 9 ,91 into the frist column. This means that in the opposite column the pairs 94 ,10 and 92 ,8 must occur, because that is precisely what the X indicates. Notice the contribution to the opposite column is exactly +2, as it normally would be if we were bordering a magic square. This is the case because we made sure that both of the green lines we drew came in contact with the arms of the X. Now we have saved the first 6 rows of our red-blue column to allow for some flexibility, and all we need to do is to get a -7 from a line bundle constructed there. This is easy: Now we'll go ahead and fill in the first column and the last column according to the line diagram. There is one choice to be made about what will go in the corners on the main diagonal. We choose 6 and 95.

 -11 -9 95 ? ? ? ? ? ? ? ? 8 93 34 67 33 73 64 55 59 27 10 8 10 1 41 40 72 68 39 45 28 78 100 7 7 96 58 62 35 37 74 46 77 20 5 5 5 2 54 36 75 43 32 53 31 82 99 2 2 7 38 61 29 60 63 49 81 21 94 -2 -2 4 69 24 65 50 42 57 22 70 97 -5 -5 98 47 71 25 51 56 19 80 48 3 -7 -7 9 66 44 76 26 30 79 23 52 92 -8 -8 91 ? ? ? ? ? ? ? ? 6 3 1 6 4 -4 -1 -3 -6 0 -9 9

Now we have ± 9 from the first and last column, so lets try and get -10 in the bottom row in such a way that we get 8 in the top row. Here's one way to do it: Notice how only one of the lines in the bundle makes contact with the -2 arm of the X, so that when we move to the opposite row we will have 8 (= 10-2) there. Now we can fill in the bottom and top rows:

 -11 -9 95 89 11 88 17 87 18 85 15 8 8 93 34 67 33 73 64 55 59 27 10 8 10 1 41 40 72 68 39 45 28 78 100 7 7 96 58 62 35 37 74 46 77 20 5 5 5 2 54 36 75 43 32 53 31 82 99 2 2 7 38 61 29 60 63 49 81 21 94 -2 -2 4 69 24 65 50 42 57 22 70 97 -5 -5 98 47 71 25 51 56 19 80 48 3 -7 -7 9 66 44 76 26 30 79 23 52 92 -8 -8 91 12 90 13 84 14 83 16 86 6 -10 3 1 6 4 -4 -1 -3 -6 0 -9 3 1 6 4 -4 -1 -3 -6 9 0

The square is complete! If we remove the scaffolding we can admire the finished product.

 95 89 11 88 17 87 18 85 15 8 93 34 67 33 73 64 55 59 27 10 1 41 40 72 68 39 45 28 78 100 96 58 62 35 37 74 46 77 20 5 2 54 36 75 43 32 53 31 82 99 7 38 61 29 60 63 49 81 21 94 4 69 24 65 50 42 57 22 70 97 98 47 71 25 51 56 19 80 48 3 9 66 44 76 26 30 79 23 52 92 91 12 90 13 84 14 83 16 86 6

Of course all of the instructions for how to carry out the bordering are contained in the line diagram, which in its entirety looks like Now the final line diagram is itself a line bundle, and it turns out we may easily extend it to a line drawing for a bordering of a negative AMS(12). Here are the two line diagrams:  The larger line diagram for bordering a negative AMS(12) is obtained by starting with the
line diagram for bordering a negative AMS(8), adding a constant to the column and then capping off the structure with line bundles that give -4's. Clearly the process can be continued to create line diagrams for borderings of negative AMS(n)'s for n= 16, 20, 24, ... . But this leaves out the side lengths n= 6, 10, 14, ..., how do we construct borders for negative antimagic squares of these orders? A solution is provided below, starting with n=6 and then showing how to extend that solution to a line diagram for n=10. It was constructed in a manner very similar to the way we constructed the first line diagram in these pages.  Below we have a negative AMS(6) and a bordering using the line diagram for n=6 above.
 27 12 5 24 21 28 15 30 34 13 16 7 17 10 19 11 26 31 36 6 14 4 20 29 18 32 1 25 22 8 3 23 35 33 2 9
 60 55 4 52 11 51 12 7 58 41 26 19 38 35 42 9 6 29 54 48 27 30 21 59 2 31 24 33 25 40 45 63 62 50 20 28 18 34 43 3 1 32 46 15 39 36 22 64 8 17 37 49 47 16 23 57 56 10 61 13 54 14 53 5

So, to construct antimagic squares of all possible even orders we just need a starting supply of negative, even order squares and then we can make all the subsequent even ones by bordering. Madachy's book Mathematical Recreations gives us a supply of negative AMS(n)'s for n= 4,6 and 8, so we're set.

The reader may be wondering why we haven't tried to border an AMS(4). This is possible and we invite the the reader to try constructing one. The solutions we have found are not very pleasing, artistically speaking, just a jumble of lines. It is because the small size of the design does not allow for much improvisation. Often when constructing combinatorial structures it is helpful to try creating a decent sized structure rather than looking for the smallest ones possible, as the larger size allows for improvisation, in fact often forces the constructer to discover various useful patterns. Those who are curious about the case n=4 can look up the solution (cast in math-speak!) in our preprint.

Composed by Dr. Vaclav Linek Updated: July 21 1999