## Early Hindu mathematics and the exploration of some second degree indeterminate equations

The following is merely a record of our exploration as a non-mathematician/non-computer scientist of a remarkable (at least to us) class of numerical relationships.

An equation like can be solved to obtain specific solutions as: . However, if we have an equation like then it is termed indeterminate as it has no unique set of solutions. Rather the values of the variables satisfying it define a curve in a space with as many dimensions as the number of variables, which in the above case is a straight line on a plane. However, if we constrain the solutions to being integers we get specific, though sometimes infinite solutions. This constraint essentially reduces the problem to finding the points on the curve that lie on a fixed lattice. Further, if we add the constraint that the solutions should be positive then we can come down to a limited set of solutions, like for the above equation of the line we have as lying on the integer lattice in the positive quadrant. Such integral solutions to indeterminate equations are referred to in western and thereby in modern mathematics as Diophantine equations after the yavana mathematician Diophantos.

However, Hindu tradition has one of the deepest histories of the analysis of such indeterminate equations. The earliest studies go back to the ritual vedī-s of the Yajurveda and they find mention in the problems of the śulbasūtra-s. This suggests that the Hindu interest in them arose in the context of ritual. Similarly, Proclus, Diophantos and Archimedes before him were likely building on a Pythagorean base, suggesting that such problems might have existed in the ancestral ritual tradition of both the yavana-s and ārya-s. Already in the Yajurveda tradition we encounter such indeterminate equations of the linear form and also those resulting in the bhujā-koṭi-karṇa (known in the west as Pythagorean) triples (see below). It is also likely that the adhvaryu-s used an equation of the form to obtain the solutions to obtain the value of correct to 5 decimal places. That this was the case is supported by the commentary of the great Nīlakaṇṭha somayājin who notes that the factor 17 in the denominator of the śulbasūtra value comes from . In the post-Vedic period the analysis of indeterminate equations was advanced further. We learn in the teachings of: 1) Āryabhaṭa of the kuṭṭaka algorithm for linear indeterminate equations. 2) Brahmagupta and his successors Jayadeva and Bhāskara-II of the algorithms to solve certain degree 2 indeterminate equations. 3) Nārāyaṇa a general summary of these equations and their applications (his text the Gaṇita-kaumudi).

Of the degree 2 indeterminate equations, integral solutions of those of the form where is an integer were of greatest interest to the Hindus. As we saw above such an equation with might have been used by seers of the Yajurveda to approximate . Looking at this equation some things become immediately clear. For we get a trivial solution which is true for all . If is a perfect square then will never be a perfect square so we have no solutions beyond the trivial one. If is not a perfect square we could potentially have infinite solutions because at some point is free to become a perfect square. This can be easily understood geometrically: The equation defines a family of hyperbolas (Figure 1). Integral solutions will occur where ever the hyperbola passes through the integer lattice. From the equation we can deduce that one of the two asymptotes of the hyperbola is . If is a perfect square then the asymptote will pass through points on the integer lattice but beyond the trivial case the hyperbola will never pass through the points on the lattice. However, if is not a perfect square then will be irrational. Hence, as the hyperbola converges towards it asymptote, each time it passes through a lattice point will be a closer and closer approximation of .

For the particular case there is a special significance that links arithmetic to geometry. The sum of integers is given by the formula presented by sage Śākapūṇi in Vedic antiquity:

By laying the integers as equidistant points on successive rows we get an equilateral triangle lattice with the sum up to the nth integer completing the next equilateral triangle (Figure 2). Hence these sums are known as triangular numbers.

Now consider the sum of odd integers:

Laying out the nth odd number , with each new addition bracketing the previous one we get a square lattice (Figure 3). Hence, their sum is . Thus these sums are known as square numbers.

Now a question which arises is whether there are any triangular numbers that are also square numbers. Such a question might be germane to a neo-ritualist who wishes to make a triangular vedī with the same number of lattice points as a square vedī. This is not entirely out of place because square numbers arose first in the vaidika system of square altars and the triangular numbers had a significance for the Pythagoreans (also see earlier note). In any case, the answer to this question is obtained thus: Let be the number to which we desire to sum ( i.e. ) to get the triangular number. Let be the number which we desire to be side of the square number (i.e ). Then we have:

