Magic square
Magic square art & history :
1   2   3   4   5
image source:
commons.wikimedia.org

8 1 6
3 5 7
4 9 2
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9

Magic squares

The constant sum in every row, column and diagonal is called the magic constant or magic sum or magic number, M.
The magic constant of a normal magic square depends only on n and has the value M = n(n² + 1)/2
For normal magic squares of order n = 3, 4, 5, 6, 7,8,····, the magic constants are: 15, 34, 65, 111, 175, 260,····.




Magic square
Source: Wikimedia.org

Method for constructing a magic square of odd order (e.g. 3, 5, 7, 9,····).

A method for constructing magic squares of odd order was published by the French diplomat de la Loubère in his book A new historical relation of the kingdom of Siam (Du Royaume de Siam, 1693), under the chapter entitled The problem of the magical square according to the Indians. De la Loubère's method (Siamese method) operates as follows:

Starting from the central column of the first row with the number 1, the fundamental movement for filling the squares is diagonally up and right, one step at a time. If a filled square is encountered, one moves vertically down one square instead, then continuing as before. When a move would leave the square, it is wrapped around to the last row or first column, respectively.



Order-3 magic squares.

The sum of each row, column and diagonal is 15, the “magic number” for a 3 × 3 magic square.

step 1
  1  
     
     
step 2
  1  
     
    2
step 3
  1  
3    
    2
step 4
  1  
3    
4   2
step 5
  1  
3 5  
4   2
step 6
  1 6
3 5  
4   2
step 7
  1 6
3 5 7
4   2
step 8
8 1 6
3 5 7
4   2
step 9
8 1 6
3 5 7
4 9 2

Magic square
Source: Wikipedia's Siamese method
A simple example of the Siamese method. Starting with "1" in the middle colomn of the top row. Boxes are filled diagonally up and right until you are blocked. At this point you drop down one square and then continuing as before. When a move would leave the square, it is wrapped around to the last row or first column, respectively.



Order-5 magic squares.

The sum of each row, column and diagonal is 65, the “magic number” for a 5 × 5 magic square.

Magic square

step 1
    1    
         
         
         
         
step 2
    1    
         
         
        3
      2  
step 3
    1    
  5      
4        
        3
      2  
step 4
    1 8  
  5 7    
4 6      
        3
      2  
step 5
    1 8 15
  5 7 14  
4 6 13    
10 12     3
11     2 9
step 6
17   1 8 15
  5 7 14 16
4 6 13 20  
10 12 19   3
11 18   2 9
step 7
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9




Bachet de Méziriac method.

You can also construct a magic square of odd order by starting with "1" in the middle colomn immediately above the the center square. The method is the same as above except that when blocked the next number is placed in the same column two rows up rather than one row down.
Reference: William H.Benson and Oswald Jacoby (1976) New Recreations With Magic Squares. Published by General Publishing Company, Ltd., Toronto, Ontario, Canada.

step 1
         
    1    
         
         
         
step 2
      2  
    1    
         
         
        3
step 3
  6   2  
    1    
  5      
4        
        3
step 4
  6   2  
10   1    
  5     9
4     8  
    7   3
step 5
  6   2 15
10   1 14  
  5 13   9
4 12   8 16
11   7   3
step 6
  6 19 2 15
10 18 1 14 22
17 5 13 21 9
4 12   8 16
11   7 20 3
step 7
23 6 19 2 15
10 18 1 14 22
17 5 13 21 9
4 12 25 8 16
11 24 7 20 3




Method for constructing a doubly even order (4N + 0) magic square (e.g. 4, 8, 12, 16,····).

A method of constructing a magic square of doubly even order. Doubly even means an even multiple of an even integer; or 4N (e.g. 4, 8, 12,····), where N is an integer (e.g. 1, 2. 3,····). The resulting square was also called a mystic square by Joel B. Wolowelsky and David Shakow in their article describing a method for constructing a magic square whose order is a multiple of 4.



Method for constructing a 4 x 4 magic square.

A 4 × 4 magic square can be constructed by writing out the numbers from 1 to 16 consecutively in a 4 × 4 matrix and then interchanging those numbers on the diagonals that are equidistant from the center. (step 2→step 3).


Order-4 magic squares.

The sum of each row, column and diagonal is 34, the “magic number” for a 4 × 4 magic square.
Magic square

Magic square
Image source: commons.wikimedia.org





Order-8 magic squares.

