Transformations Summary

But_Sqrs.gif (1906 bytes) Aro_up.gif (318 bytes) But_Home.gif (2176 bytes) But_Strs.gif (1861 bytes) But_Patt.gif (1837 bytes)

Introduction

Enjoy.gif (2307 bytes)This page became necessary when the material on order-4 transformations accumulated beyond my wildest expectations. I started with a page called ‘Transformations and Patterns’. I soon had to start another one called "More Order-4 Transformations" which also grew too fast. Hopefully this one will be sufficient to hold any remaining material!

However, my hope is that in reading this material, you will say "Ah-ha, but how about …".
I am well aware that there is still much to discover about order-4 magic squares and methods of transforming one to another. I look forward to comments, constructive criticism and hearing of new discoveries.
Hey, I just thought, how about complementing the LSD of the octal representation, or how about ...

Binary Digit Swap

6 transitions that work for all groups I to VI-P by exchanging some digits.

Complementing binary digits

6 transitions that work for all groups I to VI-P by complementing some digits.

Summary

A table lists 48 transformations that work on all magic squares of at least 1 Dudeney group, showing characteristics. 30 work on ALL groups I to VI-P.

Addendum  Mar. 12, 2002        

Some slightly differing results from Holger Danielsson.

Intro to Order-4 Transforms.

Back to the introduction page to this subject. (Also up arrow above and at end).

More Order-4 Transforms

Page 2 of 4 pages on this subject.

Fellows Transformations.

His base-4 digit manipulation transformations. Also a 4 magic square loop.

rule-w.gif (2726 bytes)

Transformations using binary numbers

The investigation of the following transformations was motivated by reviewing the work Ralph Fellows is doing with transformations involving manipulation with the digits of the magic square numbers.
He has developed several transformations involving base 4 representation. This gave me the idea to try the same with base 2 representation.
While he has concentrated on developing transformations that may be used with any order, I choose to restrict my investigations to transformations that may work only with order-4 magic squares. Of course the binary number system is ideal for representing order-4 numbers because 4 binary digits exactly covers the decimal range 0 to 15.

rule-n.gif (1968 bytes)

Binary Digit Swap

The numbers 0 to 15 in a magic square may be represented by the binary numbers 0 to 1111.

Then if we swap a pair of binary digits and convert the resulting 4 digit number back to decimal, a new magic square may be obtained.

Exchange the MSD and the LSD

Call the digits a, b, c, and d starting from the left. This first procedure involves swapping digits a and d.

Original      Dec 0 to 15   change to base 2      Swap a and d          Dec 0 to 15   Dec 1 to 16 

112     III                                                                           203     III

01 08 12 13   00 07 11 12   0000 0111 1011 1100   0000 1110 1011 0101   00 14 11 05   01 15 12 06

14 11 07 02   13 10 06 01   1101 1010 0110 0001   1101 0011 0110 1000   13 03 06 08   14 04 07 09

15 10 06 03   14 09 05 02   1110 1001 0101 0010   0111 1001 1100 0010   07 09 12 02   08 10 13 03

04 05 09 16   03 04 08 15   0011 0100 1000 1111   1010 0100 0001 1111   10 04 01 15   11 05 02 16

This procedure is the first entry in the following table which shows 5 other binary digit interchanges that also produce magic squares of the same group as the original.

Decimal 0 – 15

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

= Binary

0000

0001

0010

0011

0100

0101

0110

0111

1000

1001

1010

1011

1100

1101

1110

1111

Exchange a - d

0000

1000

0010

1010

0100

1100

0110

1110

0001

1001

0011

1011

0101

1101

0111

1111

Substitute number

0

8

2

10

4

12

6

14

1

9

3

11

5

13

7

15

Exchange b - c

0000

0001

0100

0101

0010

0011

0110

0111

1000

1001

1100

1101

1010

1011

1110

1111

Substitute number

0

1

4

5

2

3

6

7

8

9

12

13

10

11

14

15

Exchange a - c

0000

0001

1000

1001

0100

0101

1100

1101

0010

0011

1010

1011

0110

0111

1110

1111

Substitute number

0

1

8

9

4

5

12

13

2

3

10

11

6

7

14

15

Exchange b - d

0000

0100

0010

0110

0001

0101

0011

0111

1000

1100

1010

1110

1001

1101

1011

1111

Substitute number

0

4

2

6

1

5

3

7

8

12

10

14

9

13

11

15

Exchange a-c, b-d

0000

0100

1000

1100

0001

0101

1001

1101

0010

0110

1010

1110

0011

0111

1011

1111

Substitute number

0

4

8

12

1

5

9

13

2

