Probability Theory, Gambling and the Mahabharata

I was recently listening to lectures from a Yale course on financial markets. I was pleasantly surprised to find the instructor mentioning (Lecture 2, first 10 minutes) the occurrence of concepts from probability theory in Mahabharata, specifically in the story of Nala and Damayanti (nalopAkhyAna). The instructor only makes a passing reference to the story. In this blog post, I will elaborate and make explicit the connections between probability theory and gambling as understood by ancient Indians, a couple of thousands of years before the European Age of Enlightenment.

The specific instance he referred to was where Nala, incognito in the service of King RituparNa, trades his skill as a charioteer for instruction in the art of gambling from Rituparna. Earlier in the story, Nala- a righteous king with a serious weakness for gambling, gambled away to his brother, everything he had, resulting in his present predicament.  At a crucial point in the story, King Rituparna needs to ride fast on his chariot to get to Damayanti’s swayamvara in the capital city of the Vidarbha kingdom within a day. His servant Nala, disguised as VAhuka in his agnAtavAsa , has his own motive behind going with Rituparna, as he wishes to be reunited with Damayanti who was his wife before becoming separated during the exile. King Rituparna was apparently highly skilled in gambling. When Rituparna thus sought Nala’s favor, Nala saw in it an opportunity to learn about gambling from the king. A literal reading of nalopAkhyAna tells us that what Nala sought and what Rituparna offered was skill in numbers/estimation (sankhyAna). However, consider the context- after they reached Vidarbha, etc., Nala sought a rematch with his brother and won back whatever he had lost, remarrying Damayanti ending the story with a ‘happily ever after.’ Heck, the entire context in which Nala’s story appears in Mahabharata is as a story narrated to Yudhishtira telling him that there is a precedent to his actions of gambling away one’s privileges. Thus we can conclude that the author intended a connection between sankhyAna and gambling. By extension, the people of ancient India may have understood the connections between sankhyAna, i.e., mathematics/probability theory/combinatorics, and gambling. Rituparna says to Nala at one point,

अक्ष- root word referring to dice, सङ्ख्याने – numbers

“Knowledge I possess of the game of dice, thus is my skill in numbers”

It is well known among historians that the relation between gambling, counting, and by implication probability [edit. typo] theory was not known until the 14th or 15th century (ref. ‘Drunkard’s Walk’ by Leonard Mlodinow).The eccentric polymath Gerolamo Cardano (who is also famous for his closed form solution to certain cubic polynomial equations, recall, for example 9th/10th standard Karnataka State syllabus 😉 ) was in all likelihood the first person to study gambling from a mathematical perspective in the 16th century.  His exposition on games of chance introduced the mathematical concept of probability. Subsequently, the other stalwarts of mathematics and science- Fermat, Pascal, and Huygens rediscovered (or reinvented, depending on how you view mathematics) the basics of probability theory.

Back to ancient India. Gambling plays an important role in our Puranic and historical stories. One of the significant events in Mahabharata is Yudhishtira getting fubar after agreeing to a game of dice against the Kauravas who have Shakuni on their side. Shakuni has a pair of dice made from his own father’s [edit.] bones, which are magical, or using more prosaic terminology- loaded. Gambling also plays a role in Puranic stories and subsequent Sanskrit literature.

Now back to nalopAkhyAna. Continuing where we left off, King Rituparna decides to teach the art (science) of gambling to Nala, aka VAhuka. Here’s where the most interesting part comes. Nala asks King Rituparna to teach him numerical skills. What is intriguing is the example chosen by Rituparna for imparting his skills. King Rituparna points to a Vibhitaka tree, and says that he is capable of estimating the number of leaves and fruits on the tree without actually counting them. This is where I hope the reader will join me on a leap of faith. This kind of sankhyAna was/is apparently a common skill among farmers who routinely estimate the number of crops, fruits, etc. However, what is curious is that this skill is imparted to Nala who was clearly seeking knowledge about how to gamble. This kind of estimation is clearly a problem in statistical estimation/statistical sampling, and has explicit connections with combinatorics and probability. I am not saying that ancient Indians knew everything about probability- just that they may have understood that combinatorics/probability could be used to study gambling systems. This way, they had used unsophisticated, rudimentary, combinatorics/probability/statistics in a way no one did till 17th-century-enlightenment-era-Europe.

