Professional Documents
Culture Documents
MSP NCR Convention San Sebastian College Guido David University of the Philippines Diliman March 2, 2013
A 3 3 magic square
8 3 4
1 5 9
6 7 2
A 3 3 magic square
8 3 4
1 5 9
6 7 2
15
15 15
15
= 15 = 15 = 15 15
Siamese Method
1
Siamese Method
1
Siamese Method
1
3 2
Siamese Method
1
4 3 2
Siamese Method
1
5 4 3 2
Siamese Method
1
5 4 6 3 2
Siamese Method
1
5 4 6 3 2 7
Siamese Method
17
23 4 10 11
24
5 6 12 18
1
7 13 19 25
8
14 20 21 2
15
16 22 3 9
Magic Sum
The magic sum is easily calculated as n(n2 + 1)/2 The center has value (n2 + 1)/2 The associates p and q must add to n2 + 1 Thus the associate of p is n2 + 1 p
Center
13
Associative/Self-Symmetric
5 4 10 13 21
16 22
Panmagic?
17
23 4 10 11
24
5 6 12 18
1
7 13 19 25
8
14 20 21 2
15
16 22 3 9
Not Panmagic
15
16 22 3 9
17
23 4 10 11
24
5 6 12 18
1
7 13 19 25
8
14 20 21 2
15
16 22 3 9
Panmagic (Ultramagic)
10
11 17 23 4
18
24 5 6 12
1
7 13 19 25
14
20 21 2 8
22
3 9 15 16
and
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5 5 5 5
and
3 4 0 1
4 0 1 2
0 1 2 3
1 2 3 4
2 3 4 0
1 2 3 4
3 4 0 1
0 1 2 3
2 3 4 0
4 0 1 2
The construction works because A and B are orthogonal (magic) Latin squares (Euler). A magic square that can be decomposed into two Latin squares is called regular.
Lemma
Let n be odd and I and J be n n matrices defined by (1). Let A = [aI + bJ + f(n)]mod n where 0 < |a|, |b| < n, and f(n) be defined such that Amm= (n 1)/2 where m = (n + 1)/2. If a and b are relatively prime to n, then A is a magic Latin square.
Let n be odd and I and J be n n matrices be given by (1). Let A and B be given by A = [aI + bJ + f(n)]mod n, B = [cI + dJ + g(n)]mod n (5) Then M = nA + B + 1 is a magic square if: (i) a, b, c, d are relatively prime to n (ii) |ad bc| 0 modn and relatively prime to n
Corollary 1
Let A, B be given by (5). If n is prime, then for 0 < |a|, |b|, |c|, |d| < n, M(A, B) = nA + B + 1 and M(B, A) are magic squares provided |ad bc| 0 modn. Note: the second condition is equivalent to: for any k, k(a, b) (c, d) in Zn Zn.
10
11 17 23 4 21 2 8
and
3 4 0 1
4 0 1 2
0 1 2 3
1 2 3 4
2 3 4 0
2 3 4 0
1 2 3 4
0 1 2 3
4 0 1 2
3 4 0 1
22
3 9 15 16
1
7 13 19 25
10
11 17 23 4
14
20 21 2 8
Pyramid Method
5 4 3 2 1 6 7 12 8 13 18 9 14 19 24 10 15 20 25
11
16
17
22 21
23
Pyramid Method
5 3 20 7 24 11 4 16 8 25 12 4 16 9 21 13 5 17 21 10 22 14 1 18 10 22 15 2 19 6 23
2 1 6
20 25 24
Pyramid Method
Iij
= i, Jij = j A = (I(n + 1)/2 + J(n + 1)/2 1)mod n B = (I(n 1)/2 + (n + 1)J/2 (n 1)/2)mod n M = nA + B
and
0 3 1 4
3 1 4 2
1 4 2 0
4 2 0 3
2 0 3 1
2 4 1 3
0 2 4 1
3 0 2 4
1 3 0 2
4 1 3 0
Pyramid Method
3
20 7 24 11
16
8 25 12 4
9
21 13 5 17
22
14 1 18 10
15
2 19 6 23
Symmetries
There are 8 symmetries each square: four 90o rotations and four mirror reflections The symmetries are elements of the dihedral group D4 with eight elements, generated by a rotation and a reflection
2
14 21 8 20
19
1 13 25 7
6
18 5 12 24
23
10 17 4 11
4
12 25 8 16
17
5 13 21 9
10
18 1 14 22
23
6 19 2 15
Other Equivalences:
Switching corresponding rows (and columns) results in an associative magic square. These are referred to as row or column permutations
22
14 1 18 10
9
21 13 5 17
16
8 25 12 4
15
2 19 6 23
The number of row permutations is (n 1)(n 3) = (n 1)!! This is to be divided by 2 (reflections). Thus R(n) = (n 1)!!/2 The number of row and column permutations R(n) = (n 1)!!(n 1)!! /4
Counting Pairings
Let n be prime (1, t) is a generator of a subgroup of Zn Zn The length of its orbit is n 1 There are n 1 possible values of t. Number of pairings of equivalence classes: (n 1)(n 2) There are (n 1) squares in each class
Counting Pairings
Thus the number of regular associative magic squares (n 2)(n 1)3 There are 8 symmetries for each square (D4) The number of unique regular ultramagic squares by this method is L(n) = (n 2)(n 1)3/8
Swapping Associates
The counting method only included magic squares obtained by the construction M(A,B). Other squares can be obtained by permuting associates. The condition is that associates retain self-symmetry
and
0 3 1 4
3 1 4 2
1 4 2 0
4 2 0 3
2 0 3 1
2 4 1 3
0 2 4 1
3 0 2 4
1 3 0 2
4 1 3 0
and
4 3 1 0
3 1 0 2
1 0 2 4
0 2 4 3
2 4 3 1
2 4 3 1
0 2 4 3
1 0 2 4
3 1 0 2
4 3 1 0
16
8 5 14 22
7
1 13 25 19
4
12 21 18 10
15
24 17 6 3
Pyramid Method
3
20 7 24 11
16
8 25 12 4
9
21 13 5 17
22
14 1 18 10
15
2 19 6 23
Counting Swaps
There are (n 1) possible values for the first slot (not including the center) After a slot is filled, its self-symmetric slot is also filled as well. Hence there are (n 3) possible values for the next slot. The total number of swaps is given by (n 1)(n 3)(n 5) = (n 1)!!
Counting Swaps
There are (n 1) repetitions using this method. Thus the number of unique swaps is G(n) = (n 3)(n 5) = (n 3)!!
The total number of unique regular prime order associative magic squares is given by U(n) = L(n)G(n)G(n) = (n 1)(n 2)(n 1)!!2/8 Including symmetries and row/column permutations, T(n) = (n 1)(n 2)(n 1)!!4/4
U(n)
1 96 8,640 1.65 108 3.50 1010 3.20 1015 1.32 1018
T(n)
8 12288 3.98 107 4.89 1015 1.49 1020 6.81 1029 9.12 1034
Construction Method
Choose A = (a b) and choose B satisfying Brees Criterion Permute associates which leave the center, first and last position fixed.
Example: n = 5
The valid pairs for A and B are: (1 1) (2 2) (3 3) (4 4) (1 2) (2 4) (3 1) (4 3) (1 3) (2 1) (3 4) (4 2) (1 4) (2 3) (3 2) (4 1) Associates for each of A and B may be swapped (swapping 1 and 3 only).
Example: n = 7
Example: n = 7
Choose A, then B not in the orbit of A For the swapping of associates, the subgroup of permutations is given by: K = {e, (1 5), (2 4), (1 4)(2 5), (1 4 5 2), (1 2 5 4), (1 2)(4 5), (1 5)(2 4)}
Questions/Comments
References
[1] M. Gardner, Magic Squares and Cubes, in: Time Travel and Other Mathematical Bewilderments., New York, W. H. Freeman 1988 pp. 213-225. [2] H.D. Heinz, J.R. Hendricks, Magic Square Lexicon: Illustrated, HDH 2000 pp. 20 24. [3] K. Pinn, C. Wieczerkowski, Number of magic squares from parallel tempering Monte Carlo, Int. J. Mod. Phys. 9 1998 541547. [4] A. de Winkel, The magic encyclopedia, 2012 http://www.magichypercubes.com/Encyclopedia/ [5] A.W. Grogono, Grogono magic squares 2004 http://www.grogono.com/magic/ [6] K. Setsuda, Part 4: New advanced study of magic squares and cubes, Chapter 4 Section 6, 2003 pp. 1-49
References
[7] W. Trump, Ultramagic squares of order 7, 2001, http://www.trump.de/magic-squares/ultramagic-7 [8] M. Kraitchik, Magic Squares, in: Mathematical Recreations. New York, Norton, 1942 pp. 142-192. [9] C. Moler, Magic Squares, in: Experiments with Matlab, Mathworks, Inc. 2011 pp. 112. [10] E.W. Weisstein, Magic square, From MathWorld [11] K. Ollerenshaw, Constructing pandiagonal magic squares of arbitrarily large size, Mathematics Today 45 (2005) 23-29, 66-69. [12] R.P. Nordgren, New constructions for special magic squares, International Journal of Pure and Applied Mathematics 78 (2012) 133-154.
References
[13] G. Abe, Unsolved problems on magic squares, Discrete Mathematics 127 (1994) 3-13. [14] A.O.L. Atkin, L. Hay, R.G. Larson, Enumeration and construction of pandiagonal Latin squares of prime order, Computers & Mathematics with Applications 9 (1983) 267-292. [15] A.J. Beyer, Enumeration of orthogonal Latin squares, Masters Thesis, SFSU 2010. [16] D. Borkovitz, F.K. Hwang, Multiplicative magic squares, Discrete Mathematics 47 (1983) 1-11. [17] T. Hayashi, Varahamihiras pandiagonal magic square of the order four, Historia Mathematica 14 (1987) 159-166.
References
[18] F. Hruska, Magic squares, matrices, planes and angles. J. Rec. Math. 23 (1991) 183-189. [19] R.H. Jeurissen, Divisor matrices and magic sequences. Discrete Mathematics 250 (2002) 125135. [20] Y. Kim, J. Yoo, An algorithm for constructing magic squares. Discrete Applied Mathematics 156 (2008) 28042809. [21] Y.H. Ku, N. Chen, On systematic procedures for constructing magic squares, Journal of the Franklin Institute 321 (1986) 337-350. [22] C.F. Laywine, G.L. Mullen, Generalizations of Boses equivalence between complete sets of mutually orthogonal Latin squares and affine planes, Journal of Combinatorial Theory A61 (1992) 13-35.
References
[23] P. Loly, I. Cameron, W. Trump, D. Schindel, Magic square spectra, Linear Algebra and its Applications 430 (2009) 26592680. [24] K. Ollerenshaw, D.S. Bree, Most-perfect pandiagonal magic squares: Their construction and enumeration, The Institute of Mathematics and its Applications, Southend-on-Sea, UK, 1998. [25] B. Turner, K. Warner, The structure and geometry of 44 pandiagonal matrices, Discrete Mathematics 34 (1981) 301-310. [26] D. Xu, Z. Mao, B. Chen, P. Huang, New recursive construction of magic squares using Kronecker compositional operations and its application in engineering computation, Systems Engineering Procedia 2 (2011) 331 337. [27] G. David, Numerical Construction of Regular Prime Order Ultramagic Squares (submitted 2012)