Consider the following problem – A musician has to compose an n-beat rhythm. A heavy syllable takes up two consecutive beats, while a light syllable takes up a single beat. How many total rhythms does the musician have to choose from?
At first glance, the problem may seem daunting – that won’t likely change with further glances, given that it is indeed tricky to approach conventionally using high-school combinatorics.
Now, let us employ good old trial-and-tinkering. Let’s first take a single-beat, i.e. formally speaking, n=1. There are no two ways to go about it – a single slot can be filled in a single way using a single beat, i.e. one light syllable only. For two slots, i.e. n=2, there are two ways – two light syllables (1 beat each) or a single heavy syllable (2 beats). For three slots, i.e. n=3, there exist three ways – three-light syllables, one light syllable followed by one heavy syllable, or vice-versa.
To put it simply, let us represent a light syllable by the symbol । and a heavy syllable by the symbol ऽ. For four slots, i.e. n=4, there exist five ways:
- ।।।।
- ।।ऽ
- ।ऽ।
- ऽ।।
- ऽऽ
Similarly, for five slots, i.e. n=5, one can readily see that there exist eight ways. Do you discern a pattern emerging yet ? 1, 2, 3, 5, 8… Each term is the sum of the two terms preceding it. In mathematical parlance, this is referred to as the Fibonacci series. The Fibonacci series is something which seems to be interwoven in the very fabric of nature, manifesting at unexpected places.
If you continue to manually perform the increasingly tiresome task of listing out the various permutations for higher values of n, you will notice that it is indeed the case that every term is the sum of the previous two terms. But, how can one prove this fact in a rigorous and foolproof fashion ? There is an elegant way of doing so, which requires no formal mathematical background.
Let us devise a general formulation. Denote the number of total rhythms as a function of (dependant on) the number of available slots, i.e. ‘n’, the rhythm length. Thus the required answer is what we denote as f(n): The number of ways to freely fill the n slots with singlets and doublets. Now, let us try to ascertain a relation to help us find the value of f(n).
For this, let us seek the aid of an 11th-century Indian Sanskrit poet.
“The last syllable can either be heavy or light”,
the Jain polymath monk Hemachandra (हेमचन्द्र) (IAST:hemacandra) wrote in his treatise (the entirety of which was composed in proper, metrically-rigorous poetic verse, in Sanskrit language). You might have had two double-takes here – why was a poet concerned with solving a mathematical problem, and what even does the assertion, fewer than ten words, mean or imply?
Of course the last can be heavy or light, in fact, each slot can be either of the two alternatives. What’s the catch?
Given that Sanskrit literature has a distinctive feature that relies on the reader to interpret and intuitively follow it. Let us try to figure this out and obey his instructions. We take ‘n’ slots – ‘n’ blank spaces. Following his cue, we create two cases – one in which the last space is occupied by a light syllable and another in which a heavy syllable occupies it. If the last syllable is fixed as light, we now have (n-1) slots remaining, and in this case, we have f(n-1) ways to fill the remaining slots, hence this case has f(n-1) sub-cases. Similarly, if the last syllable is fixed as heavy, we now have n-2 slots remaining, and hence this case has f(n-2) ways to fill the slots left , thus affording f(n-2) sub-cases. Since these two cases are disjoint and mutually exclusive (like heads or tails in a coin toss), we simply need to add the individual cases together to get the total number of possibilities (permutations). Thus, we arrive at the relation f(n)=f(n-1)+f(n-2).
This is what we call a recursive relation – a relation that invokes its predecessor term(s). Just by specifying values up to n=2 manually, we can it to find the value of f(n) for any n greater than 2.
Now, getting back to the credential bit; What exactly was a poet doing with a math problem ? The thing most contemporary western audiences might not be familiar with is that in Indian poetry, a lot of stress (pun intended) is put on writing poetry in the metrical scheme. In it in that context that this mathematical problem was dealt with. In fact, in poetry, metre is something that comes very organically, and any poem carries with it a rhythm that serves as a natural mnemonic. Even in English poetry, metre and metrical schemes manifest in numerous beautiful variations. For example, take let us look at a part of John Keats’ “Ode to Autumn.”
Season of mists and mellow fruitfulness,
Close bosom-friend of the maturing sun;
Conspiring with him how to load and bless
With fruit the vines that round the thatch-eves run;
To bend with apples the moss’d cottage-trees,
And fill all fruit with ripeness to the core;
To swell the gourd, and plump the hazel shells
With a sweet kernel; to set budding more,
And still more, later flowers for the bees,
Until they think warm days will never cease,
For Summer has o’er-brimm’d their clammy cells.
Here each verse follows what is called an ‘Iambic pentameter’. In metres such as these,the rhythm is measured in small groups of syllables called feet. The term iambic which stems from the word ‘iamb’ refers to the type of foot used. An iambic foot consists of an unstressed syllable followed by a stressed syllable as in the word ‘above’ ( a-bove). Thus each iambic foot can be represented by the rhythmic pattern da-DUM. The term ‘pentameter’ indicates that this particular metre has five feet. So rhythmically, a standard line in Iambic pentameter can be represented as
da DUM da DUM da DUM da DUM da DUM
Before we proceed to deal with metres in Sanskrit poetry at length (pun intended), let us first get this out of the way. In essence, the poet was not inclined towards pursuing a mathematical problem for the sake of it; it was merely a necessity that he overcame to best understand and enumerate aspects of prosody in Sanskrit. It was primarily a linguistic pursuit, the so-called ‘mathematics’ just happened to be there and was promptly dealt with. In India, although epistemic categorization was elaborate, the pursuit of education, thought and scholarly studies were integral, and seldom discretised. On the rare occasions that they were divided and distinguished, the discipline-wise distinction was practical and utilitarian.
In case you are intrigued and awed at the existence of the Fibonacci series in India, well before its discovery in Europe, or the general oblivion to it, hold your horses, for neither was the polymath Hemachandra, the mathematician among poets, nor was he the poet among mathematicians, nor was his novel expression of the Fibonacci Series the only of his claims to fame, nor was he the first Indian to discover the Fibonacci Series, nor is he the subject of our further discussions.
In ancient and medieval India, it was common for polymath scholars to propose new solutions to select mathematical problems in perfectly-metered, elegant poetry. It was not all that glorious, and done rather unsung (pun unintended). This is in no way to discredit Fibonacci – Leonardo Bonacci of Pisa, whose 1202 book Liber Abaci was instrumental in sparking a revolution in business and trade accounting and calculations, accelerating the growth of banking and record-keeping in Europe by delineating the Indian number system and its advantages to the west and also introduced the series to the west.
As mentioned previously, metres are encountered in both oriental and occidental literature, but Indians use metres much more vibrantly, and entire treatises are written in metres. Hemachandra gave his solution in a single, simple, crisp, concise sentence which is unseemingly insightful yet seems obscure, deficient or grossly incomplete to the casual reader, because it requires initiative on the part of the reader to discern its context and expand the wisdom encapsulated in its brevity. It assumes that the reader is a rational thinker, albeit it does not require any significant mathematical knowledge beyond the elementary.
In accordance to the prevailing paradigm of writing in very succinct (yet lucid, not terse) verses, the entirety of Hemachandra’s work is set to appropriate poetic meters and contain the distillate of his derivations. Hemachandra makes sure that there is no ambiguity even while seeking brevity in his writing. In fact, this brevity is an essential requirement of another particularly peculiar Indian way of writing, called Sutra (सूत्र) (IAST:sūtra) (Lit. string) prescribed for quilling down rules, systems, and codifications. This form takes brevity so far that it seems downright ridiculous at the first look – condensing a two-sentence rule to a single word – a combination of abbreviation and key-based referencing.
Before Halayudha (हलायुध) (IAST:halāyudha) who wrote an extensive commentary on Hemachandra’s own commentary, expanding some of its parts, and adding appendices, there are numerous others from a long line of poet-grammarians who probed such problems. The person who stands at the apex of this list is a gentleman named Pingala (पिङ्गल) (IAST:piṅgala).

