Combinatorics and Chandas-śāstra-3 The Chandas-śāstra has some very interesting and intricate connection with mathematics. The word chandas means of prosody, the science of metres.

Share now!

India has been a cradle not only to refined civilizational best-practices but also to multitudinous scientific developments. Evidence and knowledge of voluminous literature produced in Indian scientific pursuits has been well established by serious researchers. In contrast, there is prevalent ignorance about facts and feats that we have inherited. 

Awakening Indians to Indian Sciences is important to build a better perspective about this land and its people, to own up to what is truly ours and align our actions in coherence with the vision and momentum set forth by the great Jnanis of our civilization. As we protect, preserve and celebrate various temples, monuments, artefacts and places of historic eminence, so too, we must preserve and protect intellectual breakthroughs in our Indian traditions through awareness, assimilation and dissemination.

Through a series of short articles, may we enlighten ourselves in a few “must-know” aspects about our rich scientific heritage. We set forth to cover a few highlights in the development of Jyotiṣa (Astronomy) and Gaṇitā (Mathematics). The development of both these fields can broadly be put in three eras: 

  • Vedic or Pre-Siddhantic Era, 
  • Siddhantic or Classical Era and  
  • Post-Siddhantic or Medieval  Era. 

Thus far we have looked at highlights of Jyotiṣa in the Vedic Era and the development of Gaṇita in the Vedic Era covering earliest evidence of numbers, development of Geometry, a broad introduction to Śulba-sūtras, their contents and applications. Very importantly, we have also looked at the lesser known fact that a clear enunciation of the so-called ‘Pythagorean’ theorem, which must rightly be named the Śulba Theorem (called bhujā-koṭi-karṇa-nyāya in the later literature) has been described in Baudhāyana-śulbasūtra and a variant in Mānava-śulbasūtra. We have also summarised the overall mathematical contents of the Śulba-sūtras. Having delved into the Vedic period, we have moved ahead in the timeline and presented an introductory glimpse into the phenomenal breakthroughs of Piṅgalācārya (3rd century BCE).

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 previous edition of Parnika, we looked at the algorithm given for Prastāra. In the current article we shall delve more into greater understanding of the other 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#2 ~ Saṅkhyā

Piṅgalācārya presents the the first of the six pratyayasSaṅkhyā involving the steps for finding the total number of possible metrical patterns in four terse sūtras. In our schools that teach us modern mathematics and computing, we have learnt that in binary number system, the total number of possible combinations for a n-length binary number is 2n. Similarly, here we have the binary states of guru and laghu, hence the total number of patterns possible for a n-syllabled metrical pattern is 2n. The procedure outlined in these sutras is a unique approach to computation of 2n.

The following sūtras correspond to the procedure of calculating Saṅkhyā.


द्विरर्धे। रूपे शून्यम्। द्विःशून्ये। तावदर्धे तद्गुणितम्।

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

Piṅgalācārya gives an optimal algorithm for finding 2n by means of multiplication and squaring operations that are much less than n in number. The steps presented here are essentially the following:

  • Halve the number and mark “2”.
  • If the number cannot be halved perfectly deduct one and mark “0”

[Proceed till you reach zero. Now we have a string of markers in 0s and 2s.

Start with 1 and scan the sequence of marks from the last to first.]

  • If “0” is the marker, multiply the current value by 2
  • If “2” is the marker, square the current value

To illustrate we shall consider the following example:

May we employ the Saṅkhyā algorithm to find the total number of combinations in a 6-syllabled meter.

  • 6 ÷ 2 = 3 and mark “2”
  • Here, 3 cannot be perfectly halved. So,

3 1 = 2 and mark “0”

  • 2 ÷ 2 = 1 and mark “2”
  • 1 1 = 0 and mark “0”

Now we have the marker-string “2 0 2 0”. Then we do the following steps to arrive at the total value, by scanning the marker-string from last to first.

Step Current Value Marker Operation
a. 1 0 Multiply by 2; so 1 x 2
b. 2 2 Square current value; so 2 x 2
c.  4 0 Multiply by 2; so 4 x 2
d. 8 2 Square current value; so 8 x 8 
Hence final value is 64


Highlight of the algorithm:

Whenever we find the n-th power of a number, it typically involves n multiplication operations. Whereas this method involves much less than n multiplications. Hence Piṅgalācārya gives an optimal algorithm for finding 2n by means of multiplication and squaring operations that are much less than n in number. 

Sum of Saṅkhyās:

Following the above algorithm, Piṅgala gives two interesting mathematical results. In the very next sūtra he gives the sum of all the saṅkhyās Sr for r = 1, 2, . . . n.

द्विर्द्यूनं तदन्तानाम्। (छन्दःशास्त्रम् ८.३२)

S 1 + S 2 + S 3 + . . . + S n = 2S n − 2

Then comes the following
sūtra with one more mathematical relationship.

परे पूर्णम्। (छन्दःशास्त्रम् ८.३३)

S 1 + S 2 + S 3 + . . . + S n = 2S n − 1

Together, the two
sūtras imply S n = 2 n and 1 + 2 + 2 2 + . . . + 2 n = 2 n+1 − 1. This clearly is the formula for the sum of a geometric series.

Saṅkhyās in the case of asymmetric metrical usage in prosody:

Mathematical inquisitiveness of Piṅgalācārya continues to shine in further verses where he presents the mathematical results in the case of asymmetric choice of meters employed in construction of the verses. The saṅkhyā 2 n discussed above is for the case of syllabic metres of n-syllables which are sama-vṛttas – metres which have the same pattern in all the four pādas or quarters. Ardhasama-vṛttas are those metres which are not sama, but whose halves are the same. Viṣama-vṛttas are those which are neither sama nor ardhasama

In the fifth Chapter of Chandaḥ-śāstra, Piṅgalācārya has dealt with the saṅkhyā of Ardhasama-vṛttas and Viṣama-vṛttas in the following sūtras:

समं तावत्कृत्वः कृतमर्धसमम्। विषमं च। राश्यूनम्। 

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

The number of
Ardhasama-vṛttas with n-syllables in each pāda is

( 2 n ) 2 − 2 n

In the same way, the number of Viṣama-vṛttas with n-syllables in each pāda is 

( 2 2n ) 2 − [  ( ( 2 n ) 2 − 2 n ) + 2 n ] = ( 2 2n ) 2 − 2 2n

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!

Anaadi Foundation is a socio-spiritual organization dedicated to self-unfoldment of individuals