Monday 9 May 2022

Magic Squares

A magic square occurs when all the rows, columns and main diagonals add up to the same number. Each of the numbers in the square is unique, only occurs once

We can construct magic squares by combining what are known as 'magic carpets'.

For a 3 by 3 magic square let us make two magic carpets

A carpet just contains three numbers, repeated three times, each row and column contains each only once.

Think of two numbers, say 1 and 4

4

 

 

 

4

 

 

 

4

Insert the 4's along the main diagonal then just place the 1's so that each column and each row only contains it once

4

 

1

1

4

 

 

1

4

We see remaining number 'must be' 7, and 1 + 4 + 7 = 4 + 4 + 4

4

7

1

1

4

7

7

1

4

Let us make another magic carpet, this time pick two numbers say 2 and 6, then place the 6's on the other diagonal and we see that 10 must be the third number.

2

10

6

10

6

2

6

2

10

To get a magic square we just add these two carpets

A tighter definition of a magic square, is that is contains the first 9 numbers for say a 3 by 3 square, 

i.e. for 1, 2, 3, 4, 5, 6, 7, 8 and 9, the sum or total is 45

=  1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9

= {1 + 9} + {2 + 8} + {3 + 7} + {4 + 6} + 5

= 10 + 10 + 10 + 10 + 5

= 45

Each row must then total to 45 ¸ 3 = 15

The 'average' number for each 'cell' is then 5. Perhaps we'd then expect 5 to be the centre number which it is.

Let us construct a 3 by 3 square from these 9 numbers

Start by placing 5 in the centre

 

 

 

 

5

 

 

 

 

let us try to place 1 in one of the corners, then we get 9 in the opposite corner

1

 

 

 

5

 

 

 

9

we quickly see there are only two possible positions for 2

because 1 + 2 + 12 = 15 but 12 is not one of our nine numbers

1

 

 

8

5

2

6

0

9

we see this eventually breaks down as the number 0 is not one of our 9

So we know now, that 1 is not a corner number. So we start again

Try 2 in the middle side column

 

1

 

2

5

8

 

9

 

where can we put 3,

we see that we can't put it into any remaining available cell

so 2 must be on one of the lower corners

6

1

8

7

5

3

2

9

4

This magic square can represent 7 others as well

This can be rotated by 90° to give 3 others

Taking the mirror image or doing an axial symmetry in the y-axis, generates another square

This can be rotated by 90° to give 3 others

The original 3 by 3 square could have been made from two magic carpets

A 4 by 4 magic square can be generated using the two magic carpets

In a similar way to the 3 by 3 carpets, each number occurs once in a row or column

 


 

In this case, we see the generated magic square has some additional properties. The 2 by 2 subsquares each sum to 34 as do most of the off-diagonals.

 Another 4 by 4 magic square can be generated using the two magic carpets

This time it will also be a Pandiagonal Magic Square



This square is also pandiagonal, as all the off diagonals also sum to 34, as illustrated.

The sub 2 by 2 squares also sum to 34 as do the corner cells of the 3 by 3 squares. 


No comments:

Post a Comment