# Affine Magic Squares Independently Discovered

## Benjamin Franklin's Magic Squares

Benjamin Franklin made a few magic squares with interesting and unusual properties; at least four of them have survived. Two are well-known, and are explained in Chapter III of Andrews. Another was published by Pasles. Ahmed has studied the methods by which Franklin might have constructed these squares; she gives some more examples of squares constructed by her methods.

#### A Square of order 8

Franklin's first square is:

 52 61 4 13 20 29 36 45 14 3 62 51 46 35 30 19 53 60 5 12 21 28 37 44 11 6 59 54 43 38 27 22 55 58 7 10 23 26 39 42 9 8 57 56 41 40 25 24 50 63 2 15 18 31 34 47 16 1 64 49 48 33 32 17

It has the following magical properties:

1. Each row and column adds up to the magic sum, which is 260.
2. Every half-row and half-column adds up to half the magic sum; for instance, 52+61+4+13=130, or 46+35+30+19=130, or 4+62+5+59=130, or 23+41+18+48=130.
3. Each bent row or bent column adds to the magic sum. Two bent rows are shown in Figure 1; others can be formed by moving translating these up or down. Likewise, two bent columns are shown in Figure 2, and these can be translated horizontally. If the translated figure would pass through an edge of the square, it should wrap around to the opposite edge; for instance, 36+19+53+6+58+9+47+32=260 is a bent column.
4. Every 2-by-2 subsquare adds up to half the magic sum. This property also wraps around at the edges of the square, as with 19+44+14+53=130 or 1+64+61+4=130, or even wrapping around both horizontally and vertically: 52+45+16+17=130.
Figure 1. Bent rows
Figure 2. Bent columns

This square is affine. Here are the affine functions which define it:

 A1 = f3+f4+f5+1 A2 = f3+f5+1 A3 = f3+f6+0 A4 = f1+f2+f3+f6+0 A5 = f2+f3+f6+1 A6 = f1+f2+f6+1

It is easy enough to check that the square is uniform on the subspace <e2, e3>, which is a half column, and consequently the sum is 130 on every parallel flat, which is to say, on every half column. Likewise for the half rows. But what about these bent rows and bent columns? They can be investigated using the applet that displays flats. It turns out that half of the bent rows and columns actually are 3-flats, but the others are not. To understand the bent rows, you can use the two linear subspaces

α = <e2+ e5, e4 + e5 + e6>
β = <e1+e2+ e4, e4 + e5 + e6>.

The affine square is uniform on both of these. Every flat that is parallel to α or to β is part of a bent row; and every bent row consists of two such flats. So the magical property of bent rows follows from the affine structure of the square. A similar analysis works for the bent columns.

As for the 2×2 blocks, they are all 2-flats. They belong to four families of parallel flats, not all of which are contiguous 2×2 blocks. Franklin hinted at "other" properties of this square, and it occurs to me that he may have known about these other 2-flats.

Is there any chance that Franklin constructed this square, and others like it, by defining an affine map with the requisite properties? Certainly he could not have used the concepts and notation of linear algebra, which did not exist in his day. But we do not know what technique he did use. One possible technique is sketched in Chapter III of Andrews. This is, to start with the numbers in their natural order, which corresponds to the identity transform as an affine map, and apply various transformations which preserve the affine property. In Andrews, figures 194 - 197, you can see a nontrivial affine map being constructed in this way.

#### A Lesser-known square of order 8

This square was relegated to a footnote in Franklin's collected works. It is resurrected by Pasles and further treated by Ahmed.

 17 47 30 36 21 43 26 40 32 34 19 45 28 38 23 41 33 31 46 20 37 27 42 24 48 18 35 29 44 22 39 25 49 15 62 4 53 11 58 8 64 2 51 13 60 6 55 9 1 63 14 52 5 59 10 56 16 50 3 61 12 54 7 57

It, too, is affine. defined by these functions:

 A1 = f1+f2+f6+0 A2 = f2+f6+1 A3 = f3+f5+f6+0 A4 = f3+f4+f5+f6+0 A5 = f3+f6+0 A6 = f3+f5+0

#### Squares of order 16

One square of order 16, constructed by Franklin, has been reprinted in several places, including Andrews:

 200 217 232 249 8 25 40 57 72 89 104 121 136 153 168 185 58 39 26 7 250 231 218 199 186 167 154 135 122 103 90 71 198 219 230 251 6 27 38 59 70 91 102 123 134 155 166 187 60 37 28 5 252 229 220 197 188 165 156 133 124 101 92 69 201 216 233 248 9 24 41 56 73 88 105 120 137 152 169 184 55 42 23 10 247 234 215 202 183 170 151 138 119 106 87 74 203 214 235 246 11 22 43 54 75 86 107 118 139 150 171 182 53 44 21 12 245 236 213 204 181 172 149 140 117 108 85 76 205 212 237 244 13 20 45 52 77 84 109 116 141 148 173 180 51 46 19 14 243 238 211 206 179 174 147 142 115 110 83 78 207 210 239 242 15 18 47 50 79 82 111 114 143 146 175 178 49 48 17 16 241 240 209 208 177 176 145 144 113 112 81 80 196 221 228 253 4 29 36 61 68 93 100 125 132 157 164 189 62 35 30 3 254 227 222 195 190 163 158 131 126 99 94 67 194 223 226 255 2 31 34 63 66 95 98 127 130 159 162 191 64 33 32 1 256 225 224 193 192 161 160 129 128 97 96 65