Pingala, the second-century BCE grammarian, was considered a mathematician by western historians, although his magnum opus – the Chandashaastra (छन्दःशास्त्र) (IAST:chandaḥśāstra) is a seminal compendious treatise on Sanskrit prosody. Pingala never intended to directly pursue the discovery of the mathematical formulations he would arrive at per se, these discoveries were just intermediaries to him to solve his inquiries concerning poetic structure.
Unlike Hemachandra whose solution to the mathematical problem albeit also a byproduct of his pursuit of poetic prosodic inquisition, were themselves written as rich, perfectly-structured poetic verse, Pingala’s writing was in Sutras, radical contractions of rules accomplished by enciphering entire words and sets into single alphabets, characters or syllables. They rely on the reader’s keenness in addition to commentaries to deduce and disambiguate from context, headers, common sense, and conceptual knowledge and interpret the encoded. It is even beyond the ability of ordinary graduates in Sanskrit to decode and comprehend Sutra writing without commentary.
For example one of Pingala’s sutras goes as follows: “Mishrau cha” (मिश्रौ च) (IAST:miśrau ca). That’s it! It literally translates to “The Two are Mixed”. In context, it yields the same recursive relation that we discussed earlier – a term is obtained by adding its two immediate predecessors.
Note that almost any ancient Indian text you encounter contains parts that were orally transmitted likely for centuries before they were written down, recorded, and documented. This oral pedagogical preference is also responsible for a lot of knowledge and evidence being lost with the advent of colonialism and the ensuing breakdown of the traditional educational structure.
Before one can proceed to delve further into Pingala’s works, it is essential to familiarise with Sanskrit prosody. Note that any results mentioned here might very well have predated Pingala who through the comments in his works appears to be merely the pioneering systematiser of the oral knowledge than its originator per se.
There are three principal kinds of metres commonly encountered in Sanskrit (although evidence suggests accent-based metrical schemes might have existed earlier in Vedic Sanskrit). The first kind is ‘Aksharavrutta’ (अक्षरवृत्त) (IAST:akṣaravṛtta), where the metre depends on the number of syllables in verse irrespective of the light-heavy patterns. The second kind is ‘Varnavrutta’ (वर्णवृत्त) (IAST:varṇavṛtta), where the metre depends on the syllable count as well as the light-heavy patterns. The last kind is ‘Matravrutta’ (मात्रावृत्त) (IAST:mātrāvṛtta) where the meter depends on duration, where the metre depends on the number of morae (sum of duration).
The way we analyse a metre is by grouping syllables into triplets. Each syllable can either be light (‘laghu’) (लघु) (IAST:laghu) or heavy (‘guru’) (गुरु) (IAST: guru), ergo, eight (23) such kinds of groupings are possible. Each such ordered triplet is called a ‘gana’ (गण) (IAST:gaṇa). These are denoted by prefixing a character before the word ‘gana’ viz. Ya-gana, Ma-gana, Ta-gana, Ra-gana, Ja-gana, Bha-gana, Na-gana, and Sa-gana.
Each of these, as explained afore, is a unique series of three syllables. A handy, as well as an elegant mnemonic for remembering them, is “Yamaataaraajabhaanasalagam“, (यमाताराजभानसलगम्) (IAST:yamātārājabhānasalagam) which is a De Bruijn sequence of order 3. This means that it is cyclic and each triplet occurs in it exactly once as its sub-sequence.
Prosody rules have it that syllables with consonants preceding heavy vowels (as ‘aa’) are heavy while those with consonants preceding light vowels (as ‘a’) are light. Another of the rules deems the half-nasal used in ‘gam’ to be enunciated as a doublet, thus being heavy.
Now we form triplets starting from the first syllable – ‘Yamaataa’ (यमाता) (IAST: yamātā) This is of the structure light-heavy-heavy. Then we have ‘Maataaraa’ (मातारा)(IAST:mātārā) heavy-heavy-heavy and so on.
Name of Gana | Sequence | Weight | Symbol | Greek Equivalent |
Ya-gana
(य-गण) |
यमाता | L-H-H | ।ऽऽ | Bacchius |
Ma-gana
(म-गण) |
मातारा | H-H-H | ऽऽऽ | Molossus |
Ta-gana
(त-गण) |
ताराज | H-H-L | ऽऽ। | Antibacchius |
Ra-gana
(र-गण) |
राजभा | H-L-H | ऽ।ऽ | Cretic |
Ja-gana
(ज-गण) |
जभान | L-H-L | ।ऽ। | Amphibrach |
Bh-gana
(भ-गण) |
भानस | H-L-L | ऽ।। | Dactyl |
Na-gana
(न-गण) |
नसल | L-L-L | ।।। | Tribrach |
Sa-gana
(स-गण) |
सलगम् | L-L-H | ।।ऽ | Anapaest |
Fig 2: All the 8 ganas listed in the order of occurrence in yamātārājabhānasalagam
The introductory chapter of the Chandshastra introduces the concept of ‘gana’, but it does not state them in the same sequence as stated in the aforementioned mnemonic. Pingala arranges the eight ganas such that when the triplets are written in that order and the heavy syllable is denoted by 0 and the light syllable denoted by 1, and then each triplet mirrored (because in Indian mathematical tradition we read units place onwards) we obtain the binary number representations for the numbers 0 to 7 in sequence. It is interesting to note in Chandashastra Pingala uses the word ‘Shoonya’ (शून्य) (IAST: śūnya) to denote Zero – a denotation that would arrive in the West only a whole millennium later.

