Mathematics
Mahāvīra writes down nCr — 800 years before Pascal's Triangle
Published May 25, 2026
# Mahāvīra writes down nCr — 800 years before Pascal's Triangle
In 850 CE, in chapter VI verse 218 of the *Ganita-sara-sangraha* ("Compendium on the Essence of Mathematics"), the Karnatakan Jain mathematician Mahāvīra wrote down a procedure for computing the number of combinations of *n* things taken *r* at a time:
> 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 the numbers in the upper row > taken from right to left be divided by the corresponding product > 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. > > — *Ganita-sara-sangraha* VI.218, trans. M. Rangacarya (1912)
That is the binomial coefficient $\binom{n}{r}$, which modern algebra writes as $n! / (r! (n-r)!)$. Mahāvīra writes it as a *procedure*:
1. **Top row:** $1, 2, 3, \ldots, n$ — the integers up to $n$ in ascending order. 2. **Bottom row:** $n, n-1, n-2, \ldots, 1$ — the same integers in descending order. 3. **Take the rightmost $r$ entries** of each row. 4. **Multiply within each row.** 5. **Divide the top product by the bottom product.** The result is $\binom{n}{r}$.
A worked example
Compute $\binom{5}{3}$ — combinations of 5 things taken 3 at a time (say, choosing 3 musicians from 5 to form a trio).
| Step | Top row | Bottom row | |------|---------|------------| | Full row | 1, 2, 3, 4, 5 | 5, 4, 3, 2, 1 | | Rightmost 3 | 3, 4, 5 | 1, 2, 3 | | Product | 60 | 6 |
$60 / 6 = 10$. Correct — there are 10 ways to choose 3 from 5.
The next two verses (VI.219 and VI.220) give example problems posed to the reader in the same poetic-instruction style Bhāskara II would later perfect in the *Lilavati*:
> Tell me now, O mathematician, the combination varieties as also > the combination quantities of the tastes, viz., the astringent, > the bitter, the sour, the pungent, and the saline, together with > the sweet taste as the sixth. > > — *Ganita-sara-sangraha* VI.219
The answer (binomial-by-binomial from $\binom{6}{1}$ to $\binom{6}{6}$ and their sum) is 63 distinct non-empty combinations of tastes — which a working medieval Indian cook would have used to think about seasoning combinations.
What was already known: the meru-prastara
A footnote that matters: Mahāvīra was not the first Indian mathematician to think about binomial coefficients.
**Pingala's *Chandahsastra*** (~200 BCE) — the foundational text on Sanskrit prosodic meter — defines the *meru-prastara* ("mountain-arrangement"), a triangular table showing how many ways $r$ long syllables can be placed in an $n$-syllable verse. The table:
``` 1 ← row 0 (1 way for n=0) 1 1 ← row 1 (binomials for n=1) 1 2 1 ← row 2 1 3 3 1 ← row 3 1 4 6 4 1 ← row 4 1 5 10 10 5 1 ← row 5 ```
That's **Pascal's triangle, 1,800 years before Pascal**. Pingala's treatment is special-case — binary long/short syllables in poetic meter — and the meru-prastara is presented as a *table* of values, not an *algorithm* for computing arbitrary entries.
**Halayudha's 10th-c. commentary** on Pingala makes the recursive construction of the meru-prastara explicit ($\binom{n}{r} = \binom{n-1}{r-1} + \binom{n-1}{r}$ — the Pascal-recursion).
**Mahāvīra's contribution** is the *closed-form general algorithm* for any $n$ and $r$, generalised beyond prosody to arbitrary combinatorial counting. He applies it in the *Ganita-sara-sangraha* to combinations of tastes, combinations of flowers in garlands, combinations of gems in necklaces — the everyday-mensuration problems an 8th-9th c. Indian merchant or gardener might pose.
The Sanskrit-mathematical tradition treats the Pingala → Halayudha → Mahāvīra chain as a single developing combinatorial tradition. Each contribution is real and distinct.
What Europe did
The European tradition arrived at the same machinery independently and much later.
- **Levi ben Gershon** (1321, *Maaseh Hoshev*) gives an explicit permutation-and-combination treatment in medieval Hebrew. Some scholars argue indirect Indian-via-Arabic transmission; the consensus reading is independent. - **Niccolò Tartaglia** (1556) gives a binomial-coefficient table for small $n$ in his *General Trattato*. - **Blaise Pascal** (1654, written; 1665, posthumous publication) publishes the *Traité du triangle arithmétique*, giving the full Pascal-triangle treatment plus the closed-form formula $\binom{n}{r} = n! / (r!(n-r)!)$. - **Isaac Newton** (1665) generalises to non-integer $r$ in the binomial series, opening the way to calculus.
Pascal's 1654 treatment is what gets named in Western mathematics. Mahāvīra's 850 CE treatment predates it by 804 years. There is no evidence of transmission either way; the two appear to be independent rediscoveries.
Why this matters
Combinatorics is the foundational subfield of discrete mathematics. Modern computer science depends on it everywhere — every algorithm-complexity analysis ("how many ways can N items be ordered, selected, partitioned"), every cryptographic key-strength estimate, every machine-learning sample-count derivation reduces to $\binom{n}{r}$ or its close relatives.
The general formula has been written down independently in at least five mathematical traditions across the past 2,500 years (Pingala, Mahāvīra, Levi ben Gershon, Pascal, the Chinese tradition through Yang Hui's triangle ~1303 CE). Each tradition arrived at it because the underlying combinatorial structure is unavoidable once you start asking systematic counting questions.
Mahāvīra's 850 CE statement is one of the earliest **algorithmic** treatments — not a table of values, but a procedure that produces any $\binom{n}{r}$ on demand. That procedural framing is what makes it the immediate ancestor of modern combinatorial algorithm design.
What this leaves us with
A 9th-century Sanskrit verse, applied to a problem about combinations of cooking-spice tastes, contains the algorithmic structure that modern computer science still uses to count things. The formula $\binom{n}{r} = n!/(r!(n-r)!)$ — written today as one line of mathematical notation — appears in Mahāvīra's *Ganita-sara-sangraha* as a five-step procedure spelled out in two prose sentences, with worked examples in the next two verses involving tastes, flowers, and gems.
Mathematics with the same content, in a fundamentally different notational tradition, doing exactly what mathematics ever has to do — count.
---
Sources
- [The Ganita-sara-sangraha of Mahāvīrācārya, M. Rangacarya trans., 1912](https://archive.org/details/RangacaryaTheGanitaSaraSangrahaOfMahavira1912) — verse VI.218 cited above. - Plofker, K. (2009). *Mathematics in India*. Princeton University Press, ch. 6. — the Pingala-Halayudha-Mahāvīra combinatorial tradition. - Edwards, A. W. F. (2002). *Pascal's Arithmetical Triangle: The Story of a Mathematical Idea* (2nd ed.). Baltimore: Johns Hopkins University Press. — comparative survey of independent rediscoveries. - Pascal, B. (1665). *Traité du triangle arithmétique*. Paris: Guillaume Desprez. — the named European treatment.
Related claims
- [Aryabhata's kuttaka](/c/a0ac1d5a-b8a4-5228-bb4e-e69636d8d613) — another Sanskrit algorithmic statement that European mathematics later rediscovered under a different name. - [Brahmagupta's bhāvanā](/c/c88efa45-7959-596f-868e-8fae4e852700) — same 7th-9th c. Sanskrit-mathematical era; a different algebraic structure (number-theoretic composition).
References
- [1]Mahāvīra's Ganita-sara-sangraha VI.218 (850 CE) gives the general algorithmic statement of the nCr formula: write 1..n ascending and n..1 descending in two rows; the product of the top r entries divided by the product of the bottom r is nCr. Pingala (~200 BCE) had the binomial-prosody special case; Pascal's Traité (1654 CE) gives the European systematic form. Mahāvīra's algorithm is the general procedural statement, 800 years before Pascal. Source: The Ganita-sara-sangraha of Mahaviracarya (T1)