Like his squares of order 8, this is magic for rows, columns, bent rows, and bent columns, the magical sum being 2056. It is also magical for all contiguous 4×4 blocks; this is a corollary of the fact that every contiguous 2×2 block adds up to 514. Franklin affirmed this "to be the most magically magical of any magic square ever made by any magician." But only up to that time, which was about 1752. This square is affine, and here are its defining functions.

 A1 = f4+f5+f6+1 A2 = f4+f6+1 A3 = f4+f7+0 A4 = f4+f8+0 A5 = f1+f2+f4+f8+0 A6 = f2+f4+f8+1 A7 = f1+f2+f3+f4+f8+1 A8 = f1+f2+f8+1

In a 1765 letter to the electrical investigator John Canton, Franklin included another square of order 16, which was first published by Pasles and can best be seen at his web site. It is:

 16 255 2 241 14 253 4 243 12 251 6 245 10 249 8 247 1 242 15 256 3 244 13 254 5 246 11 252 7 248 9 250 240 31 226 17 238 29 228 19 236 27 230 21 234 25 232 23 225 18 239 32 227 20 237 30 229 22 235 28 231 24 233 26 223 48 209 34 221 46 211 36 219 44 213 38 217 42 215 40 210 33 224 47 212 35 222 45 214 37 220 43 216 39 218 41 63 208 49 194 61 206 51 196 59 204 53 198 57 202 55 200 50 193 64 207 52 195 62 205 54 197 60 203 56 199 58 201 80 191 66 177 78 189 68 179 76 187 70 181 74 185 72 183 65 178 79 192 67 180 77 190 69 182 75 188 71 184 73 186 176 95 162 81 174 93 164 83 172 91 166 85 170 89 168 87 161 82 175 96 163 84 173 94 165 86 171 92 167 88 169 90 159 112 145 98 157 110 147 100 155 108 149 102 153 106 151 104 146 97 160 111 148 99 158 109 150 101 156 107 152 103 154 105 127 144 113 130 125 142 115 132 123 140 117 134 121 138 119 136 114 129 128 143 116 131 126 141 118 133 124 139 120 135 122 137

Sure enough, it too is affine; the defining functions are:

 A1 = f2+f3+f8+0 A2 = f1+f2+f3+f8+0 A3 = f3+f8+0 A4 = f2+f8+0 A5 = f4+f7+1 A6 = f4+f5+f7+1 A7 = f4+f6+f7+1 A8 = f2+f4+f8+1

And this one is even more magical than the previous square; in particular, it is pandiagonal.

### How many magic properties has an affine square?

We can see that the magic properties of Franklin's squares can be derived from their being (a) affine, and (b) uniform on certain linear subspaces of various dimensions. On how many subspaces is an affine square uniform? Here is a "calculator" which gives the answer: the number of uniform subspaces of dimension m, and the number of m-flats parallel to those spaces, in a vector space Fpd.

 P: 2 3 5 7 11 13 17 19 23 29 31 This selector gives you the order of the prime field. D: 1 2 3 4 5 6 7 8 9 10 This selector chooses the dimension of the vector space. M: This selector chooses the dimension m of the linear subspaces and flats being counted.

The number of cells is 000.

There are 000 uniform linear subspaces of dimension 0, and 000 uniform 0-flats.

The calculator starts up with p = 2, d = 4, and m = 2, which pertain to such squares as the Dürer square. Try p = 2, d = 8, and m = 4 to see how much magic there is in one of Franklin's squares. Franklin's "most magically magical" statement was in fact modest.

The theory behind this calculator is described in some notes, along with the theory of counting affine squares of any prime-power order.

## Great Multimagic Squares

Benson and Jacoby constructed a trimagic square of order 32. This is the smallest trimagic square of prime-power order that I know of. I investigated it using Mathematica™. It is an affine square. The rows and columns are uniform of degree 3, but the diagonals are not. However, they are not very non-uniform. In degree two, there are two pairs of digit coordinates that are not linearly independent on the diagonal subspace: A3A10 and A4A9. On the main diagonal, most of the products of two digit coordinates take the value 1 in 1/4 of the cells; but A3A10 has the value 1 nowhere, and A4A9 has the value 1 at 1/2 of the cells. Note that 3 + 10 = 4 + 9; these two products together contribute as much to the sum of squares as if they were both uniform. Similarly, on the opposite diagonal, A4A9 contributes nothing whereas A3A10 contributes a double amount.

Christian Boyer has constructed a web site with much information on multimagic squares. He provides downloadable copies of several multimagic squares of impressively high degree. I have investigated them to see if they were affine. Here are some findings.

Trimagic, order 64 The first such square was made by General Eutrope Cazalas, in 1933. It is affine, and is uniform of degree 3 in the rows, columns, and diagonals.

Trimagic, order 128 The first such square was made by Gaston Tarry in 1905. It is not affine, but the discrepancy is less than it might be. My method of checking for the affine property was to find the affine square which would agree with Tarry's square at 15 points, namely those corresponding to {0 , e1,..., e14}. I compared the digit coordinates of this square with those of Tarry's. There were 14×16384 pairs of bits to check. The two squares differed in 3×16384 cases. Six of the digit coordinates agreed completely. As for the others, two were discrepant at 5120 places, four at 6144 places, and two at 7168 places. Most surely, Tarry's square has some hidden structure; it is not as simple as an affine square, but it is not very much more complicated.

Tetramagic, order 243 A square of this description was constructed by Pan Fengchu in 2004; this appears to be the smallest tetramagic square currently known. Alas, it is not affine. I compared it with the affine square determined by 11 points, and found discrepancies at somewhat more than 50% of the data.

Last modified on \$Date: 2015-06-14 18:15:01 -0400 (Sun, 14 Jun 2015) \$

Christopher J. Henrich