The sum of each row, column and diagonal is 260, the “magic number” for a 8 × 8 magic square.

Step 1: All the numbers are written in the order from left to right across each row in turn, starting from the top left hand corner.
Step 2a: Interchanging those numbers (in red color) on the diagonals that are equidistant from the center. (Same method for constructing a 4 x 4 magic square.)
Step 2b: Generate a 4x4 sub-square lines. Note that 16 numbers are crossed by the lines. These numbers (in blue color) will be interchanged.
Step 3: These numbers (in blue color from step 2) can be interchanged with their diametrically opposite numbers to create a magic square:
(25<->40, 33<->32), (4<->61, 5<->60), (18<->47, 11<->54), (14<->51, 23<->42).

Magic square

<

Simplified method to create doubly even magic squares of higher order.

Similar method can also be seen at www.mazes.com Regular 4N+0 Magic Squares

Step 1: All the numbers are written in the order from left to right across each row in turn, starting from the top left hand corner.
Step 2: (a)Generate two major diagonal lines. Note that 16 numbers (in red color) are crossed by these 2 lines in 8x8 magic squares,
24 numbers in 12x12 magic squares and 32 numbers in 16x16 magic squares.
(b)Generate 4x4(N-1) sub-square lines. Note that 16 numbers (in blue color) are crossed by these lines in 8x8 magic squares,
48 numbers in 12x12 magic squares and 96 numbers in 16x16 magic squares.
Step 3: Write down these numbers in the order from left to right across each row. Their numbers will be exactly half of the total squares, e.g. 32 numbers in 8x8 magic squares,
72 numbers in 12x12 magic squares and 128 numbers in 16x16 magic squares.
In creating a 8x8 magic squares these 32 numbers are 1,4,5,8,10,11,14,15,18,19,22,23,25,28,29,32,33,36,37,40,42,43,46,47,50,51,54,55,57,60,61,64.
All we need to do is to fill these squares with the same numbers in reverse order:
64,61,60,57,55,54,51,50,47,46,43,42,40,37,36,33,32,29,28,25,23,22,19,18,15,14,11,10,8,5,4,1.

Magic square

Order-12 magic squares.

The sum of each row, column and diagonal is 870, the “magic number” for a 12 × 12 magic square.

In creating 12x12 magic squares, the 72 numbers that need to be reversed are 1,4,5,8,9,12,14,15,18,19,22,23,26,27,30,31,34,35,37,40,41,44,45,48,49,52,53,56,57,60,62,63,66,67,70,71,
74,75,78,79,82,83,85,88,89,92,93,96,97,100,101,104,105,108,110,111,114,115,118,119,122,123,126,127,130,131,133,136,137,140,141,144.

step 1 (12x12 squares)
1 2 3 4 5 6 7 8 9 10 11 12
13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72
73 74 75 76 77 78 79 80 81 82 83 84
85 86 87 88 89 90 91 92 93 94 95 96
97 98 99 100 101 102 103 104 105 106 107 108
109 110 111 112 113 114 115 116 117 118 119 120
121 122 123 124 125 126 127 128 129 130 131 132
133 134 135 136 137 138 139 140 141 142 143 144
step 2 (12x12 squares)
1 2 3 4 5 6 7 8 9 10 11 12
13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72
73 74 75 76 77 78 79 80 81 82 83 84
85 86 87 88 89 90 91 92 93 94 95 96
97 98 99 100 101 102 103 104 105 106 107 108
109 110 111 112 113 114 115 116 117 118 119 120
121 122 123 124 125 126 127 128 129 130 131 132
133 134 135 136 137 138 139 140 141 142 143 144

Magic square
step 3 (12x12 squares)
144 2 3 141 140 6 7 137 136 10 11 133
13 131 130 16 17 127 126 20 21 123 122 24
25 119 118 28 29 115 114 32 33 111 110 36
108 38 39 105 104 42 43 101 100 46 47 97
96 50 51 93 92 54 55 89 88 58 59 85
61 83 82 64 65 79 78 68 69 75 74 72
73 71 70 76 77 67 66 80 81 63 62 84
60 86 87 57 56 90 91 53 52 94 95 49
48 98 99 45 44 102 103 41 40 106 107 37
109 35 34 112 113 31 30 116 117 27 26 120
121 23 22 124 125 19 18 128 129 15 14 132
12 134 135 9 8 138 139 5 4 142 143 1