Note that a lot (most) of what we explain isn’t explicitly stated in the sutras – later commentaries, such as those by Halayudha, decipher and elucidate them
Pingala deals six primary prosodical problems and its solutions, i.e. problems concerned with enumerating and enlisting meters. Pingala does not label these problems. These would later be given formal names, each problem and its solution would be called a ‘pratyaya’ (प्रत्यय)
(IAST:pratyaya). These problems equally apply both to varnavrutta and ‘matravrutta the two of the three different kind of metrical schemes we talked about earlier. The algorithms given by Pingala deal only with the varnavrutta aspect of these problems, though he does mention matravrutta in his work.
The six pratyayas are as follows:
- Prastara (प्रस्तार) (IAST:prastāra) (lit: Spread): The most straightforward possible problem, prastara deals with systematically listing down the different possible forms of a given meter. In case of a varnavrutta, prastara involves listing down all metrical combinations possible, given the number of syllables. In case of a matravrutta, it reduces to the exercise of listing all possible metrical combinations, given the length of the metre. The listing should be systematically consistent and not random i.e one should be able to refer to the the combination by its index and vice-versa. These referencing techniques are explained in the upcoming problems. An example of a prastara list would be the way in which Pingala lists the 8 ganas in the introductory chapter of Chandashastra. This is the systematic way to list all possible metrical combinations of a 3 syllable metre.
Pingala gives us the algorithm to list out the varnavrutta prastaras but does not specify an algorithm for the matravrutta prastaras. Although, he states an example for the latter. Succeeding prosodists have developed algorithms to deal with matravrutta prastaras and also modified Pingala’s algorithm for varnavrutta prastaras to yield the same result.
- Nashta (नष्ट) (IAST:naṣṭa) (lit: Destroyed/Lost): This pratyaya deals with recovering the combinatorial form of a metre given its index in the prastara, For a varnavrutta the problem in a modern context is the equivalent of converting a decimal number to its binary form.
For example, if we need to recover the form occurring at the sixth position in the prastaras of say 3, 4 and 5 syllable metres respectively, then effectively we are looking to convert the decimal number 5 to its binary equivalent (6-1 =5, because the listing starts from zero) and express it in expressions sizes 3,4 and 5 respectively. The answer would be 101, 0101 and 00101 respectively. As discussed earlier if we consider 1 as a representation for a light syllable and 0 as the heavy syllable and mirror the forms, then we obtain the results as ।ऽ।, ।ऽ।ऽ and ।ऽ।ऽऽ respectively.
- Uddishta (उद्दिष्ट) (IAST:uddiṣṭa) (lit: Indicated): Uddishta deals with the reverse problem as that of Nashta. Given a combinatorial form we need to find its place in the prastara. In modern terms, it is equivalent to a binary to decimal conversion. Pingala simply reverses his earlier algorithm.
Note: Though Pingala’s algorithms deal with and provide solutions to problems which in modern context are equivalent to decimal to binary conversion and vice-versa, he never interprets the combinatorial string as a binary number. This was done by Mahavira a later prosodist in 850 CE, and many later prosodists adopted this interpretation.
- Lagakriyaa (लगक्रिया) (IAST:lagakriyā) (lit: Long-short exercise): Lagakriya deals with the question of calculating the number of forms with a specified number of short syllables (or long syllables). To put it formally, we are calculating the kth binary co-efficient . This notation calculates “In how many different ways can we choose k objects from n of them (n > k)”. For example, if we have a 6 syllable metre and we want to know how many of its combinations have 2 short syllables or equivalently 4 long syllables we have the answer as e 15 of them. It is to this pratyaya that Pingala’s algorithm looks confusing and has been a part of scholarly debate. Later prosodists like Halayudha and others have dealt with this problem more clearly and elaborately.
If we arrange all possible for all n, we get what’s today called a Pascal’s Triangle.
This kind of construction was present in ancient India as well and was named a ‘Meru‘ (मेरू)
(IAST:merū) (lit: Mountain). As mentioned earlier this pratyaya also applies to a matravrutta as well. Hence both the varnik meru and the matrik meru existed in India.

