page_title: Magic square
section_title: India
hierarchical_section_title: Magic square / History / India
caption_attribution_description: Unidentified, Pandarai de jantra ki vidha. Magic square Asian Collection
context_page_description: In recreational mathematics and combinatorial design, a magic square is a square grid filled with distinct positive integers in the range such that each cell contains a different integer and the sum of the integers in each row, column and diagonal is equal. The sum is called the magic constant or magic sum of the magic square. A square grid with n cells on each side is said to have order n.
  The mathematical study of magic squares typically deals with its construction, classification, and enumeration. Although completely general methods for producing all the magic squares of all orders do not exist, historically three general techniques have been discovered: by bordering method, by making composite magic squares, and by adding two preliminary squares. There are also more specific strategies like the continuous enumeration method that reproduces specific patterns. The magic squares are generally classified according to their order n as: odd if n is odd, evenly even if n = 4k, oddly even if n = 4k + 2. This classification is based on different techniques required to construct odd, evenly even, and oddly even squares.
context_section_description: The 3×3 magic square first appears in India in Gargasamhita by Garga, who recommends its use to pacify the nine planets (navagraha). The oldest version of this text dates from 100 CE; however passage on planets could not have been written earlier than 400 CE. The first dateable instance of 3×3 magic square in India occur in a medical text Siddhayog (c. 900 CE) by Vrnda, which was prescribed to women in labor in order to have easy delivery.
  The oldest dateable fourth order magic square in the world is found in an encyclopaedic work written by Varahamihira around 587 CE called Brhat Samhita. The magic square is constructed for the purpose of making perfumes using 4 substances selected from 16 different substances. Each cell of the square represents a particular ingredient, while the number in the cell represents the proportion of the associated ingredient, such that the mixture of any four combination of ingredients along the columns, rows, diagonals, and so on, gives the total volume of the mixture to be 18. Although the book is mostly about divination, the magic square is given as a matter of combinatorial design, and no magical properties are attributed to it.
  
  
   
   
   
  The square of Varahamihira as given above has sum of 18. Here the numbers 1 to 8 appear twice in the square. It is a pan-diagonal magic square. It is also an instance of most perfect magic square.  Four different magic squares can be obtained by adding 8 to one of the two sets of 1 to 8 sequence. The sequence is selected such that the number 8 is added exactly twice in each row, each column and each of the main diagonals. One of the possible magic squares shown in the right side. This magic square is remarkable in that it is a 90 degree rotation of a magic square that appears in the 13th century Islamic world as one of the most popular magic squares...
  The construction of 4th-order magic square is detailed in a work titled Kaksaputa, composed by the alchemist Nagarjuna around 10th century CE. All of the squares given by Nagarjuna are 4×4 magic squares, and one of them is called Nagarjuniya after him. Nagarjuna gave a method of constructing 4×4 magic square using a primary skeleton square, given an odd or even magic sum. Incidentally, the special Nagarjuniya square cannot be constructed from the method he expounds. The Nagarjuniya square is given below, and has the sum total of 100.
  
  
   
   
   
  The Nagarjuniya square is a pan-diagonal magic square. The Nagarjuniya square is made up of two arithmetic progressions starting from 6 and 16 with eight terms each, with a common difference between successive terms as 4. When these two progressions are reduced to the normal progression of 1 to 8, we obtain the adjacent square.
  Around 12th-century, a 4×4 magic square was inscribed on the wall of Parshvanath temple in Khajuraho, India. Several Jain hymns teach how to make magic squares, although they are undateable.
  As far as is known, the first systematic study of magic squares in India was conducted by Thakkar Pheru, a Jain scholar, in his Ganitasara Kaumudi (c. 1315). This work contains a small section on magic squares which consists of nine verses. Here he gives a square of order four, and alludes to its rearrangement; classifies magic squares into three (odd, evenly even, and oddly even) according to its order; gives a square of order six; and prescribes one method each for constructing even and odd squares. For the even squares, Pheru divides the square into component squares of order four, and puts the numbers into cells according to the pattern of a standard square of order four. For odd squares, Pheru gives the method using horse move or knight's move. Although algorithmically different, it gives the same square as the De la Loubere's method.
  The next comprehensive work on magic squares was taken up by Narayana Pandit, who in the fourteenth chapter of his Ganita Kaumudi (1356) gives general methods for their construction, along with the principles governing such constructions. It consists of 55 verses for rules and 17 verses for examples. Narayana gives a method 
caption: The 3×3 magic square in different orientations forming a non-normal 6×6 magic square, from an unidentified 19th century Indian manuscript.
exif: {}