Method for constructing a singly even order (4N + 2) magic square (e.g. 6, 10, 14, 18,····).

It is more difficult to construct a magic square of singly even order. Singly even means an even integers, where they are divisible by 2, but not by 4.
The methods for creating singly even order magic squqres are not quite elegant as for odd order and doubly-even magic square in the sense that the methods are non-symmtrical and are largely empirical. We have developed a method for constructing magic squares of singly even order in a more systemic and symmetrical way.
You can click here to find out.

Order-6 magic squares ( Constructed with Strachey's method ).

The sum of each row, column and diagonal is 111, the “magic number” for a 6 × 6 magic square.

Step 1: Write out the numbers from 1 to 36 consecutively in a 6 × 6 matrix.
Step 2: Divide the grid into 4 quarters each having 9 cells and name them crosswise thus
A C
D B
Fill up the subsquare A with the numbers 1 to 9, then the subsquare B with the numbers 10 to 18,
then the subsquare C with the numbers 19 to 27, then the subsquare D with the numbers 28 to 36.
Step3: Using the Siamese method (De la Loubère method) for order-3 magic squares and complete the individual magic subsquares A,B,C,D,
Step 4: A magic square can then be constructed by exchanging just 3 pairs of numbers ( 8<->35, 4<->31, and 5<->32 ).
These pairs are located in corresponding cells between subsquare A and subsquare D.

6x6 matrix
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
2-way interchange
A A A C C C
A A A C C C
A A A C C C
D D D B B B
D D D B B B
D D D B B B
4-way exchange
1 2 3 19 20 21
4 5 6 22 23 24
7 8 9 25 26 27
28 29 30 10 11 12
31 32 33 13 14 15
34 35 36 16 17 18
step 3
8 1 6 26 19 24
3 5 7 21 23 25
4 9 2 22 27 20
35 28 33 17 10 15
30 32 34 12 14 16
31 36 29 13 18 11
step 4
35 1 6 26 19 24
3 32 7 21 23 25
31 9 2 22 27 20
8 28 33 17 10 15
30 5 34 12 14 16
4 36 29 13 18 11


Magic square





Order-10 magic squares.

The sum of each row, column and diagonal is 505, the “magic number” for a 10 × 10 magic square.

Strachey's method can be used to construct singly even order (4N + 2) magic squares(e.g. 6, 10, 14, 18,····).
The number of corresponding pairs that have to be exchanged is ( n²/4 )-n .
A 6x6 magic magic square (N=1, n=6) can be made by additional exchanging 3 pairs of corresponding numbers.
A 10x10 magic square (N=2,n=10) can therefore be made by additional exchanging 15 pairs of corresponding numbers (in yellow color).
However, the pattern of exchanging seems to be quite arbitrary and non-symmetrical.

step 1
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70
71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100
step 2
1 2 3 4 5 51 52 53 54 55
6 7 8 9 10 56 57 58 59 60
11 12 13 14 15 61 62 63 64 65
16 17 18 19 20 66 67 68 69 70
21 22 23 24 25 71 72 73 74 75
76 77 78 79 80 26 27 28 29 30
81 82 83 84 85 31 32 33 34 35
86 87 88 89 90 36 37 38 39 40
91 92 93 94 95 41 42 43 44 45
96 97 98 99 100 46 47 48 49 50

step 3
17 24 1 8 15 67 74 51 58 65
23 5 7 14 16 73 55 57 64 66
4 6 13 20 22 54 56 63 70 72
10 12 19 21 3 60 62 69 71 53
11 18 25 2 9 61 68 75 52 59
92 99 76 83 90 42 49 26 33 40
98 80 82 89 91 48 30 32 39 41
79 81 88 95 97 29 31 38 45 47
85 87 94 96 78 35 37 44 46 28
86 93 100 77 84 36 43 50 27 34
step 4
92 99 1 8 15 67 74 51 58 40
98 80 7 14 16 73 55 57 64 41
4 81 88 20 22 54 56 63 70 47
85 87 19 21 3 60 62 69 71 28
86 93 25 2 9 61 68 75 52 34
17 24 76 83 90 42 49 26 33 65
23 5 82 89 91 48 30 32 39 66
79 6 13 95 97 29 31 38 45 72
10 12 94 96 78 35 37 44 46 53
11 18 100 77 84 36 43 50 27 59


We have developed a method for constructing magic squares of singly even order in a more systemic way.
Click here to find out.