Classical Hindu tradition holds that the ogdoad of deva-s corresponding to their directions is:

Indra: East; Agni: Southeast; Yama: South; Nirṛti: Southwest; Varuṇa: West; Vāyu: Northwest; Kubera: North; Īśāna: Northeast.

The central position might be occupied in certain traditions by Prajāpati, Viṣṇu, Savitṛ or the Puruṣa-Prakṛti continuum from which the gods differentiated.

Now, a famous verse, quoted by the great scientist-mathematician Bhāskara in his Līlāvatī, says:

indro vāyur yamaś caiva nairṛto madhyamas tathā |

īśānaś ca kuberaś ca agnir varuṇa eva ca ||

Now using the positions of the gods as in the classical ogdoad we get the below matrix:

We then plug values for each of the elements of the matrix based on the positions of the gods in the above verse. Indra= 1; Vāyu= 2; Yama= 3; Nirṛti= 4; madhyama, the middle or mean= 5; Īśāna=6; Kubera= 7; Agni= 8; Varuṇa= 9

When we do so we get the famed magic square (sarvatobhadra) of Hindu tradition known as the ubhaya-pañcādaśaka

This magic square is found widely in Hindu tradition. It is one of the magic squares that is worshiped by the physician while deploying bheṣaja-s pertaining to child-birth along with a mantra to Agni, Vāyu, Sūrya and Indra. There it is specified using partial bhūtasaṃkhya notation as:

vasu-guṇābdhy-eka-bāṇa-nava-ṣaṭ-sapta-yugaiḥ kramāt |

yantraṃ tu pañcadaśakaṃ likhyate nava-koṣṭhake ||

8, 3, 4; 1, 5, 9; 6, 7, 2 in order are to be written in the 9 cells for the yantra with sum of 15.

It is also recorded in śaiva traditions as a yantra. Indeed tradition holds that the mathematics of magic squares (bhadragaṇita) was taught by the god Rudra to the yakṣarāṭ Kubera or his ectype Maṇibhadra (e.g. see Narāyaṇa paṇḍita’s chapter on bhadragaṇita).

There is literally much mathematical magic in the bhadra square:

1) If you add the rows, columns and diagonals you get 15, which is what gives it name. Thus the magic constant

2) If you reflect the square about any of the sides or transpose the matrix i.e. make rows into columns then the resultant square is also magic.

3) It contains the first 9 positive integers and is a magic square; hence, its order and its elements are . For such a magic square (known as a normal or fundamental magic square) the

4) If you put any sequence of consecutive positive integers serially in the same positions as the occurrence of 1:9 in the square then you get another magic square. Thus you can generate infinite magic squares. Tradition holds that the ancient astronomer Garga described this additive derivation of a sequence of magic squares. He states that sun is represented by the above deva square; by adding 1 successively the sequence of squares associated with other planetary bodies. Adding 19 to each element generates the Kaubera-sarvatobhadra:

Its magic constant is

5) For the deva (fundamental) magic square and all magic squares sharing the general form with it (see below for general form) the arithmetic mean of the elements of the matrix equals the central element or the madhyama as it is termed in Hindu tradition: . It is both central positionally and in the sense of being the mean. Further, for the deva square and all its derivatives obtained as above , where the order of the matrix. Thus for the deva square it is and for the Kaubera square it is

More generally we have the siddhānta attributed to Narāyaṇa paṇḍita which generates these magic squares using the madhyama () and 2 other numbers thus:

Thus we get the magic constant as . We get the deva square by plugging . This general form of the square can be used to prove other results as those presented below pertaining to such squares. By plugging we get the ubhayatriṃśaka seen in śaiva and medical works:

Its magic constant is the idealized number of days in the lunar month and its dot-product constant (see below) is 364 which is 1 short of the idealized number of days in the year.

6) Whereas the off-diagonals or the wrapped diagonals do not add up to their sums do show a regular relationship: where i.e. the corner elements. Thus for the four off-diagonals of the deva-square we have:

One immediately notices that the mean of the sum of these off-diagonals is: . This property is a general feature that holds good for all the magic squares derived from the same general form as the deva square such as the Kaubera square.

7) Remarkably if we write out each row, column and diagonals (including the off-diagonals) as 3 numbers forward and reverse then the following relationships hold:

Now if one does the same with any other additively derived magic square we get the same. But we need to keep in mind the places thus for the Kaubera square we get:

