<<

Vector Spaces of Magic Squares Author(s): James E. Ward III Source: Magazine, Vol. 53, No. 2 (Mar., 1980), pp. 108-111 Published by: Mathematical Association of America Stable URL: http://www.jstor.org/stable/2689960 Accessed: 27/10/2010 13:48

Your use of the JSTOR archive indicates your acceptance of JSTOR's Terms and Conditions of Use, available at http://www.jstor.org/page/info/about/policies/terms.jsp. JSTOR's Terms and Conditions of Use provides, in part, that unless you have obtained prior permission, you may not download an entire issue of a journal or multiple copies of articles, and you may use content in the JSTOR archive only for your personal, non-commercial use.

Please contact the publisher regarding any further use of this work. Publisher contact information may be obtained at http://www.jstor.org/action/showPublisher?publisherCode=maa.

Each copy of any part of a JSTOR transmission must contain the same copyright notice that appears on the screen or printed page of such transmission.

JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide range of content in a trusted digital archive. We use information technology and tools to increase productivity and facilitate new forms of scholarship. For more information about JSTOR, please contact [email protected].

Mathematical Association of America is collaborating with JSTOR to digitize, preserve and extend access to Mathematics Magazine.

http://www.jstor.org Vector Spaces of Magic Squares

JAMES E. WAw III BowdoinCollege Brunswick,ME 04011

Exercise.An n X n magicsquare is an n X n matrixof real numbersin whichthe sum along each row,each columnand each diagonalis a constant(called the line-sum of themagic square). For example,three 3 x 3 magicsquares with line-sums 15, 3/2 and 0, respectively,are

2 9 4 -1 5/2 0 1 0 -1 7 5 3 3/2 1/2 -1/2 -2 0 2 6 1 8 1 -3/2 2 1 0 -1

(i) Show thatthe (matrix)sum of twon X n magicsquares is an n X n magicsquare. If the line-sumsof thesquares are ml and M2, whatis theline-sum of thesum? (ii) Show thatthe (matrix) scalar multiple of an n X n magicsquare by a real numberk is an n X n magicsquare. If the originalsquare has line-summ, whatis the line-sumof the scalarmultiple? (iii) Is theset of all n X n magicsquares (with all possibleline-sums) a vectorspace? Why? (iv) Is theset of all n X n magicsquares with line-sum m #0 a vectorspace? Why? (v) Is theset of all n X n magicsquares with line-sum zero a vectorspace? Why? This exercise,suggested by Fletcher[3], encourages consideration of thealgebraic structure of magicsquares, as opposed to methodsfor generating them. In thisarticle we followFletcher's suggestion,using familiar linear techniques to determinethe dimensionsof the vector spaces of magic squares.Then we use thesedimensions to establishan upper bound on the numberof magicsquares. Magic squareshave fascinatedpeople forcenturies. A Chineseemperor is supposedto have seen one-on the back of a divineturtle, no less-as earlyas 2200 B. C. From thattime on, mysticalproperties have been ascribedto them.In themiddle ages, a magicsquare engraved on a silverplate and wornabout the neckwas thoughtto wardoff the plague [5]. Writing in 1844, Hutton[4] reported:

Thesesquares have been called magic squares because the ancients ascribed to themgreat virtues,and becausethis disposition of numbersformed the basis and principleof manyof theirtalismans. According to thisidea a squareof one cell,filled up withunity, was the symbolof theDeity, on accountof theunity and immutabilityof God; forthey remarked thatthis square was, by its nature, unique and immutable,the product of unity by itself being alwaysunity. The square of the root two was the symbol of imperfect matter, both on account of thefour elements and of theimpossibility of arranging this square magically. A squareof ninecells was assigned or consecrated to Saturn,that of sixteen to Jupiter,that of twenty-five to Mars,that of thirty-sixto the Sun, thatof forty-nineto Venus,that of sixty-fourto

