Pingala (Devanagari: पिङ्गल) is the author of Chandaḥśāstra (Chandaḥsūtra), the earliest known Sanskrit treatise on prosody.
Very less historical knowledge is available about Pingala, though his works are retained till date. He is identified either as the younger brother of Pāṇini (4th century BCE), or of Patañjali, the author of the Mahabhashya (2nd century BCE).
His work, Chandaḥśāstra means science of meters, is a treatise on music and can be dated back to 2nd century BCE. Main commentaries on ‘Chandaḥśāstra‘ are ‘Vrittaratnakara‘ by Kedara in 8th century AD, ‘Tatparyatika‘ by Trivikrama in 12th century AD and ‘Mritasanjivani‘ by Halayudha in 13th century AD. The complete significance of Pingala’s work can be understood by the explanations found in these three commentaries.
Pingala (in Chandaḥśāstra 8.23) has assigned the following combinations of zero and one to represent various numbers, much in the same way as the present day computer programming procedures.
0 0 0 0 numerical value = 1
1 0 0 0 numerical value = 2
0 1 0 0 numerical value = 3
1 1 0 0 numerical value = 4
0 0 1 0 numerical value = 5
1 0 1 0 numerical value = 6
0 1 1 0 numerical value = 7
1 1 1 0 numerical value = 8
0 0 0 1 numerical value = 9
1 0 0 1 numerical value = 10
0 1 0 1 numerical value = 11
1 1 0 1 numerical value = 12
0 0 1 1 numerical value = 13
1 0 1 1 numerical value = 14
0 1 1 1 numerical value = 15
1 1 1 1 numerical value = 16
Other numbers have also been assigned zero and one combinations likewise.
Pingala’s system of binary numbers starts with number one (and not zero). The numerical value is obtained by adding one to the sum of place values. In this system, the place value increases to the right, as against the modern notation in which it increases towards the left.
The procedure of Pingala system is as follows:
- Divide the number by 2. If divisible write 1, otherwise write 0.
- If first division yields 1 as remainder, add 1 and divide again by 2. If fully divisible, write 1, otherwise write 0 to the right of first 1.
- If first division yields 0 as remainder that is, it is fully divisible, add 1 to the remaining number and divide by 2. If divisible, write 1, otherwise write 0 to the right of first 0.
- This procedure is continued until 0 as final remainder is obtained.
Example to understand Pingala System of Binary Numbers :
Find Binary equivalent of 122 in Pingala System :
Divide 122 by 2. Divisible, so write 1 and remainder is 61. 1
Divide 61 by 2. Not Divisible and remainder is 30. So write 0 right to 1. 10
Add 1 to 61 and divide by 2 = 31.
Divide 31 by 2. Not Divisible and remainder is 16. So write 0 to the right. 100
Divide 16 by 2. Divisible and remainder is 8. So write 1 to right. 1001
Divide 8 by 2. Divisible and remainder is 4. So write 1 to right. 10011
Divide 4 by 2. Divisible and remainder is 2. So write 1 to right. 100111
Divide 2 by 2. Divisible. So place 1 to right. 1001111
Now we have 122 equivalent to 1001111.
Verify this by place value system : 1×1 + 0×2 + 0×4 + 1×8 + 1×16 + 1×32 + 1×64 = 64+32+16+8+1 = 121
By adding 1(which we added while dividing 61) to 121 = 122, which is our desired number.
In Pingala system, 122 can be written as 1001111.
Though this system is not exact equivalent of today’s binary system used, it is very much similar with its place value system having 20, 20, 21, 22, 22, 23, 24, 25, 26 etc used to multiple binary numbers sequence and obtain equivalent decimal number.
Reference : Chandaḥśāstra (8.24-25) describes above method of obtaining binary equivalent of any decimal number in detail.
These were used 1600 years before westeners invented binary system.
We now use zero and one (0 and 1) in representing binary numbers, but it is not known if the concept of zero was known to Pingala— as a number without value and as a positional location.
Pingala’s work also contains the Fibonacci number, called mātrāmeru, and now known as the Gopala–Hemachandra number. Pingala also knew the special case of the binomial theorem for the index 2, i.e. for (a + b) 2, as did his Greek contemporary Euclid.
Halayudha (10th century AD) who wrote a commentary on Pingala’s work understood and used zero in the modern sense but by then it was commonplace in India and had also begun to make its way to West Asia as well to countries like Indonesia, Cambodia and others in East and Southeast Asia. It took several centuries more before being accepted in Europe. It was Leonardo of Pisa, better known as Fibonacci who seems to have introduced it in Europe in the 13th century. (He learnt it from the Arabs but noted that it came from India. His successors were not so careful, and for centuries they were known as Arabic numerals.)
Halayudha was himself a mathematician no mean order. His discussion of combinatorics of poetic meters led him to a general version of the binomial theorem centuries before Newton. (This was the integer version only and not the full general version with arbitrary index given by Newton.) This too traveled east and west with the Persian mathematician and poet using the results in the 13th century.
Halāyudha’s commentary includes a presentation of the Pascal’s triangle for binomial coefficients (called meruprastāra).
Chandaḥśāstra presents the first known description of a binary numeral system in connection with the systematic enumeration of meters with fixed patterns of short and long syllables (Short = 0, Long = 1).
Use of zero is sometimes mistakenly ascribed to Pingala due to his discussion of binary numbers, usually represented using 0 and 1 in modern discussion, while Pingala used short and long syllables.
As Pingala’s system ranks binary patterns starting at one (four short syllables—binary “0000″—is the first pattern), the nth pattern corresponds to the binary representation of n-1, written backwards. Positional use of zero dates from later centuries and would have been known to Halāyudha but not to Pingala.