6

10

14

3

7

11

15

Exchange a-d, b-c

0000

1000

0100

1100

0010

1010

0110

1110

0001

1001

0101

1101

0011

1011

0111

1111

Substitute number

0

8

4

12

2

10

6

14

1

9

5

13

3

11

7

15

Renumber the original magic square using integers 0 to 15 then look up the corresponding number. Increase each number in the magic square by 1 to obtain a new magic square with integers 1 to 16

All these transformations are reversible. Apply the same transformations the second time and the original magic square is obtained.

Exchanging the first two binary digits and then exchanging the last two digits result in no successful transformations.

Results of above transformations

 

I

II

III

IV

V

VI-P

VI-S

VII

VIII

IX

X

XI

XII

Exchange a & d

all?

all?

all?

all?

all?

all?

some

some

none?

some

some

none

none

Exchange b & c

all?

all?

all?

all?

all?

all?

some

none?

none?

none?

none?

none

none

Exchange a & c

all?

all?

all?

all?

all?

all?

some

none?

none?

none?

none?

none

none

Exchange b & d

all?

all?

all?

all?

all?

all?

some

none?

none?

none?

none?

none

none

Exchange a-c, b-d

all?

all?

all?

all?

all?

all?

some

some

some

some

some

1 only

none

Exchange a-d, b-c

all?

all?

all?

all?

all?

all?

some

none?

none?

none?

none?

none

none

All magic squares I tested of groups I to VI-P transformed successfully, but in each case, the resulting magic square was different
In all cases the resulting magic square belonged to the same group as the original one.
The question marks in the above table indicate that I have not tested all magic squares in that group so there could still be an exception.

Shortcut for above transformations

Simply substitute the following numbers for the numbers of the original magic square to obtain the transformed one.

Decimal 1 to 16

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

Exchange a & d

1

9

3

11

5

13

7

15

2

10

4

12

6

14

8

16

Exchange b & c

1

2

5

6

3

4

7

8

9

10

13

14

11

12

15

16

Exchange a & c

1

2

9

10

5

6

13

14

3

4

11

12

7

8

15

16

Exchange b & d

1

5

3

7

2

6

4

8

9

13

11

15

10

14

12

16

Exchange a-c, b-d

1

5

9

13

2

6

10

14

3

7

11

15

4

8

12

16

Exchange a-d, b-c

1

9

5

13

3

11

7

15

2

10

6

14

4

12

8

16

 An Example using the same original magic square for 6 transformations.

Original       Swap a<->d     Swap b<->c     Swap a<->c     Swap b<->d     Swap a-c,b-d   Swap a-d,b-c

32     V       165    V       66     V       114    V       97     V       103    V       173    V

01 04 16 13    01 11 16 06    01 06 16 11    01 10 16 07    01 01 16 10    01 13 16 04    01 13 16 04

14 15 03 02    14 08 03 09    12 15 05 02    08 15 09 02    14 12 03 05    08 12 09 05    12 08 05 09

07 06 10 11    07 13 10 04    07 04 10 13    13 06 04 11    04 06 13 11    10 06 07 11    07 11 10 06

12 09 05 08    12 02 05 15    14 09 03 08    12 03 05 14    15 09 02 08    15 03 02 14    14 02 03 15

rule-w.gif (2726 bytes)

Complementing binary digits

Complementing individual digits of the binary representation of the magic square numbers also result in successful transformations.

Again we will identify the digits as a, b, c, d starting from the left hand (MSD) digit.

Complement a

Original      Dec 0 to 15   change to base 2      Swap a and d          Dec 0 to 15   Dec 1 to 16 

112     III                                                                           789     III

01 08 12 13   00 07 11 12   0000 0111 1011 1100   1000 1111 0011 0100   08 15 03 04   09 16 04 05

14 11 07 02   13 10 06 01   1101 1010 0110 0001   0101 0010 1110 1001   05 02 14 09   06 03 15 10

15 10 06 03   14 09 05 02   1110 1001 0101 0010   0110 0001 1101 1010   06 01 13 10   07 02 14 11

04 05 09 16   03 04 08 15   0011 0100 1000 1111   1011 1100 0000 0111   11 12 00 07   12 13 01 08

This procedure is the first entry in the following table which shows 5 other binary digit complement transformations.
Here I show the original magic square number and the decimal number to substitute for it to obtain the new magic square.
These numbers were found by working with the binary representation of the decimal numbers 0 to 15, (similar to the above example).
All these transformations produce different magic squares but in each case the new square belongs to the same group as the original.
Complementing a and b or c and d is the same as complementing the MSD or the LSD of the base 4 representation (Fellows).
Not yet tested. Complementing 3 of the 4 binary digits (i.e. a, b, c or a, b, d, or a, c, d or b, c, d).