Thus the integral solutions of the above equation give us the triangular numbers which are also square numbers. As one can notice will always be an odd number; hence, for the solutions will always be an odd number and will always be even [an odd square will be ; Now ; thus we have ; hence is always even]. Thus, for each solution of the above indeterminate equation we get the equivalent triangular and square numbers. Interestingly, each successive approximation of yield the point where triangular and square numbers are equivalent. Illustrated in Figures 2 and 3 are the cases where the triangular and square numbers become equal till . Below is a table of the first 11 such values of and corresponding .

As can be seen above these numbers can quickly large. A further question is can we get such solutions more generally for the above equation where takes values other than 2. The answer to this lies in one of the greatest discoveries of the Hindu mind. For the rest of this note we shall restrict ourselves to the first that satisfies the equation, though the method discussed can be used to get further values too.

Our encounter with this equation goes back to our youth when our father had taken us to a bookshop. There a book on Hindu mathematics caught our sight and in it we encountered this equation for the first time. We also noted in that the book that Brahmagupta had mentioned that one could be considered as having some mettle in mathematics if one solved the equation for . Interestingly, when these equations were first being explored in the West (1600s) the Frenchman Fermat too posed one of them as a major challenge to rival English mathematicians and others. Not being of extensive means we were not in position of buying many books those days and had to leave it in the shop and return home. Nevertheless the problem stuck in our mind and we started exploring it with paper and pen. We were able obtain the first solutions for numbers but soon realized that 83 and 92 were beyond our means, plainly showing us that we had no mathematical talents. However, the book usefully informed us that there was an algorithm developed by the Hindu mathematicians/scientists from Brahmagupta onwards culminating in Jayadeva, which was known as the cakravāla that allowed one to solve any such equation. Commonly one finds it attributed to Bhāskara-II but it is already mentioned in the commentary called Sundarī of Udayadivākara from 1073 CE where he says it was achieved by Jayadeva before him. Hence, it was already in place long before Bhāskara-II, who when providing it merely says its is known or has been recited as the cakravāla (cakravālam idaṃ jaguḥ |).

However, the time was too brief at the time of our first encounter for us to understand the cakravāla. Hence, a little later when we had access to a computer for the first time we wrote a simple program to carry out a brute force search for all the first solutions to the equation till . We thus found the answers for and . However, since our search was carried out only to a maximum of (1 lakṣa) we had several holes. This indicated a surprising fact that for some values of could suddenly take large values among otherwise pedestrian values. This meant we had to have a better way of finding them. Hence, we got back to study the cakravāla algorithm and implement it having found a book describing it with a richer relative. In doing so we realized that the way it was presented in the sources we used was not the best for implementation on a computer. Hence, we had to implement it in the form of a systematic search which catches all corner cases that cannot be handled by the “simple” presentation we usually see for this algorithm. Below is a presentation of such an implementation of the function which would output the first non-trivial solutions of the equation (Hindus termed the solutions as antya and ādi: Brahmagupta or as jyeṣṭa and hrasva: Jayadeva and Bhāskara-II)

Do until is obtained

is the floor function

if then ; end execution

write array

Do until is obtained

if then

Do until is obtained

if then

if then break this loop; ; restart from outer loop with next value in array j

if then ; end execution

return(val)

If one instructs a computer to do the above procedure in any language it understands one can unerringly get the first non-trivial solutions of the equation under consideration. The implementation has three nested loops. The outer loop catches the cases where is a perfect square and has only trivial solutions. The innermost loop is the core cakravāla procedure where the search iteratively proceeds until . As the first approach it starts with an initial , i.e. . This is what you typically see in examples illustrating the procedure. However, one quickly realizes that with that does not work even though it has a relatively simple solution . Here, we need to start with instead of because the latter results in fractional (note it has to always be integer for procedure). Bhāskara-II seems indicates that one might need take an alternative starting point with the ‘athavā’: guṇavarge prakṛtya +ūne .athavā +alpaṃ śeṣakaṃ yathā | (guṇa-varga i.e. square of starting ; prakṛtya ). But when we go to we see that both fail. Hence, we need to go to to get the solution without hitting a fractional . It is for this issue that we need to incorporate the second loop where we search for the appropriate systematically starting from and moving up and down from it by 1, 2 so on. Thus, we have a simple implementation of the cakravāla on a computer that anyone with even limited mathematical capacity like us can achieve. Since by this procedure we always reach the solution, i.e. the algorithm always halts, we have not implemented Brahmagupta and Bhāskara-II’s shortcuts.

