STUDY OF MAGIC SQUARES IN INDIA
M.D.SRINIVAS CENTRE FOR POLICY STUDIES
[email protected]
MAGIC SQUARES IN INDIA The first Chapter of Srinivasa Ramanujan’s Note Books is on Magic Squares. T. Vijayaraghavan, in his article on Jaina Magic Squares (1941) notes: "The author of this note learnt by heart at the age of nine the following pan-diagonal square which was taught to him by an elderly person who had not been to school at all." 8
11
2
13
1
14
7
12
15
4
9
6
10
5
16
3
This shows the extraordinary popularity of Magic Squares in India. Indian mathematicians specialized in the construction of a special class of magic squares called sarvatobhadra sarvatobhadra or pan-diagonal magic squares, where, apart from the sum of the entries of each row, column and the principal diagonals, the sum of all "broken diagonals" add up to the same magic sum.
MAGIC SQUARES IN INDIA The first Chapter of Srinivasa Ramanujan’s Note Books is on Magic Squares. T. Vijayaraghavan, in his article on Jaina Magic Squares (1941) notes: "The author of this note learnt by heart at the age of nine the following pan-diagonal square which was taught to him by an elderly person who had not been to school at all." 8
11
2
13
1
14
7
12
15
4
9
6
10
5
16
3
This shows the extraordinary popularity of Magic Squares in India. Indian mathematicians specialized in the construction of a special class of magic squares called sarvatobhadra sarvatobhadra or pan-diagonal magic squares, where, apart from the sum of the entries of each row, column and the principal diagonals, the sum of all "broken diagonals" add up to the same magic sum.
KAKúAPUòA OF N ĀGĀRJUNA (c. 100 BCE)
अक इदुि नधा नारी ते न ल िवनासनम्। 0
1
0
8
0
9
0
6
0
3
0
4
0
7
0
2
n-3
1
n-6
8
n-3
1
n-5
8
n-7
9
n-4
2
n-6
9
n-4
2
6
n-8
3
n-1
6
n-7
3
n-1
4
n-2
7
n-9
4
n-2
7
n-8
Pan-diagonal with total 2n
Total 2n+1
KAKúAPUòA OF N ĀGĀRJUNA (c. 100 BCE) The following pan-diagonal magic square totaling to 100 has also been called Nāgārjun ī ya
30 16 18
36
10 44 22 24 32 14 20
34
28 26 40
6
SARVATOBHADRA OF VAR ĀHAMIHIRA (550 CE) In the Chapter on Gandhayukti of Bçhatsaühit ā , Varāhamihira describes the Sarvatobhadra perfumes
ि ीियाभागै रगु ः पं तु कशै ले यौ। ि वषयापदहनाः ियङगु मु तारसाः केशः॥ पृ ावगराणां मां या कृत कसषभागाः। ै सतु वे दचै म लयनखीककुदु काः॥ षोडशके कछपु टे यथा तथा ििमते चतु े। येऽादश भागातेऽिमन् गधादयो योगाः॥ नखतगरतु कयु ता जातीकपू रमृ गकृतोदोधाः। गु डनखधू या गधाः कत ाः सव तोभाः॥ अ 2 प 3
तु 5
शै 8
ि 5 मु 8
र 2
के 3
पृ 4 व 1 त 7 मां 6 म 7 न 6
ी 4
कु 1
SARVATOBHADRA OF VAR ĀHAMIHIRA As the commentator Bhaññotpala (c.950) explains:
िअमन् षोडशके षोडशककोके कछपु टे यथा तथा ये न केन कारेण चतु ेि िमते एककृते। चतु भ ै यथाभाग-परिकपतै मीकृत र ै येऽादश भागा भिवत तेऽिमन् कछपु टे गधादय ऊवाधःमे ण ितय वा चतु षु कोणे षु वा मयमचतु कोणे वा कोणकोचतु ये वा ापङौ वा मयमकोये वायपङौ। मयमकोये या ि तीयतृ तीयपङौ वातकोके वा ये न ते न कारेण। चतु षु ि िमते षु अादशभागा भिवत।… तमातततो गृ माणा अादशभागा भिवत अतः सव तोभसं ा:। In this kacchapuña with 16 cells, when four substances are mixed in whatever way: When the four substances with their mentioned number of parts are mixed, then the total will be 18 parts; this happens in the above kacchapuña when the perfumes are mixed from top to bottom (along the columns) or horizontally (along the rows), along the four directions, or the central quadrangle, or the four corner cells, or the middle two cells of the first row together with those of the last row; the middle two cells of the second and third row or the first and last cells of the same, or in any other manner. If the substances in such four cells are added there will be 18 parts in all. ... Since, in whatever way they are mixed, they lead to 18 parts, they are called Sarvatobhadra.
SARVATOBHADRA OF VAR ĀHAMIHIRA If we add 8
0
8
0
0
8
0
8
0
8
0
8
8
0
8
0
to the Sarvatobhadra of Varāhamihira, we get 10
3
13
8
5
16
2
11
4
9
7
14
15
6
12
1
This belongs to a class of 4x4 pan-diagonal magic squares studied by Nā āyaõa Paõóita in Gaõitakaumud ī (c.1356)
JAINA MAGIC SQUARE
7
12
1
14
2
13
8
11
16
3
10
5
9
6
15
4
Pan-diagonal magic square found in the Inscriptions at Dudhai in Jhansi District (c. 11 the Century) and at the Jaina Temple in Khajuraho (c. 12 th Century).
ANCIENT INDIAN METHOD FOR ODD SQUARES 8
1
6
3
5
7
4
9
2
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
This method of proceeding along small diagonals (alpa- śruti) is described as an ancient method by N ārāyaõa Paõóita in Gaõitakaumud ī (c.1356). Nārāyaõa also displays the eight 3x3 magic squares that can be constructed in this manner. De La Loubere, French Ambassador in Siam, wrote in 1693 that he learnt this Indian method from a French doctor M Vincent who had lived in
BHADRAGAöITA OF N ĀRĀYAöA (C.1356) Chapter XIV of Gaõitakaumud ī , titled Bhadragaõita, is devoted to a detailed mathematical study of magic squares.
अथ भु वनयगु णोपदं ईशे न िमणभाय। कौतु कने भू ताय े ढीसं िबधसिणतम्॥ सणकचमकृतये यिवदां ीतये कुगणकानाम्। गवि यै वये तसारं भिगणतायम्॥ समगभि वषमगभि वषमं चेि त िधा भवे म्। सं कण मडले ये ते उपभािभधे याताम्॥ भाङके चतु राेि नरके तवे समगभ म्। े तुि वषमगभ ये काे केवलंि वषमम्॥ सव षां भाणां े ढीरीया भवे िणतम्। Thus, a nxn magic square is Samagarbha if n = 4m, Viùamagarbha if n = 4m + 2, and Viùama if n = 2m + 1, where m =1, 2, 3 ... The classification of Magic Squares in to Samagarbha, Viùamagarbha and Viùama is also found in the Pr ākçta work Gaõitasārakaumud ī of òhakkura
KUòòAKA AND MAGIC SQUARES Nārāyaõa uses the following linear indeterminate equation to determine the initial term a and the constant difference d of an arithmetic sequence of n2 numbers, which can be used to fill an n x n square in order to have the entries in each row and column add to the sum S
nS = (n2 / 2) [a + a+( n2- 1) d ] S = na + (n/2) (n2- 1) d There exist (an infinite number of) integral solutions for a, d , if S is divisible by gcd(n, (n/2)(n2-1)). Thus, S should be divisible by n when n is odd, and by n/2 when n is even.
KUòòAKA AND MAGIC SQUARES
Nārāyaõa’Example:
S =
40 and n = 4.
40 = 4a +30d a =-5, d = 2, or a =10, d = 0, or a =25, d = -2, etc. -5
9
21 15 1
3
23 13
19 17
10 10 10 10
25 11
-3
7
10 10 10 10
-1
25
11
10 10 10 10
19 17
-5
-1
5
10 10 10 10
-3
21 15
5
7
1
3
23 13 9
Nārāyaõa also discusses the case where n arithmetic sequences, of n elements each, are used to fill up the cells of a nxn magic square.
PANDIAGONAL 4x4 SQUARES OF N ĀRĀYAöA
Pan-diagonal Magic Square: Apart from the sum of the entries of each row, column and the principal diagonals, the sum of all the "broken diagonals" add up to the same number. Nārāyaõa Paõóita displayed 24 pan-diagonal 4x4 magic squares, with entries 1, 2, ..., 16, the top left entry being 1. N ārāyaõa also remarked that (by permuting the rows and columns cyclically) we can construct 384 pandiagonal 4x4 magic squares with entries 1, 2, ..., 16. The fact that there are only 384 pan-diagonal 4x4 magic squares, was proved by B.Rosser and R.J.Walker in 1938. A simpler proof was given by T.Vijayaraghavan in 1941.
PROPERTIES OF PANDIAGONAL 4x4 MAGIC SQUARES
Property 1: Let M be a pan-diagonal 4x4 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
8
15
6
3
10
4
9
16
5
14
7
2
11
For example, 1+12+15+6 = 1+12+14+7 = 34
Property 2: Let M be a 4x4 pan-diagonal magic square with entries 1, 2, ..., 16, which is mapped on to the torus. Then, the sum of an entry of M with another which is two squares away from it along a diagonal (in the torus) is always 17.
PROPERTIES OF PANDIAGONAL 4x4 MAGIC SQUARES The "neighbours" of an element of a 4x4 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.
1
12 13
8
15
6
3
10
4
9
16
5
14
7
2
11
Property 3 (Vijayaraghavan): Let M be a 4x4 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 2, 3, 5 and 9 in some order. We can use the above properties to construct 4x4 pan-diagonal magic squares starting with 1 placed in any desired cell.
Proposition: There are precisely 384 pan-diagonal 4x4 magic squares
SAMAGARBHA MAGIC SQURES This seems to be an old method for magic square from a 4x4 magic òhakkura Pheru and Nārāyaõa. We square following the method given pan-diagonal 4x4 square.
Then we proceed as follows:
construction of samagarbha or 4nx4n square which is also described by illustrate this by constructing an 8x8 by òhakkura Pheru. We start with a
1
8
13
12
14
11
2
4
5
16
9
15
10
3
6
7
SAMAGARBHA MAGIC SQURES
Finally we arrive at the pan-diagonal 8x8 magic square
1 32 61 36 62 35
2 31 58 39
4 29 64 33 63 34
5 28 57 40 6 27
8 25 60 37
3 30 59 38
7 26
9 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
One of the properties of an 8x8 pan-diagonal magic square seems to be that the sum of four alternating cells along any diagonal adds to half the magic sum.
SAMAGARBHA MAGIC SQURES Another version of this traditional method has been noted Nārāyaõa, who has given the following example of construction of a 8x8 square from a 4x4 square. 1
8
14 11 4
5
15 10
13 12 2
7
16
9
3
6
The above construction does not lead to a pan-diagonal 8x8 magic square, even though we started with a pan-diagonal 4x4 square.
SAMAGARBHA MAGIC SQURES We slightly modify Nārāyaõa’s procedure so that we obtain a pandiagonal 8x8 square from a pan-diagonal 4x4 square 1
8
14 11 4
5
15 10
13 12 2
7
16
9
3
6
NĀRĀYAöA’S FOLDING METHOD FOR SAMAGARBHA SQUARES
समगभ े काय छादकसं ं तयोभ वे दे कम्। छाािभधानमयकरसं पु टव सं पु टो े यः॥ इादीचयाङका भिमता मू लिपङसं ाा। तदिभीसतमु खचयिपङाया पराया यात्॥ मू लायिपङयोिगोनतं फलं परसमाससंभम्। लधहता परिपङगु णजाया सा भवे त् िपङः॥ मू लगु णाये पङ ये ते भाध ततु परवृ े। ऊवि थतै तदङकैछादकसं छायोः पृथियान॥ ि तय ोायाेऽयतिरमू व िगान कोािन। भयाध मगै मगैः पू रये दध म्॥ भािनामहसपु िटिवधो नृ हरतनये न।
FOLDING METHOD FOR SAMAGARBHA SQUARES Two samagarbha squares known as the coverer and the covered are to be made. Their combination is to be understood in the same manner as the folding of palms. The mūlapaïkti (base sequence) has an arbitrary first term and constant difference and number of terms equal to the order of the magic square. Another similar sequence is called the parapaïkti (other sequence). The quotient of phala (desired magic sum) decreased by the sum of the mūlapaïkti when divided by the sum of the parapaïkti [is the guõa]. The elements of the parapaïkti multiplied by that gives the guõapaïkti. The two sequences mūlapaïkti and guõapaïkti are reversed after half of the square is filled. The cells of the coverer are filled horizontally and those of the covered vertically. Half of the square is filled [by the sequence] in order and the other half in reverse order. The way of combining magic square is here enunciated by the son of Nçhari.
FOLDING METHOD FOR SAMAGARBHA SQUARES Nārāyaõa’s Example 1: 4x4 Square adding to 40 Mūlapaïkti: 1, 2, 3, 4 Parapaïkti: 0, 1, 2, 3 Guõa = [40 - (1+ 2+ 3+ 4)] / [0+1+2+3] = 5 Guõapaïkti: 0, 5, 10, 15 The chādya (covered) and chādaka (coverer) are 2
3 2
3
1
4 1
4
3
2 3
2
4
1 4
1
5
0 10 15
10 15 5
5
0
0 10 15
10 15
5
0
FOLDING METHOD FOR SAMAGARBHA SQUARES Sampuñ ī karaõa (folding) gives 2+15 3+10 2+0 1+0
4+5 1+15 4+10
3+15 2+10 3+0 4+0
3+5
2+5
=
1+5 4+15 1+10
17
13
2
8
1
9
16
14
18
12
3
7
4
6
19
11
Nārāyaõa also displays the other square which is obtained by interchanging the covered and the coverer. This method leads to a pan-diagonal magic square.
Nārāyaõa’s Example 2: 8x8 Square adding to 260 Mūlapaïkti: 1, 2, 3, 4, 5, 6, 7, 8 Parapaïkti: 0, 1, 2, 3, 4, 5, 6, 7 Guõa = [260 - (1+ 2+ …+8)] / [0+1+2+…+7] = 8
FOLDING METHOD FOR SAMAGARBHA SQUARES The chādya and chādaka are
Sampuñ ī karaõa gives
NĀRĀYAöA’S FOLDING METHOD FOR ODD SQUARES
पङ मू लगु णाये तः ावसाये तददमम्। आदमायामू व पङौ मयमे कोके िलखे त्॥ तदधः मं पङयाङिकाञछाङकानू व तः मात्। ि तीयाातु त ितीयाां संि लखे त्॥ छाछादकयोः ािविधःसं पु टने भवे त्। Two sequences referred to as the m ūlapaïkti and the guõapaïkti 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.
FOLDING METHOD FOR ODD SQUARES Example: 5x5 Square adding to 65
Mūlapaïkti: 1, 2, 3, 4, 5 Parapaïkti: 0, 1, 2, 3, 4 Guõa = [65 - (1+ 2+ 3+ 4+ 5)] / [0+1+2+3+4] = 5 Guõapaïkti: 0, 5, 10, 15, 20 The chādya and chādaka are 4
5 1
2
3
15 20
0
5
1 2
3
4
20
5 10 15
1
2 3
4
5
0
2
3 4
5
1
5 10 15 20
3
4 5
1
2
0
5 10
5 10 15 20
10 15 20
0
0 5
FOLDING METHOD FOR ODD SQUARES Sampuñ ī karaõa gives 4+10 5+5
1+0 2+20 3+15
14
10
1
22
18
20
11
7
3
24
21
17
13
9
5
2+0 3+20 4+15 5+10 1+5
2
23
19
15
6
3+5
8
4
25
16
12
5+15 1+10 2+5
3+0 4+20
1+20 2+15 3+10 4+5
5+0
4+0 5+20 1+15 2+10
=
Nārāyaõa’s 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ĀRĀYAöA’S FOLDING METHOD FOR ODD SQUARES We may modify the above prescription and construct pan-diagonal magic squares of odd order n>1, whenever n is not divisible by 3, as follows: Example: Pan-diagonal 5x5 Square adding to 65
Mūlapaïkti: 1, 2, 3, 4, 5 Parapaïkti: 0, 1, 2, 3, 4 Guõa = [65 - (1+ 2+ 3+ 4+ 5)] / [0+1+2+3+4] = 5 Guõapaïkti: 0, 5, 10, 15, 20 The chādya and chādaka are now chosen as 2
4
1
3
5
5
15
0
10 20
3
5
2
4
1
10
20
5
15
0
4
1
3
5
2
15
0
10 20
5
5
2
4
1
3
20
5
15
0
10
1
3
5
2
4
0
10 20
5
15
MODIFICATION OF NĀRĀYAöA’S FOLDING METHOD FOR ODD SQUARES Sampuñ ī karaõa gives 2+20 4+10 1+0 3+15 5+5
22
14
1
18 10
3
20
7
24 11
9
21
13
5 17
5+10 2+0 4+15 1+5 3+20
15
2
19
6 23
1+15 3+5 5+20 2+10 4+0
16
8
25 12 4
3+0
5+15 2+5 4+20 1+10
4+5
1+20 3+10 5+0 2+15
=
The above square is clearly pan-diagonal.
EXAMPLES FROM RAMANUJAN’S NOTEBOOK The first chapter of Ramanujan’s Notebook deals with Magic Squares. It is said that he might have made these entries while he was still at the School.
The above happens to be an example of N ārāyaõa’s folding method for odd squares.
EXAMPLES FROM RAMANUJAN’S NOTEBOOK
The second example above happens to be an instance of N ārāyaõa’s folding method for doubly even squares.
EXAMPLES FROM RAMANUJAN’S NOTEBOOK
REFERENCES 1. Gaõitakaumud ī of N ār ā yaõa Paõóita’s, Ed. by Padmākara Dvivedi, 2 Vols, Varanasi 1936, 1942. 2. T. Vijayaraghavan, On Jaina Magic Squares, The Mathematics Student, 9 (3), 1941, 97-102. 3. B. Datta and A. N. Singh (Revised by K. S. Shukla), Magic Squares in India, Ind. Jour. Hist. Sc. 27, 1992, 51-120. 4. T. Kusuba, Combinatorics and Magic-squares in India: A Study of N ār ā yaõa Paõóita’s Gaõita-kaumud ī , Chapters 13-14, PhD Dissertation, Brown University 1993. 5. Paramanand Singh, The Gaõitakaumud ī of Nārāyaõa Paõóita: Chapter XIV, English Translation with Notes, Gaõita Bh ārat ī , 24, 2002, 34-98. 6. Gaõitasārakaumud ī of òhakkura Pheru, Ed. with Eng. Tr. and Notes by SaKHYa (S. R. Sarma, T. Kusuba, T. Hayashi, and M. Yano), Manohar, New Delhi, 2009.