The 880 magic squares of order 4 found by Bernard Frenicle de Bessy (before 1693) proof by Friedrich (and Hans) Fitting 1931.
References:
"Rein mathematische Behandlung des Problems der lateinischen Quadraten von 16 und von 64 Feldern", Jahresbericht DMV 1931http://www.digizeitschriften.de/dms/img/?PID=GDZPPN002129337
Hans Fitting's father, Prof. Dr. Friedrich Fitting (1862-1945), was a graduate secondary school teacher and a research mathematician who published over twenty papers. His doctorate was from the Martin-Luther University of Halle-Wittenberg in 1888 for the thesis "Über eine Klasse von Berührungstransformationen"....
Friedrich Fitting is best known today for giving a proof, in 1931, that there are exactly 880 magic squares of order 4. This result appears in his paper "Rein mathematische Behandlung des Problems der magischen Quadrate von 16 und von 64 Feldern" and is remarkable since these 880 magic squares had been given by Frenicle de Bessy in 1693 but no proof was found until Friedrich Fitting's 1931 paper appeared.
Friedrich Fitting is best known today for giving a proof, in 1931, that there are exactly 880 magic squares of order 4. This result appears in his paper "Rein mathematische Behandlung des Problems der magischen Quadrate von 16 und von 64 Feldern" and is remarkable since these 880 magic squares had been given by Frenicle de Bessy in 1693 but no proof was found until Friedrich Fitting's 1931 paper appeared.
The construction all 880 magic squares of order 4 by F. Fitting 1930, with contribution from H. Fitting.
The construction all 880 magic squares of order 4 by F. Fitting 1930, with contribution from H. Fitting.
Mathematica code:
Mathematica code:
In[]:=
SemiMagicSquareQ[m_?SquareMatrixQ]:=Equal@@Join[Apply[Plus,m,1],Apply[Plus,Transpose[m],1]]
In[]:=
MagicSquareQ[m_?SquareMatrixQ]:=Equal@@Join[Apply[Plus,m,1],Apply[Plus,Transpose[m],1],{Tr[m],Tr[Reverse/@m]}]
In[]:=
PanDiagonalMagicSquareQ[m_?SquareMatrixQ]:=With[{d=Length[m]},Equal@@Join[Apply[Plus,m,1],Apply[Plus,Transpose[m],1],Tr/@NestList[RotateLeft,m,d-1],Tr/@NestList[RotateLeft,Reverse/@m,d-1]]]
In[]:=
FrenicleNormalFormQ[m_?SquareMatrixQ]:=m[[1,1]]==Min[m[[1,1]],m[[-1,1]],m[[-1,-1]],m[[1,-1]]]&&m[[2,1]]>m[[1,2]]
In[]:=
ToFrenicleNormalForm[m_?SquareMatrixQ]:=With[{a=m〚1,1〛,b=m〚-1,1〛,b12=m〚-1,2〛,b21=m〚-2,1〛,c=m〚1,-1〛,c12=m〚1,-2〛,c21=m〚2,-1〛,d=m〚-1,-1〛,d12=m〚-1,-2〛,d21=m〚-2,-1〛},With[{min=Min[a,b,c,d]},Which[mind&&d12>d21,Reverse[Map[Reverse,m]],mind&&d12≤d21,Reverse[Map[Reverse,m]],minc&&c12>c21,Reverse[m],minc&&c12≤c21,Map[Reverse,m],minb&&b12>b21,Map[Reverse,m],minb&&b12≤b21,Reverse[m],m〚1,2〛>m〚2,1〛,m,True,m]]]
In[]:=
EightSymmetries[m_?SquareMatrixQ]:={m,Reverse[Map[Reverse,m]],m,Map[Reverse,m],Reverse[Map[Reverse,m]],Reverse[m],Map[Reverse,m],Reverse[m]}
Decomposition of a magic square into binary components:
Decomposition of a magic square into binary components:
This is Duerer’s famous magic square of order 4 from his 1514 painting “Melancholia I”
https://en.wikipedia.org/wiki/Melencolia_I
https://en.wikipedia.org/wiki/Melencolia_I
In[]:=
MagicSquareQ[Duerer1514={{15,2,1,12},{4,9,10,7},{8,5,6,11},{3,14,13,0}}]
Out[]=
True
The magic square starts here with 0, but adding 1 to all numbers gives the normal magic square:
In[]:=
Grid[{{Grid[Duerer1514,FrameAll,ItemSize{1,1.3},BackgroundLightOrange],Grid[Duerer1514+1,FrameAll,ItemSize{1,1.3},BackgroundLightOrange]}}]
Out[]=
Decompose an order 4 magic square (starting with 0) into binary components:
In[]:=
ToBinaryComponents[m_?SquareMatrixQ]:=Table[Map[IntegerDigits[#,2,4][[k]]&,m,{2}],{k,1,4}]
In[]:=
Grid[{Map[Grid,ToBinaryComponents[Duerer1514]]},FrameAll,BackgroundLightOrange]
Out[]=
|
|
|
|
Here every component is itself a binary magic square:
In[]:=
Map[MagicSquareQ,ToBinaryComponents[Duerer1514]]
Out[]=
{True,True,True,True}
And reconstruction from the binary components:
In[]:=
FromBinaryComponents[{a_,b_,c_,d_}]:=8a+4b+2c+d
In[]:=
Grid[1+FromBinaryComponents[ToBinaryComponents[Duerer1514]],FrameAll,ItemSize{1,1.3},BackgroundLightOrange]
I. All components are magic (528):
I. All components are magic (528):
There can be 8 different magic components:
In[]:=
A1={{1,0,1,0},{0,1,0,1},{0,1,0,1},{1,0,1,0}};A2={{1,0,0,1},{0,1,1,0},{1,0,0,1},{0,1,1,0}};A3={{1,0,0,1},{1,0,0,1},{0,1,1,0},{0,1,1,0}};A4={{0,0,1,1},{1,1,0,0},{1,1,0,0},{0,0,1,1}};A5={{1,0,1,0},{1,0,1,0},{0,1,0,1},{0,1,0,1}};A6={{0,0,1,1},{1,1,0,0},{0,0,1,1},{1,1,0,0}};A7={{1,1,0,0},{1,0,1,0},{0,1,0,1},{0,0,1,1}};A8={{0,1,0,1},{1,1,0,0},{0,0,1,1},{1,0,1,0}};
In[]:=
Grid[Partition[MapIndexed[Labeled[Grid[#,FrameTrue,BackgroundLightOrange],]&,{A1,A2,A3,A4,A5,A6,A7,A8}],4]]
A
#2[[1]]
Out[]=
|
|
|
| ||||||||
|
|
|
|
They are indeed magic:
In[]:=
Map[MagicSquareQ,{A1,A2,A3,A4,A5,A6,A7,A8}]
Out[]=
{True,True,True,True,True,True,True,True}
And four of them are panmagic (A1, A2, A5, A6):
In[]:=
Map[PanDiagonalMagicSquareQ,{A1,A2,A3,A4,A5,A6,A7,A8}]
Out[]=
{True,True,False,False,True,True,False,False}
The complements are also magic:
In[]:=
Map[MagicSquareQ,1-{A1,A2,A3,A4,A5,A6,A7,A8}]
Out[]=
{True,True,True,True,True,True,True,True}
The complements are also pan magic if the original is panmagic:
In[]:=
Map[PanDiagonalMagicSquareQ,1-{A1,A2,A3,A4,A5,A6,A7,A8}]
Fitting shows then that there are 11 combinations with all four components magic:
And there are sixteen possibilities to replace a component A with its complement 1-A:
This leads to 528 magic squares (with magic components)
There are 528 such squares:
They are all magic:
They are all in Frenicle normal form:
48 of them are pandiagonal magic squares:
II. There are also semimagic components possible
II. There are also semimagic components possible
Fitting gives two examples of magic squares of order 4 with semimagic components. I give here only the first example:
Only the first component is magic:
But all components are semi magic squares:
And three transformations for the type B:
Compare to:
a) only one component is a B-Form: (192)
This leads to 48 magic squares:
And now he uses the three transforms from above to quadrupple this number:
b) Two components are B-Forms: (112)
Fitting shows, if there are two B forms, then there must be one C form and one A form (the details are quite tricky):
And now he uses the three transforms from above to quadrupple this number:
c) Three components are B-Forms: (48)
Fitting shows, if there are three B forms, then there must be one C form (the details are quite tricky):
And now he uses the three transforms from above to quadrupple this number:
Fitting then shows that there are no more magic squares of order 4 possible. So there are 880 different magic squares of order 4 in Frenicle normal form, as was conjectured by Frenicle before 1693.
Here are all 880 magic squares of order 4 in Frenicle normal form in groups of 40:
The pandiagonal magic squares are with lightblue background (401 to 448) the others with lightorange background:
The pandiagonal magic squares are with lightblue background (401 to 448) the others with lightorange background:
If the condition that a magic square is in Frenicle normal form is released, then there are 8 times as much magic squares.
Here are all 7040 possible magic squares of order 4 in 880 groups of 8 (only the first is in Frenicle normal form), the pandiagonal magic squares are with lightblue background (401 to 448), the others with lightorange background:
Here are all 7040 possible magic squares of order 4 in 880 groups of 8 (only the first is in Frenicle normal form), the pandiagonal magic squares are with lightblue background (401 to 448), the others with lightorange background: