Home * Humor and Games * Code * Music * Mathematics * Discussion * Reading * Site news * Film * Baseball * Verse * Links * Search |
The Math Department |
Special Extra! Here's a link to another page that will thrill you with its astounding Web design! And it's
on.... magic squares!
Magic squares – matrices of numbers whose rows, columns and full diagonals all sum to the same number – have been objects of study for centuries. The name “magic” stems from their use in ancient and medieval times, as they were engraved on talismans as charms. They were also used in divination; the sixteenth century numerologist Cornelius Agrippa attributed a magic square to each of the planets. Magic squares have fascinated many people over the centuries, including some famous historical figures. For example, Benjamin Franklin composed dozens of ingenious magic squares in his lifetime, many of large size and which had many ways to obtain the magic sum. He once boasted to a friend that he could construct his giant magic squares as quickly as he could write them down. We can do more or less that, also, for over the centuries there have been discovered many methods for constructing magic squares. The most direct is simply to give the individual elements in the square names, set up a system of simultaneous linear equations representing the desired sums, and solve the system. Of course, this method is unwieldy, computationally difficult, and although it can produce formulas for a fixed size magic square, it is not easy to generalize to other sizes. Simpler and more general methods are known. The De La Loubere procedure for magic squares with an odd number of elements is one that has been known to European mathematicians for centuries, and which was known in the Far East in antiquity. It proceeds like this: 1 is placed in the center square of the first row. 2 is placed in the square one above and to the right of 1 (wrapping around the edges of the square as needed.) 3 is placed in the square diagonally above and to the right of 2, and so on, until we reach n. The square one above and to the right of n will be occupied by 1, as we have crossed the entire square in this fashion. We then place (n+1) in the space just below n, and then proceed as we did before: (n+2) goes above and to the right of (n+1), and so on. It is clear that we can fill the square doing these moves, but is it true that we have generated a magic square? It does not take any mystical arts to prove it: consider any column of the square we have formed. If an entry in this column is i, and not the largest, then the entry below it is either (i+n+1) or 1. This means that, in any given column of the square, there is exactly one element in the column congruent to 1 modulus n, exactly one element congruent to 2 modulus n, etc. Now, notice that, for the element in the column j congruent to k modulus n, k nonzero, the element just above and to the right is (j+1). There are (n-1) such elements, hence the column to the right has a sum (n-1) greater than this column, considering only these elements. Though what of the single element l in the column divisible by n? The element above and to the right of l was the beginning of the diagonal (this is where we had to drop down one in constructing the square.) Hence it contains (l-n+1) – which exactly offsets the (n-1) advantage gained in comparing the other elements of the column. So adjacent columns have the same sum, and so all columns of the square have the same sum. Now we show the row sums are equal. Essentially, we can use the same argument that we used for the columns. The only change is that the difference between adjacent elements in a row is either 2 or (n+2) – but since n is odd, n is relatively prime to both numbers; hence we still have the same results. Since the sum of all the rows equals the sum of all the columns, and their number is the same, we also have that the sum of each row equals the sum of each column. All diagonals running down and right (allowing wraparound) in our square have the same sum, again by a similar argument (in this case, we compare differences between adjacent diagonals.) And the other main diagonal is easy, since it always contains the consecutive integers from (n2 – n + 2)/2 to (n2 + n)/2, and their sum is the correct magic sum. So we can see that the De La Loubere method for generating odd order magic squares works. Constructing even magic squares is more difficult. Indeed, the 2 x 2 case is a little strange, as we will see later. Most methods given for constructing even order magic squares separate the case where n = 4k and n = 4k+2; a general method for constructing even order magic squares and cubes is given in http://www.snaffles.demon.co.uk/misc.html. We have been considering “pure” n x n magic squares, that is, magic squares that use each integer from 1 to n2 exactly once. In such a square, the magic sum is easy to obtain: since the sum of the elements is (n4+ n2)/2, and each of the n rows has the same sum, the sum of each row is (n4+ n2)/2 n = (n3+ n)/2. Except for the 1-by-1 case, one cannot construct a pure magic square with the property that the product of each of the rows and columns in the same number. The proof of this is simple: let us consider what the magic product would be. The product of all elements in the n x n square is of course (n2)!; this means that the magic product would have to be (n2)!1/n. But for n > 1, (n2)!1/n is not an integer. This follows simply from the observation that if (n2)!1/n is an integer, it can be factored as the product of primes, each of which is raised to a power divisible by n. But there are certainly primes in the factorization of (n2)! that have exponent 1 – this follows easily by an application of Tchebychev’s theorem. We know that n does not divide 1, if n > 1. Since the supposed magic product is never an integer, it cannot be (except in the trivial 1 x 1 case) that there are multiplicative magic squares using the integers from 1 to n2 exactly once. Although multiplicative n x n magic squares are impossible to construct using the consecutive integers 1 to n2, it is easy to construct a multiplicative magic square from any additive magic square. Simply fix a base b. Then, if we have xij = a in the additive magic square, set the element yij = ba in the new magic square. Then, if the original square had the magic sum S, the new square will have the magic product bS. Notice that if b = 0 or b = 1, you will obtain a magic square that is (trivially) both multiplicative and additive. If b = 0, you not only have this, but the magic sum and the magic product are equal. Going further with the multiplicative magic square, let us consider the 2 x 2 case. We desire the difference between the two diagonal products to be 0. But recall that this difference is just the determinant of the 2 x 2 matrix of the magic square; hence we know that our columns are linearly dependent – that is, since there are only two of them, they are multiples of each other. Since we want the column products to be equal, we must have that the columns are identical. Similarly, we see that the two rows are identical, and hence the only 2 x 2 multiplicative magic squares are constant magic squares. But remember the funny 2 x 2 additive magic square case? Once we construct such a magic square, by our previous discussion, we could create a multiplicative magic square from it, using the base method I outlined above. But, if we use a base b > 1, such a magic square would not be constant unless the original additive magic square was constant. Hence, we have a proof that the only additive 2 x 2 magic squares are constant. Although the principal characteristics of a magic square are the equality of its row, column, and main diagonal sums, magic squares with additional special properties have often been studied; for example, magic squares containing only prime numbers are discussed in http://www.pse.che.tohoku.ac.jp/~msuzuki/PrimeMagicSquares.pdf, and http://www.geocities.com/~harveyh/magicsquare.htm provides a superb resource with examples of some exceptional magic squares. Recreational mathematicians expand the concept of magic squares to higher dimensions, creating magic cubes and magic tesseracts, as well as other magic shapes. The number of variations on the theme seems to be limitless, and the supply of tantalizing patterns to discover inexhaustible; hence, the magic square and its relatives continue to provide pleasurable diversions for the mathematically minded everywhere. |
|