For improved reading experience one may use the PDF version.
Students of the history of Hindu mathematics are well-acquainted with Nārāyaṇa-paṇḍita’s sophisticated treatment of various aspects of combinatorics and integer sequences in his Gaṇita-kaumudī composed in 1356 CE. In that work he gives about 43 problems relating to combinatorics. Continuing with our study of various aspects of Nārāyaṇa’s work using a modern lens, in this note we shall look at some of his problems in combinatorics and what a modern (low level) student can learn from them.
The first problem we shall look at introduces a student to the discrete factorial function using a verse in the Vasantatilakā meter;
Problem-1:
cāpeṣu khaḍga-ḍamarūka-kapāla-pāśaiḥ khaṭvāṅga-śūla-phaṇi-śakti-yutair bhavanti ।
anyonya-hasta-kalitaiḥ kati mūrtibhedāḥ śambho harer iva gadā’ri-saroja-śaṅkhaiḥ ॥
With a bow (1), an arrow (2), a sword (3), a double-drum (4), a skull (5), a lasso (6), a skull-topped rod (7), a trident (8), a snake (9) and a spear (10) — by changing them from one hand to another how many different images of Rudra come to be? Likewise, of Viṣṇu with a mace (1), a wheel (2), a lotus (3) and a conch (4).
For Rudra with 10 arms the answer is , whereas for Viṣṇu it is
. This problem was well-known among earlier Hindu scientists and is not original to Nārāyaṇa. Here, he is merely reusing this verse without any change from Bhāskara-II’s Līlāvatī. In the case of Viṣṇu, each of these 24 permutations have a specific name starting from Keśava. There are correspondingly 24 forms of Lakṣmī. These forms are an important aspect of the Pañcarātra system where they are counted along with the 4 basic vyūha-s in the śuddha-mūrti-s (“Platonic” forms) in texts like the Nārada-pāñcarātra and are attested in iconography across the Indosphere. The general use of permutations in various endeavors is mentioned by Nārāyaṇa after he provides the procedure for writing out the permutations:
aṅka-prastāra-vidhiś caivaṃ mūrtiprabhedānām ।
sa-ri-ga-ma-pa-dha-nīty eṣāṃ vīṇāyā nikvaṇānāṃ ca ॥
This procedure generating the permutation of digits is also used in permutations of images [of deities], sa-ri-ga-ma-pa-dha-ni (the notes of Hindu music) and the notes produced by the vīṇā.
Problem-2 (A verse again in the Vasantatilakā meter):
dhātrī lavaṅga-dala-kesara nāga-railā vakraṃ kaṇāḥ samaricāḥ sasitā bhavanti ।
ekādibhiś ca militair gadināṃ katīha cūrṇāni bho vada gadāpanude gadajña ॥
O apothecary, how many different different disease-curing spice-powders come from mixing one etc (i.e. 1, 2, 3…) of gooseberry, clove, cinnamon, saffron, ginger, cardamom, Indian may apple (Sinopodophyllum hexandrum), cumin, pepper and sugar?
This type of problem is encountered widely in Hindu literature — we find a discussion of the combinations of tastes in the medical saṃhitā-s of Caraka and Suśruta. Subsequently, the great naturalist Varāhamihira in 550 CE discussed the production of various perfumes by combinations of basic scents. Such combinations are also discussed by king Bhojadeva Paramāra in his chemical treatise in the 1000s of the CE. Related problems are also taken up in Bhāskara-II and by the polymath Śārṅgadeva in his musical treatise. This particular problem is rather typical of the combinations used in preparation of drugs in Āyurveda. As a pharmacological aside the Indian may apple if properly used can be quite effective treating tumors caused by certain papillomaviruses. Returning to the solution of the problem, we need to recall the formula for combinations:
Let be the total number of powders that can be created via each set of combinations: by taking 1 at a time we get 10, by taking 2 at time we get
and so on. Thus, we get:
In Hindu tradition, the study of combinations and their sum goes back to at least the Chandas-śāstra (the treatise on meters) of Piṅgala. This has been extensively discussed in the literature and we present it only briefly:
pare pūrṇam । pare pūrṇam iti । CS 8.34-35
Complete it by using the two distal ends. Repeat to complete using the distal flanking ends.
While these original sūtra-s of Piṅgala are difficult to directly understand, they have been explained in the glosses of several authors since (e.g. Kedāra-bhaṭṭa and Halāyudha). The two sūtra-s specify the construction of the Meru-prastāra or the combinatorial triangle. The first sūtra implies that you write out the flanking cells with 1 corresponding to row :
The second sūtra implies that you fill in the interior cell by repeating the procedure:
While this is extensively discussed in the context of Chandas, one can also find a clear algorithm in Bhāskara-II’s Līlāvatī using the combination function to produce not just the combinatorial triangle (Meru) but also any row or cell of it. Thus, from the Meru we can write the formula for the expansion of a binomial as:
This tells us that the null-product or (implicitly provided in Bhāskara-II’s algorithm: there only 1 way of not choosing anything). The magnitudes of the
-combination or the values assumed by the combination function for a given
as
changes determine the values of the individual terms of the above expansion. Hence, we use the problem-2 to introduce and illustrate to students the shape of the binomial distribution (Figure 1). Since the Meru itself can be seen as the triangle of
, we get the formula for the sum of combinations for a given
as,
If we leave out the null combination , we get
as in the problem-2 where
.
As this note is part historical and part educational (for a low-level student), let us next consider another binomial expansion that played a cornerstone role in the origin of modern mathematics,
We can intuitively sense based on the easily-determined first 3 terms that it might converge to some number between 2 and 3 but what is that number? We can experimentally see that the above expression converges slowly: for we get 2.6; for
we get 2.7; for
we have 2.71. This is exactly where Jakob Bernoulli got to when he first encountered this problem and realized that it was converging to something around 2.71. However, we can do better by determining the limit:
Taking the limit we get:
Thus, our limit is the infinite sum of the reciprocal of the factorials. This is much faster-converging and with just 10 terms converges to 7 places after the decimal point to 2.7182818… The importance of this limit and the number it converges to comes to fore in another central result in the emergence of modern mathematics: What is the rate of change (derivative) of the logarithmic function? Let us start with a logarithm taken to some base , i.e.
. Hence,
Now we can write as some
. As
. Thus, we can rewrite our limit as:
We observe that this is the same limit we evaluated above. Now, if we define as the sum of the reciprocal of the factorials, which is the limit, and set
then
. Thus, we get
to be the natural base of logarithmic function and the derivative of
. Conversely, the area under a unit rectangular hyperbola, i.e
is the logarithmic function with base
.
Armed with , we can next retrace certain developments in the history of early modern mathematics. What is the relationship of an arbitrary exponential curve
to
. For this we need to first determine the derivative of
. This is trivially done now that we have the derivative of
:
With this in hand we can see the relationship of any exponential curve to
(Figure 2):
Consider the family of exponential curves
(Figure 2; the red curve is
). From the above result we see that the tangent to a exponential curve will have the slope
Let
. Then:
A line passing through origin has the equation
. We set
; when
the equation of the line yields
. Similarly, the equation of the exponential curve yields
. Thus, the line
is the tangent to
from origin.
Thus, the tangent to an exponential curve from the origin will touch it at a height of
from the
-axis at
Given the derivative of the exponential function, it is obvious that the derivative of is
. This in turn allows one to establish the relationship of any power of
to the reciprocal of factorials. Consider the infinite series:
Now the function whose derivative is the same as the function itself is ; hence,
Thus, this gives the relationship of a power of to the reciprocal of factorials. If we put
in the above we get the same infinite series for
as we obtained from the above limit. With this in hand, we can arrive at one of the most remarkable functions discovered in the history of early modern mathematics that is key to our understanding of the universe.
In problem-2 we saw the magnitudes assumed by the combination function. We see that they appear to define a bell-shaped curve (Figure 2, 3). What is the curve that best approximates the binomial coefficients as (Figure 3; shown for
). For this we can begin by noting the following. It is a symmetric curve around the central or the highest value binomial coefficients. It falls sub-exponentially and is asymptotic to the
-axis. Given this we can try to construct this basic shape with its maximum centered on
using an infinite series approach (Figure 4). Given that it is symmetric, we only need to consider even powers of
in such a series.
We start with . This in the least captures the maximum but little else. So the next term corrects this by a subtraction to get a curve around the maximum; thus
. However, this correct falls straight down and we have to add a term to get closer to the asymptotic behavior with respect to the
-axis. Thus we get:
. We continue this process (first 8 steps are shown in Figure 4) and get the infinite series:
From the above series for a power of we can immediately see that:
This is the famous equation of the shape of the normal distribution, which is a limit of the binomial distribution as . With this we can now provide the continuous approximation for the combination function normalized by the maximal combination (Figure 3):
Thus for the actual combination function we get:
Problem-3:
nāgāgni-randhrair-dvi-guṇo’ṅga-candrair
vadāśu rupādi navāvasānaiḥ ।
bhedām̐ś ca labdhy aṅka-mukhāntya-bhedān
ūrdhvāṅka-yogaṃ sakalāṅka-yogam ।
aṅka-prapātaṃ ca sakhe pṛthak te
vadā ‘ṅkapāśe ‘sti pariśramaś cet ॥
Snakes (8), fires (3), deficit (9): (9,3,8); two (2), guṇa-s (3), limbs [of Veda] (6), moon (1): (1, 6, 3, 2); starting from form (1) to nine (9): (1,2,3…9); Quickly state: (i) the number of permutations; (ii) the number of permutations either beginning or ending in one of those digits; (iii) sum of digits in a particular place; (iv) sum of all numbers [formed by permutation of the digits]; (v) the total number of digits; O friend state these for each set separately if you have labored on combinatorics.
Let be the number of the objects participating in the permutations without replacement and
be those objects, in this case digits. Given this, the problem systematically takes you through several interesting questions:
(i) The bheda-s, i.e. permutations: . For
it is 362880.
(ii) The aṅka-mukha-s or aṅkāntya-s, i.e. number of permutations that either begin or those that end in a particular digit: . This is so because we keep one position constant and allow the remaining to vary freely; thus,
positions are available for permutation. For
it is 40320.
(iii) The ūrdhvāṅka-yoga, i.e. the sum of the numbers in a particular column. . From the above we saw that the number of permutations starting with a particular digit is
. Thus, for a given column, we will have that many permutations with each digit. Thus,
multiplied with
will give us the sum for a given column. For
it is 1814400
(iv) The sakalāṅka-yoga, i.e. the sum of all the numbers formed by the digit permutations. . We have the expression for the sum of a column from above. Now, consider a small example of the given problem with 3 digits. We can rewrite the numbers formed by the permutations to keep the same total thus:
As a result we can express the sum of all numbers formed by the permutation of the digits to be the sum of a column multiplied by ; 111 for the above example. Thus, for
we get
.
(v) Finally, the aṅka-prapāta, i.e. the total number of digits in all the permutations. . Since there will be
permutations and
starting digits it is easy to see that the total number of digits across all permutations will be the above expression. For
it is 3265920.
One would have noticed that we have used for
. When Gauss studied the continuous form of the factorial function he merely took it as
; however, the French mathematician Legendre defined it using
. We take the Legendre definition of the famous Gamma function as it naturally emerges in solutions of problems such as that of Nārāyaṇa. Indeed, this definition also naturally emerges from the famous integral of Euler for
that behaves just like the
function. Being an integral this also gives the continuous form of the
function specifying the value of the function for non-integer
. Euler’s integral:
This integral can be handled using the rule for integration by parts:
Using and
we get:
Taking the limits we get:
By putting and doing the above repeatedly we get
until we reach 1 at which point the integral becomes:
In the final part of this note we shall consider the integer sequence defined by the aṅka-prapāta: . Now let us do this for the sets of
permutable symbols. We get the integer sequence
:
1, 4, 18, 96, 600, 4320, 35280, 322560, 3265920…
This sequence has a notable property. It defines the number of integers from that are not divisible by
for
. Why this is so is easy to apprehend: Since we start from 2, we have
. Now the numbers that will be divisible by
between
will amount to
. Therefore, the numbers that will not be divisible by
will amount to
.
If we take the sum of the reciprocals of this sequence we see that it converges to a constant:
Now, what is this number? We discovered that this number emerges from the solution of an interesting definite integral:
The integral can be split up as:
It is immediately apparent that the first integral is a tricky one: the function
diverges to
as
(from positive side) and to
as
(from negative side). Remarkably, these opposite divergences cancel each other and the integral converges to a fixed value. Thus we can evaluate it to a given
as:
This function is the exponential integral with deep connections with permutations. The two divergences of
exactly cancel each other when
, i.e.
. This
is the Soldner-Ramanujan constant that was first discovered by Johann von Soldner and independently by Ramanujan who arrived at it when he discovered multiple series for the logarithmic integral
(Figure 5), which Gauss had shown to provide the asymptotic description of the distribution of prime numbers. The famed
. Returning, to our original integral we can thus write its indefinite solution as:
Now we observe that as (we only consider the approach to 0 from positive side for only there the real
is defined). The two remarkably balance each other such that as
the above integral converges to
, which is the famous Euler-Mascheroni constant with a deep connection to the Gamma function (See below). Thus, the definite integral (Figure 5):
This leads us to the formula:
From this and the above indefinite integral we can obtain the general formula for as:
If we now substitute by
we get the series for the logarithmic integral as:
This was the series for that Ramanujan arrived at unaware of work of Gauss, Soldner and their successors in Europe. He then went on to discover other series that converged even faster to
. With these relationships one can finally obtain a relationship between the mysterious Euler-Mascheroni constant
that appears in various formulae pertaining to both the number world and the natural world and the Soldner-Ramanujan constant
of number theory. Since
when
by substituting this into the above series for
we get:
The first expression is the derivative of the Gamma function. The second expression is Euler’s original definition of
as a limit. The third is what we obtain from the above substitution, which gives it in relationship to
as derived from Ramanujan’s series.
Thus, in the works of the last great mathematicians of the Hindu tradition like Bhāskara-II, Nārāyaṇa and Mādhava we see the preamble to the developments of modern mathematics, which revealed the deep links between the number world and the natural world. Nārāyaṇa’s interest in combinatorics, sequences and sums may be compared with that of Euler. Armed with a photographic memory and an enormous capacity for numerical calculations, Euler was much like a paṇḍita of yore. Indeed, he dealt with infinite sums and definite integrals almost like a continuation of that old tradition. But among the Hindus it was Ramanujan, who close to 600 years after Nārāyaṇa and Mādhava nearly seemed as if he was channeling them to single-handedly take their tradition to a conclusion.