You are on page 1of 25

NPTEL C OURSE ON

M ATHEMATICS IN I NDIA :
F ROM V EDIC PERIOD TO M ODERN TIMES

Lecture 29
Magic Squares - Part 2

K. Ramasubramanian
IIT Bombay, Mumbai

Outline
I

The turaga-gati method of generating magic squares

Properties of 4 4 pan-diagonal magic squares

Generating magic squares based on the above properties

Constructing an 8 8 square (method due to T


. hakkura
Pher
u)

Narayan.as algorithm for constructing Samagarbha squares

Illustrative examples

Narayan.as folding method for 8 8 magic squares

Narayan.as folding method for odd squares

Modified algorithm for getting pan-diagonal squares

References

Obtaining 4 4 PD squares: Horse-move method

1
14
4
15

. ca:tua.=;*: +tua.=;ga:ga:tya.a d.Ea d.Ea (rea:Q:a:sa:mua:; ;va.a:va:*: ;Ea


nya:~ya k +.ma.ea:tk+.mea:Na . ca k+ea:E;k+.a-O;:k+a:nta:=e;Na . ca 10
.sa:v.ya.a:sa:v.ya:tua.=;*: +ma.=:a:tya.a k+ea::a:n,a :pra:pUa.=;yea:d:*:E H
.sa:ma:ga:BeRa :Sa.ea:q+Za:gxa:h:Ba:de :pra.ea:+ea ;a.va: a.Da:(a.a:ya:m,a 11
; a.ta:yRa:*: +ea:;ga:ta.a:na.Ma +.DvRa:~Ta.a:na.Ma . ca k+.NRa:ga.a:na.Ma . ca
A:*: ;a:na.Ma .sMa:ya.ea:gaH :pxa:Ta: a*+;: ta.ea .ja.a:ya:tea tua:yaH 12
I+h .sa:ma:ga:Ba.Ra:na.a:ma:pya:nyea:Sa.Ma o+;;va:(a:tua:BRa:d:a:t,a
. ca:tua.=;*: +tua.=;ga:ga:tya.a like the movement of horse in chess
d.Ea d.Ea choose pairs of numbers [from the sequence]
8
13
12
k+ea:E;k+.a in two adjacent cells
11
2
7
O;:k+a:nta:=e;Na . ca and at an interval of one cell
.sa:v.ya.a:sa:v.ya:tua.=;*: +ma.=:a:tya.a by the method of the horse
5
16
9
10

moving to the left and right


in a magic square with 16 cells

:Sa.ea:q+Za:gxa:h:Ba:de
.sa:ma:ga:Ba.Ra:na.a:ma:pya:nyea:Sa.Ma other magic squares of order 4m

Obtaining 4 4 PD squares: Horse-move method


A few illustrative examples
Example 1: (1,2) same a previous example; 3 placed in kos..thaikya
1

12

14

13

11

10

16

15

I It may be noted here that for the first yamalayugalas,


turaga motion is south-east (&).
I For the next it is south-west (.)
I For the next it is north-west (-)
I For the next it is north-east (%)

Example 2: (1,2,3,4) same a previous example; position of 5 swapped with 9.


1

11

14

12

13

16

15

10

I It may be noted here that for the first yamalayugalas,


turaga motion is south-east (&).
I For the next it is north-west (-)
I For the next it is south-west (.)
I For the next it is north-east (%)

Note: Main-diagonals remain unchanged; Off-diagonal elements get swapped.

Obtaining 4 4 PD squares: Horse-move method


A few illustrative examples
Magic squares corresponding to previous examples:
1

12

14

11

14

13

11

12

13

10

16

16

15

15

10

Magic squares obtained by swapping the positions of 3, (5,9).


1

14

12

14

11

11

13

12

13

10

16

16

15

15

10

Note: It is seen that these squares are obtained by simply swapping the elements of II
and IV columns, as expected.

Properties of 4 4 pan-diagonal magic squares


Property 1: Let M be a pan-diagonal 4 4 magic square with entries
1, 2, . . . , 16, which is mapped on to the torus by identifying
opposite edges of the square. Then the entries of any 2x2
sub-square formed by consecutive rows and columns on the
torus add up to 34.
1

12

13

15

10

16

14

11

1 + 12 + 15 + 6 = 1 + 12 + 14 + 7 = 34
Property 2: Let M be a 4 4 pan-diagonal magic square with entries
1, 2, . . . , 16, which is mapped on to the torus. Then, the sum
of an entry on M with another which is two squares away
from it along a diagonal (in the torus) is always 17.
1 + 16 = 6 + 11 = 15 + 2 = 4 + 13 = 14 + 3 = 9 + 8 = 17

Properties of 4 4 pan-diagonal magic squares


1

12

13

15

10

16

14

11

The neighbours of an element of a 4 4


pan-diagonal magic square (which is mapped on to
the torus as before) are the elements which are next
to it along any row or column. For example, 3, 5, 2
and 9 are the neighbours of 16 in the magic square
below.

Property 3: Let M be a 4 4 pan-diagonal magic square with entries


1, 2, . . . , 16, which is mapped on to the torus. Then the
neighbours of the entry 16 have to be the entries 2, 3, 5 and 9
in some order.

I We can use the above properties, and very easily construct 4 4

pan-diagonal magic squares starting with 1, placed in any desired cell.


I Let us work out some examples.

Samagarbha magic squares


Constructing an 8 8 square following the method given by T
u
. hakkura Pher
I This seems to be an old method for construction

of samagarbha or 4n 4n magic square from a


4 4 magic square which is also described by
T
u and N
ar
ayan.a. Consider 4 4
. hakkura Pher
PD square:

13

12

14
4

11

16

15

10

I With this we construct an 8 8 as follows:

I Conceive the 8 8

to be made up of
four 4 4 magic
squares.

I The four yamala-

yugal
ankas

are to
be placed using
turagagati as
shown.

5
2

6
8

7
13

10
12

14
16

11

15

Samagarbha magic squares


I In the previous step we
moved horizontally to the
right and filled the cells.
I Now, we start with the
quarter where we left and
move horizontally to the left.
I The four yamalayugal
ankas

are to be placed
using turagagati as earlier.

32
2

29

24

12

21

3
10
11

28

25

13

20

16

17

31
30
23
22

27

26

14

19

15

18

Finally we arrive at the pan-diagonal 8 8 magic square


I Again we start with the
quarter where we left and
move horizontally to the
right.
I One of the properties of an
8 8 pan-diagonal magic
square seems to be that the
sum of four alternating cells
along any diagonal adds to
half the magic sum.

32

61

36

28

57

40

62

35

31

58

39

27

29

64

33

25

60

37

63

34

30

59

38

26

24

53

44

13

20

49

48

54

43

10

23

50

47

14

19

12

21

56

41

16

17

52

45

55

42

11

22

51

46

15

18

Algorithm for constructing Samagarbha Magic Squares


The Folding Method or Samput.avidhi given by N
ar
ayan.a
.sa:ma:ga:BeRa :d
e k+a:yeRa C;a:d:k+.sMa:Ma ta:ya.ea:BRa:vea:de:k+.m,a

C;a:d;a.a:
a.Ba:Da.a:na:ma:nya:t,a k+=;sa:}.pua:f:va:a .sa:}.pua:f.ea ea:yaH

I+.a:d.a::.ca:ya.a:*:;a
Ba:d; a.ma:ta.a mUa:l+pa:a*:+sM
a:a.a:d;a.a

Consider two n n squares where n = 4m.

Of the two, one is called the coverer (ch


adaka)

The other is called the covered (ch


adya)

The folding here is just like folding the palms.

The first sequence known as m


ulapankti

[has],

any desired number as the first term (is..t


adi) and so too the
common difference (caya) [and], the number of terms in the
sequence is limited by the order of the magic square

Algorithm for constructing Samagarbha Magic Squares


The Folding Method or Samput.avidhi given by N
ar
ayan.a
1
a A:nya.a :pa.=:a:K.ya.a .~ya.a:t,a
ta:d
sa:tamua:Ka:.ca:ya:pa:a.*:+(
:d:Ba.a:a.p/ /

Similarly, (another) sequence having desired number as the first


item and also as the common difference is known as the
par
apankti.

Given below are a few examples of m


ulapankti

and par
apankti.

1
2
0
3
4

m
ulapankti

2
3
4
4
6
8
3
6
9
6
9 12
8 12 16

The vigraha is:

caya
1
2
3
3
4

0
1
2
4
0

par
apankti

1 2
3
2 3
4
3 4
5
6 8 10
3 6
9

caya
1
1
1
2
3

mua:Ka.*.
/ /
sa:ta.Ea mua:Ka:.ca:ya.Ea
a mua:Ka:.ca:ya.Ea A:Ba.a:a.p
a . ca:ya:(

A:Ba.a:a.p/ /
sa:ta:mua:Ka:.ca:ya.Ea ta.Ea ya:~ya.aH

:pa.*:
e H

.sa.a A:Ba.a:a.p
/ /
sa:ta:mua:Ka:.ca:ya:pa:a.
*:H

Algorithm for constructing Samagarbha Magic Squares


The Folding Method or Samput.avidhi given by N
ar
ayan.a

ea:ga.ea:
a.na:tMa :P+lM :pa.=;sa:ma.a:sa:sMa:Ba:+.m,a
mUa:l;a:K.ya:pa:a*:+ya.

l+b.Da:h:ta.a:pa.=;pa:a*:H

gua:Na.ja.a:K.ya.a .sa.a Ba:vea:t,a :pa:a*:H


I The result obtained by decreasing the sum of the m


ulapanti
[from the

desired magic sum],


I when divided by the sum of the parapanti
[is the gun.a].
I The elements of the parapanti
multiplied by that gun.a obtained is known

as the gun.apanti.

Example 1: Suppose the desired sum S = 40


I M
ula-panti
1

4.

Its sum sm = 10

I Par
a-panti
0

3.

Its sum sp = 6. Now,

S sm
40 10
=
=5
sp
6
I Using this we obtain Gun
0
. a-panti

10

15 .

Algorithm for constructing Samagarbha Magic Squares


The Folding Method or Samput.avidhi given by N
ar
ayan.a

 ;a yea .tea Ba:d:a:DRa:ta:~tua :pa:a=;vxa.ea


mUa:l+gua:Na.a:K.yea :pa:*:

2
1
3
4

The two sequences that are known as m


ulapanti
and gun.apanti,

are to be arranged [in the cells] in a cyclic mannerclockwise or


anti-clockwise2 from the centre of the magic square.

M
ula-panti
1

Gun.a-panti
0

10

3
4
2
1
2

2
1
3
4

3
4
2
1

cloc
kwis
e

ise
lockw

c
anti-

4.
15 .
clockwise
10
15
5
0
10
15
5
0

specified so in the next few lines of the verses.

anti-clockwise
5
0
10
15
5
0
10
15

Algorithm for constructing Samagarbha Magic Squares


The Folding Method or Samput.avidhi given by N
ar
ayan.a

+.DvRa:a.~Ta:tE
//// aH

ta:d:*:
E H

C;a:d:k+.sa:VC;a:d;a:ya.e

aH

:pxa:Ta:gya.a:
a.na

; a.ta:yRa:*:+e
a::a:nya.a:d;ae A:nya:ta.=;a.sma:U
/////// a:DvRa:ga.a:
a.na k+ea::a:
a.na
Ba:d;~ya.a:Da k
+.ma:gEaH

2
1
3
4

o+tk
+.ma:gEaH

:pUa.=;yea:d:DRa:m,a

The horizontal blocks in the first and the vertical ones in the other

Half of the magic square bhadra is to be filled in order

And the other half in the reverse order

3
4
2
1

2
1
3
4

3
4
2
1

cloc
k

wise

se
ckwi

clo
anti-

clockwise
10
15
5
0
10
15
5
0

anti-clockwise
5
0
10
15
5
0
10
15

Algorithm for constructing Samagarbha Magic Squares


The Folding Method or Samput.avidhi given by N
ar
ayan.a

Ba:d:a:Na.a: a.ma:h .sa:}.pua:f:a.va: a.DaH

2
1
3
4

3
4
2
1

C;a:d;a

2
1
3
4

3
4
2
1

-square

+
(folded)

o++ea nxa:h:a=;ta:na:yea:na

10
5
10
5

15
0
15
0

C;a:d:k

5
10
5
10

0
15
0
15

2
16
3
19

-square

8
14
7
11

Ba:d

17
1
18
4

13
9
12
6

-square

Notable features :
I Apart from the rows, columns and the principal diagonals, the broken

diagonals too add up to the magic sum (pan-diagonal).


I The 16 distinct quadruplets that can be considered also add up to the

magic sum.

A few examples of 4 4 Magic Squares


Example 2: Suppose the desired sum S = 120
I

M
ula-panti
2

8.

Its sum sm = 20

Par
a-panti
1

4.

Its sum sp = 10. Now,

S sm
120 20
=
= 10
sp
10
I

4
2
6
8

Using this we obtain Gun.a-panti


10

6
8
4
2

C;a:d;a

4
2
6
8

6
8
4
2

-square

+
(folded)

30
20
30
20

40
10
40
10

C;a:d:k

20
30
20
30

-square

10
40
10
40

20

30

14
42
16
48

40 .

26
38
24
32

Ba:d

44
12
46
18

-square

36
28
34
22

A few examples of 4 4 Magic Squares


Example 3: Suppose the desired sum S = 120 (with a different
m
ula and par
a-panti).

M
ula-panti
3

12 .

Par
a-panti
0

9.

Its sum sm = 30
Its sum sp = 18. Now,

120 30
S sm
=
=5
sp
18
I

6
3
9
12

Using this we obtain Gun.a-panti


0
9
12
6
3

C;a:d;a

6
3
9
12

-square

9
12
6
3

+
(folded)

30
15
30
15

45
0
45
0

15
15
30
15
13

-square

C;a:d:k

0
45
0
45

30

45 .
6
48
9
57

24
42
21
33

51
3
54
12

-square

Ba:d

39
27
36
18

A few examples of 4 4 Magic Squares


Example 4: Suppose the desired sum S = 128 .
I

M
ula-panti
3

12 .

Par
a-panti
2

5.

Its sum sm = 30
Its sum sp = 14. Now,

128 30
S sm
=
=7
sp
14
I

6
3
9
12

Using this we obtain Gun.a-panti


14
9
12
6
3

C;a:d;a

6
3
9
12

-square

9
12
6
3

+
(folded)

28
21
28
21

35
14
35
14

21
28
21
28

-square

C;a:d:k

21
14
35
14
35

28

20
38
23
47

35 .
30
40
27
31

41
17
44
26

-square

Ba:d

37
33
34
24

N
ar
ayan.as folding method for 8 8 magic square
N
ar
ayan.as Example: Sum = 260
M
ulapankti:

1, 2, 3, 4, 5, 6, 7, 8, Parapankti:

0.1.2.3.4.5.6, 7
[260(1+2+...+8)]

0, 8, 16, 24, 32, 40, 48, 56


Gun
. apankti:
. a = [0+1+2+...+7] = 8 and Gun
4
3
2
1
5
6
7
8

5
6
7
8
4
3
2
1

4
3
2
1
5
6
7
8

5
6
7
8
4
3
2
1

4
3
2
1
5
6
7
8

5
6
7
8
4
3
2
1

4
3
2
1
5
6
7
8
60
3
58
1
61
6
63
8

5
6
7
8
4
3
2
1
53
14
55
16
52
11
50
9

44
19
42
17
45
22
47
24

37
30
39
32
36
27
34
25

24
32
24
32
24
32
24
32

16
40
16
40
16
40
16
40

8
48
8
48
8
48
8
48

0
56
0
56
0
56
0
56

4
59
2
57
5
62
7
64

13
54
15
56
12
51
10
49

20
43
18
41
21
46
23
48

29
38
31
40
28
35
26
33

32
24
32
24
32
24
32
24

40
16
40
16
40
16
40
16

48
8
48
8
48
8
48
8

56
0
56
0
56
0
56
0

N
ar
ayan.as folding method for odd squares

*:;a mUa:l+gua:Na.a:K.yea .~taH :pra.a:gva:tsa.a:Dyea ta:d.a:a.d:ma:m,a


:pa:

a ma:Dya:mea k+ea:;k
e ;
a.l+Kea:t,a
A.a:a.d:ma.a:ya.a:mUa:DvRa:pa:*:;E

ta:d:DaH

+:a.a:*:;a:n,
k
+.mMa :pa:*
a ; a.Za:.a:*:;a:n,
a +.DvRa:taH

k
+.ma.a:t,a

;a.d

a ta:d
:ta.a:ya.a:d;a.a:~tu
:a ;a.d
:ta.a:ya.a:d;a.M a:(
a .sMa:
a.l+Kea:t,a
C;a:d;a:.cC;a:d:k+.ya.e

aH

:pra.a:gva:a.d
: a.DaH

.sMa:pua:f:nea Ba:vea:t,a

Two sequences referred to as the m


ulapankti

and the
gun.apankti

are to be determined as earlier. The first


number should be written in the middle cell of the top row
and below this the numbers of the sequence in order. The
rest of the numbers are to be entered in order from above.
The first number of the second sequence is to be written in
the same way [in the middle cell of the top row]; the second
etc. numbers are also to be written in the same way. The
rule of combining the covered and the coverer is also the
same as before.

N
ar
ayan.as folding method for odd squares
Example : 5 5 square adding to 65

M
ulapankti:

1, 2, 3, 4, 5; Parapankti:

0, 1, 2, 3, 4
Gun.a =

[65 (1 + 2 + 3 + 4 + 5)]
= 5;
[0 + 1 + 2 + 3 + 4]

Gun.apankti:

0, 5, 10, 15, 20

15

20

10

14

10

22

18

20

10

15

20

11

24

10

15

20

21

17

13

10

15

20

23

19

15

10

15

20

25

16

12

N
ar
ayan.as method happens to be an instance of combining two
Mutually Orthogonal Latin Squares. However, it does not yield a
pan-diagonal magic square as the diagonal elements of the squares
are not all different.

Modification of N
ar
ayan.as sam
. put.a for odd squares
Example : 5 5 square adding to 65

We may modify the above prescription and construct pan-diagonal


magic squares for all orders n 5 as follows.
M
ulapankti:

1, 2, 3, 4, 5;
Gun.a =

Parapankti:

0, 1, 2, 3, 4

[65 (1 + 2 + 3 + 4 + 5)]
= 5; Gun.apankti:

0, 5, 10, 15, 20
[0 + 1 + 2 + 3 + 4]

15

10

20

22

14

18

10

10

20

15

20

24

11

15

10

20

21

13

17

20

15

10

15

19

23

10

20

15

16

25

12

The resulting square is clearly pan-diagonal.

It may be noted that, in the ch


adaka all that was done is to start
arranging the sequence based on turagagati, and not from
diagonally below in the next column.

References
1. De La Loubere, Description Du Royaume De Siam, Paris,
1693, Tome II, p. 235-288.
2. Gan.itakaumud of N
ar
ayan.a Pan.d.ita, Ed. by Padmakara
Dvivedi, 2 Vols. Varanasi 1936, 1942.
3. B. Rosser and R. J. Walker, On the Transformation Groups
of Diabolic Magic Squares of Order Four, Bull. Amer. Math.
Soc., 44, 1938, 416-420.
4. T. Vijayaraghavan, On Jaina Magic Squares, The
Mathematics Student, 9 (3), 1941, 97-102.
5. B. B. Datta and A. N. Singh (Revised by K. S. Shukla),
Magic Squares in India, Ind. Jour. Hist. Sc. 27, 1992,
51-120.

References
6. T. Kusuba, Combinatorics and Magic-squares in India:
A Study of Narayan.a Pan.d.itas Gan.ita-kaumud, Chapters
13-14, PhD Dissertation, Brown University 1993.
7. Paramanand Singh, The Gan.itakaumud of Narayan.a
Pan.d.ita: Chapter XIV, English Translation with Notes,
Gan.ita Bh
arat, 24, 2002, 34-98.
8. Gan.itas
arakaumud of T.hakkura Pher
u, Ed. with Eng. Tr.
and Notes by SaKHYa (S. R. Sarma, T. Kusuba,
T. Hayashi, and M. Yano), Manohar, New Delhi, 2009.
9. Raja Sridharan and M. D. Srinivas, Study of Magic Squares
in India, in R. Sujatha et al ed., Math Unlimited: Essays in
Mathematics, Taylor & Francis, London 2011, pp. 383-391.

Thanks!

T HANK YOU

You might also like