According to nalopAkhyAna, King Rituparna estimated accurately, the number of leaves to be panchakoti, which can be translated as fifty million. The number of fruits were estimated to be 2095. The accuracy of these numbers is unimportant to the purpose of this blog post, for two reasons- 1) panchakoti may be a poetic exaggeration, (2) the poet/author may likely have not been skilled in numbers to provide reliable information about this. The ability to estimate large numbers from a few measurements is in a sense, equivalent to understanding the behavior of a gambling situation from experimental trials and probabilities. This equivalence is good to the extent of what can be inferred from nalopAkhyAna 🙂


Verses from nalopAkhyAna that talk about this episode

Above is a snippet of Sir Monier Monier-Williams’ version of nalopAkhyAna ‘Story of Nala’. It contains the relevant verses in Sanskrit and their English translations. Enjoy!


Below is an inadequate explanation of the leaf-counting episode, IMO this is quite sucky! It is by an Indic scholar from the 1900s.

Some Indic scholars understanding of the episode.


1. Leonard Mlodinow, Drunkard’s Walk: How Randomness Rules Our World, Pantheon, 2008.

2. Sir Monier Monier-Williams, Story of Nala, late 1800s/early 1900s.

3. George A. Grierson, Guessing the Number of VibhITaka SeedsThe Journal of The Royal Asiatic Society for 1904, pp. 355-356, 1904.