Decimal 1 – 16

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

Complement a (MSD)

9

10

11

12

13

14

15

16

1

2

3

4

5

6

7

8

Complement b

5

6

7

8

1

2

3

4

13

14

15

16

9

10

11

12

Complement c

3

4

1

2

7

8

5

6

11

12

9

10

15

16

13

14

Complement d (LSD)

2

1

4

3

6

5

8

7

10

9

12

11

14

13

16

15

Complement a and c

11

12

9

10

15

16

13

14

3

4

1

2

7

8

5

6

Complement b and d

6

5

8

7

2

1

4

3

14

13

16

15

10

9

12

11

Results of above transformations

 

I

II

III

IV

V

VI-P

VI-S

VII

VIII

IX

X

XI

XII

Complement  a (MSD)

all?

all?

all?

all?

all?

all?

some

some

some some

some

some

some

Complement b

all?

all?

all?

all?

all?

all?

some

some

some some

some

some

none

Complement c

all?

all?

all?

all?

all?

all?

some

none?

some some

none?

none

none

Complement d (LSD)

all?

all?

all?

all?

all?

all?

some

some

some some

none?

some

some

Complement a and c

all?

all?

all?

all?

all?

all?

some

none?

none? none?

none?

none

none

Complement b and d

all?

all?

all?

all?

all?

all?

some

none?

none? none?

none?

none

none

All magic squares I tested of groups I to VI-P transformed successfully, but in each case, the resulting magic square was different (but duplicates within each group. see below).
In all cases the resulting magic square belonged to the same group as the original one.
The question marks in the above table indicate that I have not tested all magic squares in that group so there could still be an exception.

An Example using the same original magic square for 6 transformations.

Original      comple. a     comple. b     comple. c     comple. d     comple. a,c   comple. b,d

32     V      577     V     577     V     425     V     228     V     228     V     425     V

01 04 16 13   09 12 08 05   05 08 12 09   03 02 14 15   02 03 15 14   11 10 06 07   06 07 11 10

14 15 03 02   06 07 11 10   10 11 07 06   16 13 01 04   13 16 04 01   08 05 09 12   09 12 08 05

07 06 10 11   15 14 02 03   03 02 14 15   05 08 12 09   08 05 09 12   13 16 04 01   04 01 13 16

12 09 05 08   04 01 13 16   16 13 01 04   16 11 07 06   11 10 06 07   02 03 15 14   15 14 02 03

Notice that there are only 3 new magic squares with 2 versions of each.
I was shocked when I discovered this and suspected I had made a mistake somewhere. However, on further investigation, I found this was general for all groups I to VI-P. In each case that I investigated (except 2). I found 3 sets of two new squares. There seems to be no order as to how these sets are arranged. I present 2 examples from each group.

Original magic square and group

Complement
a

Complement
b

Complement
c

Complement
d

Complement
a and c

Complement
b and d

102 --- I

828

785

279

279

785

828

116 --- I

647

364

485

304

304

116

21 ---- II

591

213

445

213

213

21

27 --- II

583

421

421

233

233

583

112 --- III

789

789

289

289

834

834

113 --- III

790

790

290

290

835

835

24 ---- IV

216

589

443

216

589

443

735 --- IV

191

399

399

572

572

191

32 ---- V

577

577

425

228

228

425

173 --- V

853

798

362

362

798

853

16 ----VI-P

435

224

435

224

16

16

638 ---VI-P

298

490

298

490

638

638

In each case the magic square generated by the transformation is a member of the same group as the originating magic square.
I have indicated the pairs in a group by colors (one II has a triplet).
#116 and # 21 both have generated magic squares that are not paired up. They both have disguised versions of themselves.
However, # 638 produced two disguised versions of itself!
I’d say this is a pretty mixed up situation. Very unlike the orderly results of most of the transitions.

Top.gif (1256 bytes)rule-w.gif (2726 bytes)

Summary

 

  Transformation

I

II

III

IV

V

VI-P

VI-S

VII

VIII

IX

X

XI

XII

  Complement each number

1

2

3

4

5

6-P

6-S

7

8

9

10

11

12

1 Swap rows 1 and 2

--

2

--

--

--

--

--

--

--

--

--

--

--

1 Swap columns 1 and 2

--

2

--

--

--

--

--

--

--

--

--

--

--

1 Swap rows and columns 1 and 2

3

2

1

4

6-P

5

--

--

--

--

--

--

--

2 Swap rows 1 and 3

1

--

--

--

--