It is possible to visualize the matrik meru and the Fibonacci numbers we talked about earlier using the Pascal’s triangle through a special construction shown here.

1 | |||
1 | |||
1 | 1 | ||
2 | 1 | ||
1 | 3 | 1 | |
3 | 4 | 1 | |
Fig 6: The matrik meru with the sum of the rows S0 =1, S1=1, S2 =2, S3 =3, S4 =5, S5 =8 and so on which are the Fibonacci Numbers.
- Sankhya (सङ्ख्या:) (saṅkhyā:)(lit: Sum): This pratyaya deals with the problem of finding out the total number of metres possible for a given number of syllables (varnavrutta) or metre length (matravrutta).
For the case of a matravrutta, we have already seen that the sum is equal to the nth Fibonacci number. For the varnavrutta case, each syllable can either be a heavy one or a light one, therefore, the total number of possible combinations is 2n. One can see that this is the sum of the nth row of Pascal’s triangle. Such exponential numbers are often difficult to calculate, especially in an era as old as Pingala’s.
For example let n equals 32, in this case one would have to perform 32 multiplication steps to arrive at the result. It is here that Pingala’s mathematical spirit shines through. After noting that at each step the number doubles, he employs a recursive technique which reduces the number of steps taken from 32 to just 5.
Pingala also specifies the total number of possible metres till a given n.
This is nothing but: 21 + 22 + 23 + 24 + ……..+ 2n. .
This is called a geometric progression. Pingala gives the sum as
dvirdvūnaṃ tadantānām
“twice two-less that (quantity) replaces (the sequence of counts) ending (with the current count).”
That is, 2Sn – 2 = S1 + S2 + ⋅⋅⋅ + Sn.
More explicitly, 2.2n– 2 = 21 + 22 + ⋅⋅⋅ +2n, a formula for summing a geometric series.
- Adhvayoga (अध्वयोग) (IAST:adhvayoga) (lit:Space measure): This problem deals with determination of the amount of space needed to write down the entire list of the forms of a meter.
Apart from select circles of the academia, the western world, and even the majority of post-Macaulayian India have remained oblivious to the consummate achievements of the ancient Indian mathematicians. Their pioneering and seminal work, albeit somewhat lacking in modern rigour and formalism, exhibit a systematic crescent of complexity and progression of generality, in addition to pure, standalone artistic merit in their own right.
These advances appear as leaps owing to the sparseness of surviving evidence, however, precede the laggard and dry formulations of the West by millennia. While the West was taking its baby steps and slumbering in post-Roman intellectual stasis, India was making gargantuan strides, which would only be conveyed to the former during the Crusades, in a ruminated form.
The arbitrary and ill-informed speculations and conjecture of India’s Right-Wing outfits, outlets, and leaders have corrupted the already scant public recognition of these ancient traditions. Without a clue of the language, depth or insight of the discoveries, India’s Hindu-nationalist pseudo-scientific coterie has been gnawing, nibbling and chipping off the very foundations of these achievements – scepticism and inquiry. Intellectually orphaned, this foresaken ingenious tours-de-force have been reduced to the muse of select, super specialist journals and increasingly rarifying cliques of Indologists.
Neglected by the chuffed, complacent discrediting, and condescending West and disregarded just as much by the ignorant, culturally-amnesiac modern India, these forgotten virtuosos have become estranged in both their land and their discipline.
Written by Pitamber Kaushik & Girish Srinivasan – Pitamber Kaushik is a journalist, columnist, writer, and independent researcher, having authored research papers in Decision Theory, Minority Studies, and Political Science. Girish Srinivasan is a postgraduate research student at the Indian Institute of Technology Bombay.
Header Image – Bust of Hemachandra at Hemchandracharya North Gujarat University – Image Credit : Gazal world