11 responses to “Probability Theory, Gambling and the Mahabharata

  1. Any idea on when these stories were written? Many of the stories in India mythology have been improved upon from Greek stories (look at links below). It will be interesting to see the evolution of statistics and probability in India, Middle East and Europe. What we do know is the amount of trade that happened among these places. I wonder how much knowledge was also shared in the process. Interesting post.

    (see the parallels in many stories. we may be seeing too much … but some of the parallels are too much to be ignored) :

    1. ;

    2. ;

    3. Achilles’ heel ( ) and Duryodhana’s Thigh ( , ) ;

    4. and ) )

    • It is for this exact reason that I did not mention the date. It is certainly in the BCE era. Refer to page xvii in [1]- Sir Monier Monier-Williams is reputed enough as an academic to take his word. It is most certainly not later than 16th century. That is an absurd proposition. Even if it were so, it is highly unlikely the obscure academic ideas of the European Enlightenment, more specifically the work of Pascal, Fermat, Huygens, Cardano, etc. actually reached the Indians.

      There are a lot of things common across mythologies, indeed. But this is not sufficient to say (unless obvious) whether one was ‘copied’ from the other. They could have common origins older than the respective civilizations. It could also be possible that they are based on traits/habits of humans that are universal. Why can’t you think of the reverse phenomenon- Indian ideas going to Greece? There’s as much hard evidence about the historiciity Achilles as there is about Arjuna. Gilgamesh of the Mesopotamian times is also similar to many other subsequent mythology. Even if you take Sankara’s story, one story reappears in *south* India (at least) 800 years after it first appeared in Greek lore. That claim of ‘copying’ would have at least been plausible if it happened in the Gandhara region where, long before the 9th century CE there was some heavy Greek influence. It stretches the argument thin to use one isolated story with a few common features to make a claim that this story was adapted from Greek lore.

    • A closely related copying-influencing problem is seen in linguistics. As we all know, Latin has “Mater” and “Pater”, Sanskrit has “maatr” and “pitr”. Similarly, pick any two Indian languages and you will find several commonalities. However, the correct explanation for this is that these languages had a common geographical origin. Same goes with the genetic (haplotype) similarities, after all most humans originated from a very few primordial Homo Sapiens. Thus did culture and language evolve and grow out of a few (but more numerous than primordial Homo Sapiens) linguistic/cultural societies. These linguistic/cultural societies existed more than 6000 years back, in an era which is irrelevant to all the geographical, religious, and cultural distinctions of today. So, saying that Indians learned/copied from/influenced by Greeks/Middle East or vice versa may not necessarily be correct. In any case, the direction of influence is even harder.

      • Yup, that’s true. I think that some of these stories have too much similarity for two people to thought of independently think it on their own. I am not saying one is inferior to the other. Both Greek and Indian mythology are pretty complex. Ideas would have come from more than a hundred people. These 4-5 stories are just a very small faction of total number of stories in the mythologies. But that does indicate that there was more than just trade between the two places.

        The number system that we use today developed in India, then went to middle east, and then to Europe. Europeans decided to call it Arabic number system. I am guessing something like that would have happened to knowledge of statistics and probability. Also, I heard a talk back in college about how Indians knew about Astronomy more than peers in Europe. They we all passed on as slokas from generation to generation.

        Without any proof, I cannot say what exactly happened. But looking at the timeline and trade and traffic patterns, one can make a guess.

      • Sanskrit and most European languages belong to the same Indo-European language family which explains the similarity in most Latin and Sanskrit words.

        Regarding numbers and probability, George Gamow has an interesting tale in his book “One Two Three… Infinity” about a temple in Varanasi which has 3 gold bars and 64 golden discs arranged on one of the three bars. The discs are such that the lowermost one is of largest diameter followed by a smaller one on top of it and so on till the smallest one on top. There is priest who sits there and continuously moves the discs around one at a time from one bar to another. The rules he follows are: 1> Move one disc at a time 2>A disc can be placed only on top of a larger disc, placing a larger one on top of a small one is not allowed. The goal of this activity is to transfer the stack of discs from one gold bar to another in it’s original state (largest disc at the bottom and so on). Gamow says this tower of discs is called the tower of Brahma and when the task ends, it will be the end of the world.

        If you count the number of moves required it is (2^64 -1). You can estimate how long would it take to complete this task. I have no idea if this story is true but, it is an interesting one anyway.

      • Thanks for the comment, Sameer. Indeed, I remember Brahma’s tower from Gamow’s book, which I had read long ago. Thanks a lot for recalling that story. I think I had also read the puzzle in an Mir publisher’s Soviet book (was it ‘Algebra can be fun?’ can’t remember) and as an exercise in Graham-Knuth-Patashnik’s book ‘Concrete Mathematics’.

        The pAnditya of ancient Indians in mathematics is incredible!

        Here’s another one… Roddam Narasimha, the famous Indian aerospace scientist writing about numbers in ‘terse verse’ , of how Aryabhatta encoded the sine table in a compressed nonsensical sounding words. Link:

        It’s behind a paywall, message me from here
        if you need a reprint. 🙂

        I hope to find several more examples, in addition to things I know- such as Sridhara’s solution to the quadratic equations, Shulva sutra’s ‘Boudhayana theorem’ which is a formulation of Pythagoras’ theorem, etc.

  2. Interesting post. But how Shakuni got his dice itself is a very interesting story I think its not from Dadhichi’s bones but rather from his father’s thigh bone. Dadichi’s bones were used to get Vajraayudha during the episode of Indra killing Vritra. Sorry for nitpicking 😛

  3. this is a good read about mathematics in india if you haven’t read it yet

  4. Good write up – currently reading through the comments, etc. And thank you for sending me that link to Yale lecture [and of course, this one too]


  5. Great post- the Anglo-Indian author you quote was unknown to me.
    My feeling is that there was a folk discrete maths tradition based on heuristics quite independent of the astrological or achitectural sort. This discrete maths tradition would estimate things like
    how many fruit have fallen from these trees
    by using cognitively simple counting rules into which ‘experimental’ (heuristic) formulae were plugged in. To double check results simple modulo arithmetic techniques would be used.
    Of course, some autistic savants with superior hard-wired number recognition could also be used to generate more such heuristic formulae and to account for other variables- e.g. weather conditions and so on.
    Thus, you have a bunch of simple rules and a lot of ‘expert cognition’ generating a viable profession for a sub-caste.
    Still, the question remains, how does Yuddhishtra or Nala benefit by learning this skill? Yuddhishtra knows in advance that Sakuni’s dice are loaded- he doesn’t need to do a statistical analysis. Still, no doubt, probablistic game theory would be useful on the battlefield.My impression is that the Pandavas were slightly more adventurous than the Kauravas despite having a numerical disadvantage so perhaps they prevailed because of a superior tactical trade off between kill-rates.
    The Indian hypertrophy of Combinatorics might have a further explanation viz. for voting rules and mechanism design and, it may be, that their vital importance in determining how land was redistributed, inheritances divided up, etc- meant that Iron Age Indians could rise above naive induction to an understanding of randomness- itself a liberating insight.

Leave a Reply

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

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s