On this page
Every JEE aspirant learns that nCr = n! / (r!(n - r)!). Fewer know that a Jain mathematician in Karnataka wrote down a working rule for the same count more than a thousand years ago, and set it as a puzzle about flavours. This post covers who Mahavira was, translates his rule into modern notation, works his examples, and points out the counting mistakes it can help you avoid.
Who was Mahavira?
The MacTutor biography of Mahavira says he lived from about 800 to about 870, worked in Mysore in southern India, belonged to the Jaina tradition and was familiar with Jaina mathematics. Almost nothing else is known about his life.
His only known book is the Ganita Sara Sangraha, dated to 850 CE, written as an update of Brahmagupta's work. MacTutor notes it is the earliest Indian text we have that is devoted entirely to mathematics; earlier Indian mathematics appears inside books on astronomy. It has nine chapters, covering fractions, squares, cube roots, indeterminate equations, geometry and more. MacTutor adds that permutations and combinations were a topic of special interest in Jaina mathematics, and that Mahavira gave special rules for them.
What does his rule for combinations say?
The 1912 English translation by M. Rangacarya is on the Internet Archive. In Chapter VI, Mixed Problems, verse 218 reads, in that translation:
"Beginning with one and increasing by one, let the numbers going up to the given number of things be written down in regular order and in the inverse order (respectively) in an upper and a lower (horizontal) row. (If) the product (of one, two, three, or more of the numbers in the upper row) taken from right to left (be) divided by the (corresponding) product (of one, two, three, or more of the numbers in the lower row) also taken from right to left, (the quantity required in each such case of combination) is (obtained as) the result."
Here is what that means for n things:
Upper row: 1, 2, 3, ..., n.
Lower row: n, ..., 3, 2, 1.
Reading both from the right, the upper row gives n, n - 1, n - 2, ... and the lower row gives 1, 2, 3, ...
To choose r things, multiply the first r upper numbers and divide by the first r lower numbers.
In modern notation, that is nCr = n(n - 1)...(n - r + 1) / (1 x 2 x ... x r), exactly the form in the NCERT Class 11 chapter Permutations and Combinations.
Worked example: Mahavira's six tastes
Verse 219 asks for the number of combinations of six tastes: astringent, bitter, sour, pungent, saline and sweet.
Write 1 2 3 4 5 6 on top and 6 5 4 3 2 1 below. Read from the right.
One taste. 6 / 1 = 6.
Two tastes. (6 x 5) / (1 x 2) = 30 / 2 = 15.
Three tastes. (6 x 5 x 4) / (1 x 2 x 3) = 120 / 6 = 20.
Four tastes. (6 x 5 x 4 x 3) / (1 x 2 x 3 x 4) = 360 / 24 = 15.
Five tastes. 720 / 120 = 6.
All six. 720 / 720 = 1.
Total: 6 + 15 + 20 + 15 + 6 + 1 = 63 mixtures.
Check another way. Each taste is either in or out of a mixture, giving 2⁶ = 64 choices. Remove the empty choice and you get 63. The two methods agree, and the identity behind it, nC1 + nC2 + ... + nCn = 2ⁿ - 1, comes from the binomial theorem.
His other two puzzles
Verses 220 and 221 ask the same question for a necklace made of five kinds of gem (diamonds, sapphires, emeralds, corals and pearls) and a garland of four kinds of flower, including ketaki, asoka and campaka.
Five gems. 5 + 10 + 10 + 5 + 1 = 31, which is 2⁵ - 1.
Four flowers. 4 + 6 + 4 + 1 = 15, which is 2⁴ - 1.
Which mistakes does this help you avoid?
Using permutations when order does not matter. A mixture of sweet and sour is the same as sour and sweet. That is a combination. If order mattered, two tastes would give 6 x 5 = 30, not 15.
Computing huge factorials. Mahavira's rule cancels as it goes: for 10C3, use (10 x 9 x 8)/(1 x 2 x 3) = 120, not 10!/(3! 7!).
Forgetting "at least one". "How many mixtures" usually excludes the empty set. Read whether the question counts it.
Missing the symmetry. nCr = nC(n - r). If r is more than half of n, switch to the smaller number.
The JEE (Main) 2026 syllabus lists the fundamental principle of counting and the meaning of P(n, r) and C(n, r). For more practice, see our guide to permutations and combinations and to the binomial theorem.
What can a student take from Mahavira's way of working?
State the rule, then test it on examples. He followed verse 218 straight away with three puzzles.
Make it concrete. Tastes, gems and flowers turn an abstract count into something you can picture and check by hand.
Write for learners. In his introduction, as MacTutor quotes, he calls his book "a small work on arithmetic, which is however not small in importance."
Indian work on counting and arrangements continued for centuries; our post on Narayana Pandita and magic squares picks up the story in 1356. When a counting problem stalls because you are not sure whether order matters, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.
Try it now: use Mahavira's two-row method to find how many committees of 3 can be chosen from 8 students, then check it with nCr = n!/(r!(n - r)!).