Thus, armed with the cakravāla in a second or so we obtained the values of the first for all . In the process we blazed through Bhāskara-II’s famous illustration of which yields big values: . While big, to put it in perspective the jyeṣṭa is still only about number of people alive on earth. As we tried to go past the barrier towards we hit a snag as our numbers ran beyond our language’s standard numbers kept as double-precision floating-point (64 bits ~ 15:17 digits). So we had re-implement the algorithm using multiple precision floating-point numbers. This slowed it down a bit but was not too bad given the cakravāla’s inherent speed. Now we could obtain a table of all first all the way to . Now, we are not talking just big but truly large numbers that are a delight to the Hindu eye. In this range we reach the maximum for interestingly 600 ahead of Bhāskara-II’s . To put is perspective that is close to the diameter of the universe measured in Hydrogen atom diameters. At we get which is roughly the diameter of an apple (6.27 cm) in Planck’s lengths. We provide this table for the reader’s enjoyment as such information does not seem to be easily available. The first two columns give the jyeṣṭa and hrasva. The next two columns give the number of iterations of the second and total number of iterations of the third loop that were needed until the solution was obtained. The first non-trivial values are also plotted for (Figure 4).

Is there any pattern to these values? As noted above need us to search beyond the . Indeed, multiples of 7 seem have a higher propensity for this problem because we encounter a similar issues with 14, 21, 28, 70, 77, 98, 112, 126, 133, 140, 154, 161, 189, 238, 252, 259, 266, 273…: Out of the 142 multiples of 7 that assumes between 1 and 1000, we need multiple rounds of exploration for 79 of them. Indeed the highest values of are attained for and .

For the actual values of there are some patterns that can be easily proved: When , i.e. is one less than a perfect square the solution is . For we can easily show that . When it is obvious that . Similarly, when then . Slightly more subtle ones are: when then ; when then ; when then . Such may be termed regular categories of

It also becomes apparent (Figure 4, Table) that for several prime values we get explosive eruptions of the values. The famous explosive values like are all primes. Now if a prime happens to fall in one of the above categories where can be regularly defined in terms of a perfect square then we get get pedestrian values despite it being a prime (e.g. category or category). However, double their value despite not being a prime has an explosive value if it escapes the above categories; e.g. for , and for , . Similarly, when take the case of 17 we see that ; ; ; . Thus, the prime 17 is suppressed over 4 successive multiples before it explodes finally at with . Thus, more generally we see explosions whenever a prime or its multiples escapes the regular categories. Among the primes, a famous set of primes (studied intensely from Fermat, Lagrange, Gauss to this date) that are of the form: (typically written as , where ) tend to be particularly explosive if they are not suppressed by belonging one of the above regular categories. For example the above listed famous explosive values (e.g 61, 109, 181 etc) can be expressed as both and . Thus by Fermat’s theorems these primes are simultaneously: and .

We can now understand what we see when we look closely at the log-scale plot of against (Figure 5). We see “cycloid” like arcs between successive which are perfect squares. These peaks of these arcs are more pronounced for such even . These arcs arise from the regular categories. The “central” part of these arcs are interrupted by eruptions arising from unsuppressed primes and their multiples. As increases the explosions get larger and larger, and as the distance between successive perfect squares increases there are more unsuppressed values which erupt. The distribution of values of show an interesting statistical property. Though the median value (lower dotted line in Figure 4, 5) is rather pedestrian the mean value is huge (upper dotted line). This illustrates how the minority explosive values have a much greater influence on the cumulative value of the system — a pattern often seen in natural systems where a few “hubs” dominate a distribution. This remarkable system made easy by the cakravāla illustrates the beauty of this method of old Hindu mathematics. In the past many have said that the Hindus were unlikely to have known of a proof for the cakravāla. We do not think so; rather it is likely they had a proof of some kind for why it always works and with it had some grasp of its consequences for the theory of numbers.