--

--

--

--

--

--

--

--

2 Swap columns 1 and 3

1

--

--

--

--

--

--

--

--

--

--

--

--

2 Swap rows and columns 1 and 3

1

3

2

6-P

5

4

--

--

--

--

--

--

--

3 Swap rows 1 and 4

--

--

3

--

--

--

--

--

--

--

--

--

--

3 Swap columns 1 and 4

--

--

3

--

--

--

--

--

--

--

--

--

--

3 Swap rows and columns 1 and 4

2

1

3

5

4

6-P

6-S

10

9

8

7

12

11

3 Swap rows 2 and 3

--

--

3

--

--

--

--

--

--

--

--

--

--

3 Swap columns2 and 3

--

--

3

--

--

--

--

--

--

--

--

--

--

3 Swap rows and columns 2 and 3

2

1

3

5

4

6-P

6-S

10

9

8

7

12

11

2 Swap rows 2 and 4

1

--

--

--

--

--

--

--

--

--

--

--

--

2 Swap columns2 and 4

1

--

--

--

--

--

--

--

--

--

--

--

--

2 Swap rows and columns 2 and 4

1

3

2

6-P

5

4

--

 

--

--

--

--

--

1 Swap rows 3 and 4

--

2

--

--

--

--

--

--

--

--

--

--

--

1 Swap columns 3 and 4

--

2

--

--

--

--

--

--

--

--

--

--

--

1 Swap rows and columns 3 and 4

3

2

1

4

6-P

5

--

--

--

--

--

--

--

  Change row & col. order to 1-3-4-2

2

3

1

6-P

4

5

--

--

--

--

--

--

--

  Change row & col. order to 1-4-2-3

3

1

2

5

6-P

4

--

--

--

--

--

--

--

4 Change row order to 2-1-4-3

1

2

3

4

5

6-P

--

--

--

--

--

--

--

4 Change column order to 2-1-4-3

1

2

3

4

5

6-P

--

--

--

--

--

--

--

4 Change row & column order to 2-1-4-3

1

2

3

4

5

6-P

6-S

9

10

7

8

11

12

  Change row order to 3-1-4-2

--

--

3

--

--

--

--

--

--

--

--

--

--

  Change col. order to 3-1-4-2

--

--

3

--

--

--

--

--

--

--

--

--

--

  Change row & col. order to 3-1-4-2

2

1

3

5

4

6-P

6-S

8

7

10

9

12

11

5 Move rows and/or col. to opposite side

1

--

--

--

--

--

--

--

--

--

--

--

--

  Move quadrants clockwise

--

--

3

--

--

--

--

--

--

--

--

--

--

  Move quadrants counter-clockwise

--

--

3

--

--

--

--

--

--

--

--

--

--

6 Convert quadrants to rows

3

--

1

--

--

--

--

--

--

--

--

--

--

7 Change diagonals to rows

5

4

6-P

4/2

1/5

3-6S

6-P*

--

--

--

--

--

--

8 Exchange binary digits a and d

1

2

3

4

5

6-P

some

some

--

some

some

none

none

8 Exchange binary digits b and c

1

2

3

4

5

6-P

some

--

--

--

--

none

none

8 Exchange binary digits a and c

1

2

3

4

5

6-P

some

--

--

--

--

none

none

8 Exchange binary digits b and d

1

2

3

4

5

6-P

some

--

--

--

--

none

none

8 Exchange binary digits a and c, b and d

1

2

3

4

5

6-P

some

some

some

some

some

some

none

8 Exchange binary digits a and d, b and c

1

2

3

4

5

6-P

some

--

--

--

--

none

none

  Complement binary digit a (MSD)

1

2

3

4

5

6-P

some

some

some

some

some

some

some

  Complement binary digit b

1

2

3

4

5

6-P

some

some

some

some

some

some

none

  Complement binary digit c

1

2

3

4

5

6-P

some

--

some

some

--

none

none

  Complement binary digit d (LSD)

1

2

3

4

5

6-P

some

some

some

some

some

some

some

9 Complement binary digit a and c

1

2

3

4

5

6-P

some

--

--

--

--

none

none

  Complement binary digit b and d

1

2

3

4

5

6-P

some

--

--

--

--

none

none

10 Base 4 digit swap (Fellows)

1

2

3

4

5

6-P

some

some

some

some

some

none

none

10 Complement Base 4 LSD (Fellows)

1

2

3

4

5

6-P

some

some

some

some

some

none

none

10 Complement Base 4 MSD (Fellows)

1

2

3

4

5

6-P

some

some

some

some

some

none