108 MATHEMATICS MAGAZINE Mercury,and thatof eighty-one, or nine on eachside, to theMoon. Those who can findany relationbetween the planets and suchan arrangementof numbersmust, no doubt,have mindsstrongly tinctured with superstition; but such was thetone of themysterious philoso- phyof Jamblichus,- Porphyry, and theirdisciples. Modem mathematicians, while they amuse themselveswith these arrangements, which require a prettyextensive knowledge of combina- tion,attach to themno moreimportance than they really deserve. Nevertheless,mathematicians both before and after1844 apparently attached enough impor- tance to magic squares to writethousands of pages about them. In 1888, F. A. P. Barnard, then presidentof Columbiaand afterwhom Barnard College is named,published a 61-pagepaper [2] at the end of whichhe includedan "approximatelycomplete" bibliography of 47 scholarly papers and books on the subject.Today a completebibliography on magic squares would probablyrequire all 61 pages! The magic squares which are best known are those n x n squares which use only the firstn2 positiveintegers. These squarearrays of thenumbers 1 to n2will be referredto as classicalmagic squares. The firstexample given in the opening exercise is a 3 x 3 classical magic square. Each magicsquare yieldsseven othermagic squares, obtained from it by rotatingit in the plane throughangles of 900, 1800, and 2700 and by rotatingit in space about its horizontal, verticaland two diagonal axes. These seven, togetherwith the original,constitute the symmetries of the magic square. Symmetricmagic squares are regarded as being identical. It is easy to show that the firstexample in the opening exercise is the only 3 x 3 classical magic square up to symmetry. More generally,we shall call any n x n array of n2 (integral,real, or complex) in which each line-sumis constant a magic square. The second and thirdexamples of the opening exercise are real 3 x 3 magic squares. Note that the same may appear several times in a magic square, a statementwhich is not true of classical magic squares. This paper will consideronly real magic squares,although all of the resultsare truefor complexmagic squares as well.If theentries are restrictedto theintegers, all of theresults hold if"" is replacedjudiciously by "Z-module."From now on, all magicsquares will be real magic squares unless it is specificallystated otherwise.Because 1x 1 and 2 x 2 magic squaresare notvery interesting and because theybog downthe proofs with special cases, it will be assumedthat n > 3. We shalldenote by MS(n) theset of all n x n magicsquares; by mMS(n) theset of all n x n magicsquares with line-sum m; and by OMS(n) theset of all n x n magicsquares with line-sum zero. The openingexercise reveals that MS(n) and OMS(n) are vectorspaces but thatmMS(n) form #0 is not.The space OMS(n) is a subspaceof MS(n) whichis, in turn,a subspaceof the n2-dimensionalvector space of all n x n real matrices.Thus the dimensionof MS(n) is at most n2. (Note thatmMS(n) is neverempty: it alwayscontains the square in whicheach entryis m/n.) Let us call each magic square in OMS(n), whose line-sumsare all zero, a zero magic square. We willcall twon x n magicsquares equivalent if one can be obtainedfrom the other by adding thesame real numberto each entry.It follows,trivially, that each magicsquare is equivalentto one and onlyone zero magicsquare: if an n x n magicsquare has line-summ, it can " zeroed" by subtractingm/n fromeach entry.Thus thereis a one-to-onecorrespondence between the set mMS(n) fora fixedm and thevector space OMS(n). This setsthe stage for the main resultof thispaper.

THEOREM. The dimensionof OMS(n) is n2 - 2n - 1.

Proof. If an n x n matrixA = (a.) is in OMS(n), its 2n + 2 line-sumsare all zero. Thus there are 2n+ 2 homogeneouslinear equations in then2 variables ay, 1 < i,j < n. Writethese equations in thefollowing order, called the standard order: first the n rowsums in order,then the n column sumsin order,then the NW-SE diagonalsum, and, last,the SW-NE diagonalsum. The resulting coefficientmatrix will be a (2n + 2) x n2 matrixof O's and l's. Whenn = 3, it is the8 x 9 matrix

VOL. 53, NO. 2, MARCH 1980 109 I I I 0 0 0 0 o o O O 0 1 1 1 0 0 0 O O O O O 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 O 0 1 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 O 0 1 0 1 0 1 0 O, where the elementsin thejth column are the coefficientsof the jth variable in the list ajj,aI2,aI3,a2I, a22,a23,a3l,a32,a33- In thecoefficient matrix determined by A, thefirst 2n-1I rowsare clearlylinearly indepen- dent.But the2nth row is a linearcombination of the first2n -1, beingthe sum of thefirst n rowsminus the sumof rowsn + I through2n -1. Moreover,the last tworows are bothlinearly independentof thefirst 2n-1I rows:the nth column of thecoefficient matrix has I's in thefirst, 2nthand (2n+2)nd rows,and zeroeseverywhere else, and then 2th column has I's in thenth, 2nthand (2n+ I)st rows,and zeroes everywhereelse, makingit impossibleto finda nontrivial zero linearcombination of the first2 n-1I rowswith either of the last two rows.Finally, it is clear thatneither of the last two rows is a scalar multipleof the other.Thus the matrixof coefficientshas exactly2n + I linearlyindependent r.ows and hencehas rank2n + 1. By therank and nullitytheorem [1], the dimension of OMS(n),which is thenullity of thecoefficient matrix, is n2-_(2n + 1). COROLLARY.The dimensionof MS(n) is n2- 2n = n(n-2). Proof.Let q = n2-_2n-1I and SI, . .., Sq be a basis forOMS(n), a subspaceof MS(n). Let I be themagic square in MS(n) withI in everyposition, and considerthe set B={S .S ,I} consistingof n 2-2n vectorsof MS(n). The setB forif M is in and M has line-sum thenM 1 10MATH111000000ZINspansMS(n), anymagic square MS(n) m, is equivalentto thezero m'agic square MO = M-(ml n)I ofOMS(n). As SI,..., Sq is a basisfor OMS(n),MD = clISI + ** * + cqSq forsome scalars cl I ..,. cq, so M= clSl + *,* +cqSq +(m/n)I. Moreover,B is linearlyindependent, for the line-sumof the vectorc ISI + + cqSq +cq + II, wherethe ci's are scalars,is ncq+1. [See parts(i) and (ii) of theopening exercise.] If thisvector is to equal thezero vector,which has line-sumzero, we musthave ncq+I= or cq 0=. Then the linearindependence of SI,_., Sq impliesthat cl= cq= as well.Thus B is a basisfor MS(n). It is easyto see thatthe central entry of any magicsquare in OMS(3) is zero.This meansthat OMS(3) magicsquares are anti-symmetricwith respect to the diagonals.By the Theoremn,the dimensionof OMS(3) is 2; thusa magicsquare in OMS(3) is uniquelydetermined by specifying any twoentries not collinearwith the central zero. If we choose thefirst two entries in thefirst row to be 1, O and O, 1, we getthe following basis forOMS(3): I 0 -1 0 1 -1 -2 O 2 -1 O 1 1 0 -1 I -1 0