In the final part of this note we shall consider another second degree indeterminate equation, the bhujā-koṭi-karṇa nyāya: . Its integral solutions where are the famous b-k-k triples (Pythagorean triples in the west), which were studied by the Hindus since the days of the Veda. This likely has a deep history among the ārya-s and other IE people, which the white indological hot air is keen to ascribe to borrowing from the Mesopotamians (a discerning Hindu will see through the foundations of Mesopotamian boosterism that is common in the Abrahamosphere). In any case, the properties of its solutions are well-know to lay people with even the slightest mathematical interest but we are reiterating them here as another illustration of how even a simple indeterminate equations can produce complex patterns. whose. We encounter its solutions explicitly in the śulbasūtra-s and they continue to be discussed in subsequent Hindu mathematics. For instance the great sage Baudhāyana says in his śulbasūtra:

dīrgha-catur-aśrasya+akṣṇyā-rajjuḥ pārśva-mānī tiryañ-mānī ca yat pṛthag bhūte kurutas tad ubhayaṃ karoti |

The hypotenuse (akṣṇyā-rajju) i.e. diagonal of a rectangle produces

[the area] that is equal to both the areas [produced] separately by the horizontal and vertical sides.

tāsāṃ trika-catuṣkayor dvādaśika-pañcikayoḥ pañcadaśika+aṣṭikayoḥ saptika-caturviṃśikayor dvādaśika-pañcatriṃśikayoḥ pañcadaśika-śaṭtriṃśikayor ity etāsu+upalabdhiḥ |

Among the [sides showing above relationship] are those obtained in this form: (3,4,[5]); (5,12,[13]); (8,15,[17]); (7,24,25); (12,35,[37]); (15,36,[39]).

The first of the triples is the most primitive of triples and sets the properties for all the other solutions: 1) : the product of the two legs of the triple is always divisible by 12. 2) : the product of all three of them is always divisible by 60. Now of the forms listed in the sūtra, the first 5 are illustrations of primitives i.e. are integers with greatest common divisor 1 (i.e. they are coprime). The 6th is merely a illustration of how further trivial triples can be obtained by merely scaling a primitive in this case . However, triples of sūtra are likely chosen to illustrate another point:

Three of them are of the form , two are and the odd one out is . Since the adhvaryu uses difference of squares formula in the layout of the citi (3 sutra-s later in Baudhāyana) this was likely used to obtain the illustrated triples by setting . With we get which easily yields the most primitive triple and further etc.

More generally all primitive triples can be obtained using the formula in the complex plane:

where are coprime and of opposite parity (i.e. one is even and the other odd).

Then the hypotenuse is . Thus one can see that in the triples and one of the legs would be odd and the other even. If we compute the primitive triples and plot them on the xy plane (Figure 6) we see that they present a complex pattern.

Figure 6

There are two aspects to the pattern: A relatively trivial aspect is the arrangement of the points on parabolic arcs which stems from the parabolic form of the generative formulae. Indeed, if one plots the points as in 3D, one can see that they lie on the parabolic sections cutting the surface of the generative cone of the conic (Figure 7).

The intricacy of their actual pattern arises from the interplay of this more obvious feature with the distribution of coprimes with opposite parity. One specific aspect of this arrangement is the presence of certain pairs that differ by 1, e.g. (3,4), i.e. triples with legs differing by 1. Rather interestingly these pairs are related to a specific case of the above considered indeterminate equations: . The successive solutions of this equation are shown in the below table:

From the as above values (i.e. the y column) we get:

Now are the triples whose legs differ by 1

A further striking relationship captures a more general aspect of the distribution of triples: We first order all triples by increasing magnitude of their hypotenuse. will be the ith hypotenuse and will be the number of triples with . Then we see that:

This convergence is illustrated in Figure 8. Thus, remarkably, as is typical of mathematics, we start with the elementary geometry of right triangles which are part of the rectilinear figures of the vaidika ritual, pass on to conics, intersect with the object of the cakravāla, and end up with a nice appearance of that quintessential number . Thus, one appreciates Gauss’s famous statement: “ἀεὶ ὁ θεὸς ἀριθμετἰζεῖ (the god always arithmeticizes)”.

Figure 8