none

  Congruent modulo 8 (Saint-Pierre) 1 2 3 4 5 6-P -- 7 8 -- -- -- --

Notes:

  1. Swapping 3 and 4 returns different magic squares then swapping 1 and 2.
  2. Swap 1 and 3 transformation and swap 2 and 4 transformation return different magic squares.
  3. Swapping 2 and 3 returns the same magic squares as swapping 1 and 4, but with different orientation.
  4. The same as exchanging rows and columns 1 and 2 with 3 and four or changing order 3-4-1-2 or 1 and 3, 2 and 4 or swapping kitty-corner quadrants. In each case the result is the same magic square (although the orientation may be different.
  5. Moving 1 row at a time and then cycling through moving the columns result in a loop of 16 pandiagonal magic squares.
  6. Converting the quadrants of a group III (associated) magic square to rows will form a group I (pandiagonal) magic square.
    By starting with a different quadrant each time, and cycling through the 4 positions of the quadrant a loop of 16 pandiagonal magic squares are created.
    The transformation works in reverse to form 16 associated magic squares from 1 pandiagonal.
  7. Using main and short diagonal pairs. Groups IV to VI-P go to 2 other groups depending on orientation. 48 of VI-S go to VI-P.
  8. a is Most Significant Digit, d is Least Significant Digit.
    All transformations involving binary digits result in magic squares belonging to same group as original.
  9. Complementing a and b (or c and d) is the same as complementing the MSD (or LSD) of the base 4 number.
  10. These 3 Base 4 transformations all return different magic squares. See these on my Fellows page.

rule-w.gif (2726 bytes)

Addendum  Mar. 12, 2002        

Holger Danielsson, summarized two months of investigations into this subject with the following document, emailed to me Feb. 26, 2002
I have edited it slightly for brevity, and offer it here with no further comment. He no longer seems to have a web site (Sept./09).
I have not confirmed his findings, but this illustrates how complex this subject is.

Swap rows OR columns only
    ·        works for all 208 squares of the groups 1..5 and the semi-pandiagonal squares of group 6a
     ·     don’t work for groups 6b...12
                          in table 1 you can see, how many different squares are created

But surprisingly enough, there are differences depending on what s squares are used (normalized squares, squares arranged like the Dudeney pattern, and my squares built with the additions tables of Benson-Jacoby)
   a)   transformation of group 2 squares will create all 48 squares in this group, which doesn’t hold for the other groups
   b)   transformations of groups 2, 4, 5, 6a will create all squares, when using squares, which are arranged like the Dudeney pattern.
   c)  and most surprising: the squares which i built from the additions tables of Benson-Jacoby will create all squares of the group. This is true for every group.

Swap rows OR columns
from group transformed squares
to group Benson Dudeney normalized
1 1 48 44 (48) 44 (48)
2 2 48 48 48
3 3 48 40 (48) 40 (48)
4 4 96 96 84 (96)
5 5 96 96 92 (96)
6a 6a 96 96 92 (96)

44 (68) means that 68 squares are transformed to this group, where only 44 of them are different. If only one number shown, all transformed squares are different.

Diagonals to rows
from group   transformed squares
to group Benson Dudeney normalized
1 1 1 1 44 (48)
2 2 2 2 48
3 3 3 3 40 (48)
4 4 96 96 84 (84)
  2     12 (12)
5 5 96 96 28 (28)
  1     44 (68)
6a 6a 96 96 36 (36)
  3     36 (60)

 

Change diagonals to rows
This is the part with errors as you can see in table 2:
    ·        the transformed squares are in the same group and you will get all squares  for group 1..3
    ·        but this is not true for groups 4, 5 and 6a. As you can see for example, there are 28 of the normalized squares which will stay in  group 5,
          but 68 of them are transformed to group 1, where 44 of them are really different.
   ·        you are right, when you say that the destination group is determinedby the orientation of the complement pairs (squares with horizontal pairs
         go to group 1, squares with vertical pairs will stay in group 5)
   ·        but it is false that 48 will stay and  48 will change the group (see the results above). Where do you have these counts from?
   ·        and still surprising again: using my Benson-Jacoby squares or the squares arranged like the Dudeney pattern all squares will stay in their
         groups and also create all the squares in the group.

Holger Danielsson Feb. 26, 2002

rule-w.gif (2726 bytes)

Please send me Feedback about my Web site!Aro_left.gif (305 bytes)Top.gif (1256 bytes)Aro_up.gif (318 bytes)home07.gif (2303 bytes)Aro_right.gif (304 bytes)

Last updated September 11, 2009
Harvey Heinz   harveyheinz@shaw.ca
Copyright © 2000 by Harvey D. Heinz