Accordingto the Theorem,the dimensionof OMS(4) is 7. Using an argumentof the same natureas thatwhich shows that there is a unique3 x 3 classicalmagic square up to symmnetry,it can be establishedthat the sum of thefour corner entries and thesum of thefour central entries of a magic square in OMS(4) are both zero. With thesefacts, it is easy to findseven entries which,when specified, completely determine a 4 x 4 zero magicsquare. Two examplesare: x x x x x x - - - x - x - - - x - x x x - x x The sevensquares obtained by putting1 in one of thedesignated positions of eitherpattern and O's in the othersix in all possibleways constitutea basis forOMS(4). For instance,the seven magicsquares which form a basis forOMS(4) accordingto thefirst pattern are: 1 0 0 -1 0 1 0 -1 0 0 1 -1 0 0 0 0 00 0 0o0 0 0 0o0 00 0 1 0 0 -1 0 2 -2 0 0 1 -1 0 0 1 -1 0 0 1 -1 0 -1 -2 2 1 0 -2 1 1 0 -1 0 1 -1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -1 0 0 1 -1 0 0 0 0 0 0 -1 1 0 -1 0 1 1 1 -1 -1 0 -1 1 0 0 1 -1 0 -1 -1 1 1 Motivatedby this example,it is naturalto make the followingdefinition. A selectionof n' - 2n - 1 positionsin an n X n matrixis called a skeletonof OMS(n) if theassignment of real numbersto thosepositions uniquely determines entries in all otherpositions using the zero magic square conditions.Given a skeletonof OMS(n), the arrayof the 2n+ 1 positionsnot specifiedis calledthe frame of thatskeleton. In theOMS(4) examplesabove, each arrayof x's is a skeletonand each arrayof dashesis a frame.When n is large,the number of positionsin a skeletonis muchgreater than the number of positionsin itsframe, so it is convenientto thinkof skeletonsin termsof theframes they determine. Everyskeleton of OMS(n) leads to a basis of OMS(n) in a naturalway, by assigning1 to one skeletalpositipn and O's to therest in all n2- 2n- 1 possibleways. We shall call thisbasis the naturalbasis associatedwith that skeleton.Thus we could determinea canonical basis for OMS(n) if we could agree on a canonicalskeleton of OMS(n). Unfortunately,there does not appear to be any one skeletonof OMS(n) whichis superiorto, or morenatural than, all the others.Some skeletonspossess certainkinds of symmetryor near-symmetry,while others guaranteethe presence of a largenumber of zeroes in the magicsquares of the naturalbases theydetermine. Preference for one skeletonover another seems to be largelya matterof taste. The precedingideas can be used to determinea crudeupper bound on thenumber of n x n classicalmagic squares. Since the sum of thefirst n2 is n2(n2 + 1)/2,each line-sumof an n x n classicalmagic square must be n(n2+ 1)/2. Letting1= n(n2 + 1)/2,an n x n classicalmagic square can be zeroed by subtractingI/n fromeach entry.A skeletonof thisn X n zero magic square consistsof n12-2n-I positionsand determinesthe zero magic square,and hence the classical magic square,completely. Thus the numberof n x n classicalmagic squaresis the numberof waysthe n2- 2n- 1 positionsof thisskeleton can be chosenfrom the n2 numbers 1-1/n,2-i/n, ... , n2-I//n, choosingeach numberno more than once. Since the numberof permutationsof n2- 2n - 1 elementswhich can be formedfrom a set of n2 elementsis (n2)!/(2n+ 1)!, themaximum number of n x n classicalmagic squares, taking into account the 8 symmetriesof a magic square,is (n2)! /8(2n+ 1)!. The imprecisionof thisbound is revealed evenwhen n = 3: in thatcase, the bound says thatthere are at mostnine 3 x 3 classicalmagic squares,while, as suggestedearlier in thispaper, it is easyto showthat there is, in fact,only one.

References [1] H. Anton,Elementary Linear Algebra,2nd ed., Wiley,New York, 1977. [2] F. A. P. Barnard,Theory of magicsquares and of magiccubes, Memoirs of theNational Academy of Sciences,vol. 4, Part1, 1888,pp. 209-270. [3] T. J. Fletcher,Linear Algebra ThroughIts Applications,Van NostrandReinhold, New York, 1972. [4] Hutton,Mathematical Recreations, 1844. [51 H. M. Stark,Introduction to NumberTheory, Markham, Chicago, 1970.

VOL. 53, NO. 2, MARCH 1980 111