Thus this summation property is a general one for such magic squares. Further if we denote this sum as then its ratio to the magic constant is a mirror number of the form 111, 10101, 1001001 etc. For the deva square made up of single digit numbers it its 111. For magic squares with double digit numbers it is 10101. For magic squares with triple digit numbers it is 1001001, so on.

8) Notably, as above if we write out each row, column and diagonals (including the off-diagonals) as 3 numbers forward and reverse then the following relationship holds for their squares:

This is also generally true for generalizations of the deva square.

9) The dot product rules: Let be the rows and columns of such magic squares. For our 3rd order squares they define three element vectors. The dot product of these vectors would be a scalar e.g.: . Then for the deva-square and its generalization we have:

; where is the dot product constant of the magic square.

and

10) We can create a square matrix by the process of cyclic difference of rows or columns: or . are zero-sum semi-magic squares in that the rows and columns add up to zero but the diagonals do not. This applies for the deva square and its generalization. Thus for the deva square we have:

11) For the deva square and its additive derivatives we can define the eigenvalues thus:

; where is the eigenvector and I is the identity matrix:

Then for the deva-square is obtained by solving the cubic equation:

Strikingly, the eigenvalues are . Thus, the largest eigenvalue square is its magic constant. More generally for all additive derivatives of the deva square the eigenvalues are:

For the deva square the Eigenvectors are:

;

;

Notably for all additive derivatives of the deva squares the eigenvectors take the above forms though the signs of the values might be reversed.

12) For such 3rd order magic squares each row, column, diagonal and off-diagonal can be seen as a triple of numbers that can specify a point in space as its x, y and z coordinates. We have a total of 3 rows + 3 columns + 2 diagonals + 4 off-diagonals= 12 triples. By permuting the order in which each number in the triple is taken we can specify 6 points from each triple. Thus we have a total of points. Of these for those points derived from the columns, rows and diagonals. Thus, 48 out of the 72 points lie on the plane . While those from the off-diagonals lie on 4 different parallel planes on either side of the main plane. From their equations we know

that these planes have a vector of the form and will make with the horizontal plane ( ) the angle:

Thus, these points define a regular hexagonal bipyramidal frustum, with the 48 points magic constant points on the principal plane forming a nice pattern of 4 concentric hexagons.

Figure 1: the principal plane with 48 points from the deva square

The 12 points from two of the off-diagonals form 2 hexagons congruent to the inner-most hexagon on either side of the principal plane and lie farthest from it. The remaining 12 points from the other two off-diagonals form 2 hexagons on either side of the principal plane and are congruent to the last but 1 of the concentric hexagons counting from inside.

Figure 2: The hexagonal bipyramidal frustum of the deva square

For the deva square the four concentric hexagons have side-lengths of , with the first and the last being also the sides of the hexagons forming the base and the height of bipyramidal frustum. The pyramidal edge of the frustum is and the remaining off diagonal hexagons cut the pyramidal side into segments in the proportion . It may be considered the maṇḍala of the deva-s.

13) Such magic squares can also be converted to the Hindu magic triangles using Narāyaṇa paṇḍita’s simple algorithm. Below is illustrated the 4-fold magic triangle, the pañcaviṃśati-yoni derived from the deva square.

Figure 3: the pañcaviṃśati-yoni

While magic squares might seem to the deracinated modern as a quaint superstition of the Hindu and some other old civilizations like the Chinese and Japanese, they might have some deeper significance. For example there is the deceptively simple looking but yet unsolved mystery: does a order 3 magic square exist where all the elements are perfect squares, i.e. are they squares on sides of a right triangle with integer sides? Here we have looked only at what the Hindus termed nava-koṣṭhaka-viṣaṃagarbha-bhadra-s. But the several other magic figurate numbers described in Hindu tradition might have other interesting mathematics lurking in them. Notably, the great Srinivasa Ramanujan also (re)discovered several saṃagarbha-bhadra-s similar to traditional Hindu versions (like the ones found on Candrātreya temples, including one demolished by the Moslem tyrant Baboor at Gwalior) with interesting properties. Additional also gives the above formula for the general nava-koṣṭhaka-viṣaṃagarbha-bhadra-s

More generally they might be seen as a numerical representative of a conservation law and the structures that emerge naturally once such a law is laid down. One can also use it as an analogical aid for understanding structures emerging under constraints. One could conceive an imaginary model for a protein where the amino acids (standing for numbers in the square) are under interaction constraints with others to attain some total constant stabilizing energy. Under such a scenario the magic square plane as derived above would represent a -sheet.