Math, Rhythmic patterns & A Card Trick

Another Wednesday, another session of Manjul Bhargava’s entertaining and instructive class at the National Museum of Mathematics, in New York City.

This time, the topic was that of rhythmic combinations and their connection to mathematics. As the sentence itself suggests, combinations of rhythms lead to combinatorial arithmetic – the notions of Fibonacci numbers and Pascal’s triangle immediately suggest themselves. What follows is a précis of his class, with some additions of my own concerning patterns in South Indian classical music (also known as CarnAtic music). In this paragraph, as well as all that follows, I will be using capitalized vowels to indicate a stretched vowel sound. So “All” rather than “all” vowels aren’t equivalent! Additionally, all the material in this talk is well-known to scholars of Sanskrit. One example of a study that describes this is an article from 1985 by Paramanand Singh.

Acharya VIrahankA, a poet and mathematician, considered the number of ways to form an N-syllable line of poetry from a combination of 1- and 2-syllable words. While this is a run of the mill question for all poets, it is also of importance in the improvisational aspect of Indian classical music. In Indian music, the music follows a pattern of beats called a “tAlam”. There is the simple 8-beat “Adi” tAlam, which repeats after 8 beats. There is the 3-beat “rUpakam” tAlam, which repeats after 3. There are more complex tAlams, with more beats. In order to figure out where you are in the tAlam, performers use a combination of slaps of the palm, finger counting as well as waves of the hand to count the number of beats of the tAlam. TAlams are classified with the concept of jAtI. So the simplest Adi tAlam, with 8 beats is actually called chatushra-jati-triputa tAlam, for it has one slap, three finger counts, then two slap-wave combinations. There is also a khanda-jAtI-triputa tAlam, which has one slap, four finger counts, then two slap-wave combinations. As you can see, this is a pretty organized system with practically infinite number of tAlams, though after the first few, one is basically showing off one’s muscle memory and coordination.A demonstration is here

As far as improvisation goes, you have to start at the first beat (in the middle of a poetry composition also set to the same rAgA) and end your improvisation at the last beat – of course, you could try variations where you interrupt the poem at the middle of the beat cycle and then end at the last beat of the cycle, many cycles later. Clearly,  you might improvise with notes of length 1-beat, or 2- or even \frac{1}{3} of a beat, since you can play or sing faster than the speed of the beats, so the idea of fitting notes of varying length into a cycle of beats is an ongoing challenge in improvisation. You have to keep aware of the rhythmic cycle while making the improvisatory notes sound, well, musical! More about this after the next section on the mathematical concepts here.

To put the problem that VIrahankA (and later HemachandrA) considered into a visually appealing format, the number of ways to arrange 1 and 2 length tiles to make a tile-chain of length N can be written down as follows.

Tile-chain of length 1   :  One (1) way. We write this as 1.

Tile-chain of length 2   :   Two(2) ways (One with two 1-length tiles, another one with a single 2-length tile), We write this as 11, 2.

Tile-chain of length 3   :   Three(3) ways (in our shorthand notation from above, this is 111, 12, 21).

Tile-chain of length 4.  :    Five (5) ways (in our shorthand notation this is 1111, 211, 121,112, 22).

In fact, if you have a Tile-chain of length N, and you asked for all the ways to form such tile-chains (call this quantity V_N), you would reason (as VIrahankA did) as follows. Such a tile-chain would be formed by forming, in all V_{N-1} ways, tile-chains of length N-1 and then append a 1-length tile PLUS by forming, in all V_{N-2} ways, a tile-chain of length N-2, then appending a 2-length tile. Ergo, V_{N} = V_{N-1}+V_{N-2}. This is exactly the constructive method to build a series of numbers 1,1,2,3,5,8,13,21,34…. – the VIrahankA numbers that you probably heard of under a different name.

Next, if you asked a different question, as PingalA did, you start with n syllables, k of length 1 and n-k of length 2, then you can construct lines of different lengths. There are {{n} \choose {k}} ways of organizing these, which is the binomial expansion coefficient. He then considered how to deduce the relationships between these different length poetic sentences and realized that they could be arranged in a triangular form that he (more likely, a commentator named HalAyudha) referred to as a MeruprastArA,


The reason for the organization is as follows – the top row (1) represents the number of ways to organize 0 1-length and 0 2-length syllables. That’s just 1 way of doing nothing. The number on the extreme right is just the sum of the elements in that row.

The second row represents the number of ways to organize 1 1-length or 1 2-length syllables. There is one way to do so with one 1-length syllable, as well as one way to do so with one 2-length syllable.  The sum of these is 2, which is on the extreme right.

The third row represents the number of ways to organize 2 1-length syllables, or 1 1-length and 1 2-length syllables, or 2 2-length syllables. The sum of the number of ways is on the extreme right. It is, again, a power of 2.

And so on.

The connection to the series of VIrahankA is easy to see. If you consider the ways to count the number of ways to construct syllables of length 1, 2, 3… from the above, they represent sums of certain terms in the MeruprastArA above. That is depicted below,


