# Combinatorics and Chandas-śāstra‑2

Origins of Combinatorics in Chandas-śāstra

The Chandas-śāstra has some very interesting and intricate connection with mathematics. The word chandas means of prosody, the science of metres. It has been estimated by scholars that this Chandas-śāstra was composed by Piṅgala-nāga around 3rd century BCE, though there could be some uncertainty in his period. In his Chandas-śāstra, Piṅgala introduces some combinatorial tools called pratyayas which can be employed to study the various possible metres in Sanskrit prosody. The algorithms presented by him form the earliest examples of use of recursion in Indian mathematics. In the forthcoming articles we shall delve more into greater understanding of the various algorithms or pratyayas enunciated by Piṅgalācārya.

Pratyayas in Piṅgala’s Chandas-śāstra

In chapter eight of Chandas-śāstra, Piṅgala introduces the following six pratyayas:Prastāra: A procedure by which all the possible metrical patterns with a given number of syllables are laid out sequentially as an array.

Saṅkhyā: The process of finding total number of metrical patterns (or rows) in the prastāra.

Naṣṭa: The process of finding for any row, with a given number, the corresponding metrical pattern in the prastāra.

Uddiṣṭa: The process for finding, for any given metrical pattern, the corresponding row number in the prastāra.

Lagakriyā: The process of finding the number of metrical forms with a given number of laghus (or gurus).

Adhvayoga: The process of finding the space occupied by the prastāra.

Algorithm#1 ~ Prastāra

Piṅgalācārya presents the steps for constructing the prastāra, which is the first of the six pratyayas in four terse sūtras. The procedure outlined here helps in the ordered and consistent listing of all the possible combinations of a n-syllabled metrical pattern, which is technically termed as varṇa-vṛtta. It is important to keep in mind that this construction is for varṇa-vṛtta or metrical meters.

The following sūtras correspond to the procedure of constructing prastāra.द्विकौ ग्लौ। मिश्रौ च। पृथग्लामिश्राः। वसवास्त्रिकाः ।

(छन्दःशास्त्रम् ८.२०-२३)

The steps presented here are essentially the following:

Form a G, L pair. Write them one below the other.

Insert on the right Gs [in one pair] and Ls [in another] .

[Repeating the process] we have eight (vasavaḥ ) metric forms in the 3‑syllable-prastāra.

To illustrate we shall consider the following pair:GL

Now we add Gs to the right of this pair and then with the same pair add Ls to the rightGGLGGLLL

The above forms the enumeration of a 2‑syllabled meter hence called 2‑syllable-prastāra. To form the third, we use the above set, add Gs to the right and then use the same set and add Ls to the right to obtain the 3‑syllable-prastāra. The following illustration captures the same.GGGLGGGLGLLGGGLLGLGLLLLL

Iteratively, doing the same shall lead to higher orders. As explained in the previous edition, substituting 0 for G and 1 for L and taking the mirror image will lead to the modern binary numbers’ ordered representation.

There are also other kind of prastāras for enumeration of mātrā-vṛtta or moric meters that are based on number of beats/units, Tāna-Prastāra for enumeration of permutations or tānas of svaras and Tāla-Prastāra for enumeration of tāla forms. All these can be broadly put under the body of development of combinatorics in India, which we shall later see in this same series. Piṅgala has only briefly touched upon mātrā-vṛtta in Chapter IV of Chandas-śāstra while discussing the various forms of Āryā and Vaitālı̄ya vṛtta. The studies of other vṛttas happened in later periods, which we shall learn in those respective stages of this series.

Alternative Algorithm ~ Prastāra

In Vṛttaratnākara authored by Kedāra (c.1000 CE), we find the presentation of another ingenious algorithm for building the n‑syllable-prastāra. पादे सर्वगुरावाद्याल्लघुं न्यस्य गुरोरधः।

यथोपरि तथा शेष भूयः कुर्यादमुं विधिम्।

ऊने दद्याद्गुरूनेव यावत्सर्वलघुर्भवेत्। ( वृत्तरत्नाकरम् ६.२‑३ )

Start with a row of Gs. Scan from the left to identify the first G. Place an L below that. The elements to the right are brought down as they are. All the places to the left are filled up by Gs. Go on till a row of only Ls is reached.

A great advantage of this algorithm is that the ordered sequence can be built from any given instance in the listing. The following illustration presents five successive rows in 4‑syllable prastāra built using the algorithm in Vṛttaratnākara.GGGLLGGLGLGLLLGLGGLL

In row 1, we have GGGL. Scanning from left to right, the moment we encounter a G we make it an L in the below row and retain the rest of the string, as is. Then in row 2, we have LGGL. Scanning from left, we identify the first G (second character), switch that to L, flip all that is there to left to Gs of that location and the characters to the right are kept as is. Continuing in this fashion, the prastāra can be built.

It is indeed enthralling to know in depth about the rich scientific heritage of the Indian civilization. We shall continue to learn about the other algorithms or pratyayas enunciated by Piṅgalācārya in the following editions.

Aum Tat Sat!