They are the sequences of different ways to organize 1- and 2- length syllables to yield syllable-chains of length 1, 2, 3…. The sums of the different number ways to do this is exactly VIrahankA’s numbers, as you can see above along the lines.

One can repeat this exercise with 1-, 2-, 3- length syllables. As Manjul jokingly suggests, we get the “TriVIrahankA” numbers as well as Pingala’s 3-D MeruprastArA.

This pattern of mixing syllables in systematically developed in the style of music sung and practiced in South India, called Carnatic music. There are many kinds of  improvisation in this style, including one where solfa syllables are sung, and it sounds like scat singing. The organization is as follows. One first sets the speed of the basic beat – this speed is called “KAlam”. People choose what they consider their “slow” speed, this is called the 1st kAlam. There is a 2nd kAlam, which is double this speed, while 4 times this basic speed is called 3rd kAlam (this is a logarithmic scale). Each cycle of beats, which is called a tAlam, runs at the speed of the kAlam.

The next concept is that of “GatI” (Sanskrit for “speed”). This is the number of notes that fit into each beat. This is also called “Nadai” in the Tamil language. Hence in Tisra GatI, one would sing or play 3 notes per beat, in the 1st kAlam. However in 2nd kAlam, this would be 6 notes per beat and so on. One can vary the GatI in the basic speed of the beat, leading to rhythmic variations.

In addition, due to the influence of percussion performers, with their interest in pure rhythm, some non-standard gatIs have become popular – these are, for instance, chatushra-tisra GatI, which is a \frac{4}{3} speed – the notes are held for longer time, so in 3rd kAlam, where one sings 4 notes per beat, one only sings 1 note per \frac{3}{4} beat.

It is almost magical to hear the results of improvisation with all the myriad ways to intersperse notes into beats, as in the following example  and here by some performers.

Continuing from this digression, the next item Manjul discussed were some methods to communicate the meter of a poem to a reader, in a manner that is incorruptible by the ravages of translators, copiers or other recording devices. These concepts are similar to error-detection methods used in modern-day coding.

While the method he discusses (which I will detail shortly) is interesting for short phrases and poems, there is an elephant in the room for this one. One of the largest texts in the world is the Vedas, which were composed before 1500 B.C. They were transmitted orally and of course one has the problem of how to make sure that there isn’t a Chinese whispers problem. The method is meticulous and involved, involves singing the poetry literally backwards and forwards in such a rigid manner that multiple syllable errors can be caught – however the result is still not full of nonsense words, but is also meaningful. There are many discussions of the technique used and I would be foolish to repeat it, look here. Similar techniques were also used by Buddhist and Jain scholars to transmit their texts, though less often.

The poetic technique Manjul discussed is one of those used for shorter poems. It is based on the length of the syllables in the nonsense word “ya mA tA rA ja bhA ga sa la gA”. If you count the length of each syllable in this word, use 0 to represent 1-length syllables (small “a”) and 1 to represent 2-length syllables (capital “A”), it is 0111010001. If you look at all three digit combinations, they are, in sequence,

011  which is decimal number 3

111 which is decimal number 7

110 which is decimal number 6

101 which is decimal number 5

010 which is decimal number 2

100 which is decimal number 4

000 which is decimal number 0

001 which is decimal number 1

Notice that all the decimal numbers from 0-7 make an appearance. This nonsense word originates from PingalA (of MeruprastArA fame!) and is a way to communicate the precise pronunciation of the words in a simple code, which would be shorter than the phrase you were trying to exactly represent.

As it turns out there are two ways to construct a nonsense phrase with all the numbers 0-7 represented just once, they can be computed based on the exhaustive tree search depicted below. They are 01253764, as well as 01376524. If the second one is cyclically permuted to 37652401, we get 0111010001, while the first one is 25376401, which codes to 0101110001. If the second one can be written as {\bf ya mA tA rA ja bhA ga sa la gA}, the first one is {\bf ya mA ta rA jA bhA ga sa la ga}. The neat reason why someone would pick the second variant is that the last two syllables of the word are la and gA, which are also the starting syllables of the Sanskrit words laghu (for “short”) and guru (for “long”). The syllables are self-referential in this respect in the word.

Now, the Sanskrit poets used this technique to make sure future generations would never forget the meter and how to shorten or lengthen syllables properly. Suppose they wanted to coommunicate that the cadence was 001 001 1010 000  – to be really clear. listen to the audio clip

you could break it up into threes, then code it gA \: gA \:  rA \: la \: la, where the syllables represent three-digit binary numbers, while the last “la” is a single bit 0. Then you would include the nonsense phrase gAgArAlala in your poem (as a labelled cadence phrase) and be secure that you have communicated the cadence to your reader.

This is the basis of a card trick, which he demonstrated with five cards (a five bit version of the above code), but since he also asked that we don’t publish that version of the code, I will show the three-bit version, with only 10 cards.

Audio courtesy Rajeswari Satish.

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s