Brahmagupta's Gift: Rules for Zero in 628 CE
The mathematician who gave zero its operational identity
Learn how Brahmagupta in his Brahmasphutasiddhanta defined rules for adding, subtracting, multiplying, and dividing with zero and with negative numbers, the first systematic treatment in history.
The Caravan Town and the Chapter
In 628 CE, in the caravan town of Bhillamāla in western Rajasthan, a thirty-year-old astronomer sat down to write a book on how to compute the heavens. The town was a Jain and Hindu learning centre on the trade route that linked the Indian Ocean ports to Central Asia. The book would run to twenty-four chapters and some twelve hundred verses of Sanskrit verse. In Chapter 18, almost as a technical aside, he did something no one had ever done before. He wrote the rules of arithmetic for zero and for negative numbers.

His name was Brahmagupta. The book was the Brāhmasphuṭasiddhānta, 'the correctly established doctrine of Brahma'. And the chapter, called Kuṭṭakādhyāya, is the oldest surviving text in the world in which zero appears not as a placeholder but as a full participant in arithmetic. Every spreadsheet, every calculator, every trading engine, and every programming language in the world today is running, beneath its surface, on the rules he fixed in that chapter.
The Man and the Observatory
Brahmagupta was born in 598 CE, probably in Bhillamāla itself. He eventually became head of the astronomical observatory at Ujjain, the same observatory where Āryabhaṭa's work had been studied a century earlier and where Bhāskara II would work five hundred years later. Ujjain was to Indian mathematical astronomy what Alexandria had been to Greek geometry, a single city where the tradition concentrated across generations.
Most of the Brāhmasphuṭasiddhānta is astronomy: planetary motion, eclipse prediction, calendar computation. But Brahmagupta understood that serious astronomy requires serious arithmetic, and in Chapters 12 and 18 he paused the celestial mechanics and wrote the arithmetic manual his astronomers would need. That manual is where zero got its rules.
What Brahmagupta Actually Did
Before 628 CE, Indian mathematicians had been using a symbol for zero as a placeholder for roughly three centuries. Archaeological evidence from the Bakhshali Manuscript and from inscriptions at temple sites shows dots and circles standing in for empty columns. But a placeholder is not a number. A placeholder tells you that a position is empty. It does not tell you what happens when you add the empty position to another number, or multiply two empty positions together. No civilization had ever answered those questions in writing.
Brahmagupta answered them. The opening verse of his arithmetic for zero is compressed almost to the point of opacity:
धनयोर्धनं ऋणयोरृणं धनर्णयोरन्तरं समैक्यं खम्। ऋणमैक्यं च धनमृणधनशून्ययोर्योगः शून्ययोः शून्यम्॥
dhanayor dhanaṃ ṛṇayor ṛṇaṃ dhanarṇayor antaraṃ samaikyaṃ kham
Positive plus positive is positive. Negative plus negative is negative. Positive plus negative is their difference. When the two are equal, the sum is zero. Zero plus a negative is that negative; zero plus a positive is that positive; zero plus zero is zero.
Brāhmasphuṭasiddhānta 18.30
In the next verse he wrote the rules for multiplication: positive times positive is positive; negative times negative is positive; positive times negative is negative; any quantity multiplied by zero is zero; zero times zero is zero. In 18.34 and 18.35 he extended the rules to division and to fractions involving zero. A non-zero number divided by zero, he called khaccheda, literally 'the quantity cut by the sky'.
Read those rules again slowly. They are what every child now learns in primary school. Before Brahmagupta, nobody on earth had ever written them down.
The Other Revolution: Negative Numbers
There is a second revolution folded into the same chapter, and it is almost as large as the first. Brahmagupta treats negative numbers as legitimate quantities with the same rights as positive numbers in arithmetic. He calls positives dhana, wealth, and negatives ṛṇa, debt. He does not hedge. He does not say, as every European mathematician up to the 17th century would say, that negative numbers are 'impossible' or 'absurd' or merely convenient fictions. He writes their rules straight down the page next to the rules for positive numbers, in the same voice, as if they were obviously the same sort of thing.
For Brahmagupta they were the same sort of thing because Indian commerce had been treating them as such for centuries. A merchant's ledger records credits and debts, and the debts are not fictional. They are real quantities that balance real transactions. Indian arithmetic grew up in the presence of this bookkeeping reality, and the mathematicians simply formalized it. Europe, by contrast, did not formally accept negative solutions to equations until the work of John Wallis and René Descartes in the 17th century, nearly a thousand years after the Brāhmasphuṭasiddhānta.
The One Error, and the Self-Correction
Brahmagupta's treatment had one flaw that matters. He declared that zero divided by zero equals zero. This is wrong. Zero divided by zero is indeterminate, not zero, and the distinction matters enormously once the system is used for serious calculation. Brahmagupta did not see the error, and none of his immediate successors fixed it.

The correction came in 1150 CE, more than five hundred years later, when Bhāskara II wrote the Līlāvatī and its companion Bījagaṇita. Bhāskara II introduced the concept of khahara, a quantity with zero as its divisor, and recognized that it behaved like an infinite magnitude that did not change when finite amounts were added or subtracted. He even reached for a theological metaphor. In this quantity, no alteration occurs though many are added or removed, just as there is no change in the infinite and unchanging Acyuta when worlds are absorbed or created during dissolution. A five-hundred-year-old mathematical error was corrected with an image drawn from cosmology. This is what the Indian tradition looked like when it worked at its best.
The Transmission
Within about a century of Brahmagupta's death, Arab scholars had the Brāhmasphuṭasiddhānta in Baghdad. It was translated into Arabic under the title Sindhind in the court of the Abbasid caliph al-Manṣūr around 773 CE. Al-Khwārizmī, working in Baghdad a few decades later, absorbed its arithmetic and its numerals and wrote the treatise whose Latinized author-name eventually became the word 'algorithm'. From Arabic, the rules crossed into medieval Latin Europe through translations in Toledo in the 12th century. By the time Fibonacci published the Liber Abaci in 1202 CE, he was openly describing the new arithmetic as the modus Indorum, the method of the Indians.
Modern Echoes
In 1985 the Institute of Electrical and Electronics Engineers ratified the IEEE 754 floating-point standard, the rule every CPU on earth follows when handling decimals. It contains explicit grammar for signed zero, signed infinity, and indeterminate forms. Every line of that grammar is a Brahmaguptan move taken with a thousand years of refinement on top. When the European Space Agency lost the Ariane 5 rocket on its maiden flight in 1996, the cause was a single unhandled arithmetic edge case in flight software, the exact failure mode Brahmagupta avoided in 628 CE by writing a rule for every input. Tony Hoare's 1965 NULL, which he later called his 'billion-dollar mistake', is what happens when a programmer reaches for a Brahmaguptan symbol without Brahmagupta's care.
Back in Bhillamāla, Brahmagupta would have closed the chapter and moved on to the next problem in eclipse prediction. He had no idea his arithmetic for zero would still be running fourteen centuries later in machines he could not have imagined. The work is still running. The machine has forgotten whose it is.
Key figures
Brahmagupta
598 to 668 CE, Bhillamāla (Bhinmal, Rajasthan), later head of the Ujjain observatory
Pṛthūdakasvāmī
c. 830 to 890 CE, probably Kurukṣetra region
Bhāskara II
1114 to 1185 CE, Bijjada Bida (near modern Bijapur, Karnataka)
Case studies
Brahmagupta vs. Bhāskara II: The Five-Hundred-Year Correction
In 628 CE, Brahmagupta wrote the first systematic rules of arithmetic for zero. Almost all of his rules were correct and are still taught in every school in the world today. But one was wrong. In Brāhmasphuṭasiddhānta 18.34, he declared that zero divided by zero equals zero. This is not a minor technicality. Zero divided by zero is indeterminate, not zero, and the distinction matters enormously once the rules are used for serious computation. For five hundred years, Indian mathematicians inherited the error without correcting it. Then in 1150 CE, a mathematician named Bhāskara II, working at the same Ujjain observatory Brahmagupta had once led, wrote the Līlāvatī and introduced the concept of khahara, a quantity with zero as its divisor. Bhāskara II recognized that khahara was not zero but an infinite magnitude, unchanged when finite amounts were added or subtracted from it. He even reached for a theological simile to explain the behavior, comparing khahara to the infinite and unchanging Acyuta (Viṣṇu) during the dissolution and creation of worlds.
The Indian mathematical tradition did not treat its foundational texts as sacred in the sense of being beyond revision. Brahmagupta was honored, his terminology was preserved, his framework became the backbone of Indian arithmetic for centuries. And yet when a later mathematician saw that one rule did not hold up under careful reasoning, he corrected it openly and in verse, without ceremony. This is the ideal of yukti, reasoned argument, working as a standing permission to revise the past. Bhāskara II did not discard Brahmagupta. He completed him. The tradition moved forward by accumulation and correction, not by replacement.
The khahara concept became part of the standard Indian treatment of division by zero and was taught in Sanskrit mathematical manuscripts for the next seven hundred years. Modern mathematics eventually converged on a similar distinction between division by zero yielding infinity (as in limits and extended number systems) and division of zero by zero yielding an indeterminate form. The Indian tradition arrived at the core insight five hundred years before European mathematics, and it did so by self-correction from within.
A revolutionary text can still contain a mistake. Honor the revolution without freezing the mistake. The health of an intellectual tradition is measured by its willingness to correct its own foundational texts when reasoning demands it.
The gap between Brahmagupta's 0/0 error (628 CE) and Bhāskara II's khahara correction (1150 CE) is approximately 522 years. The European mathematical tradition would not reach the same clarity on division by zero until the 19th century work on limits and indeterminate forms.
Fibonacci's Acknowledgment: The Modus Indorum Reaches Europe in 1202 CE
In 1202 CE, a merchant's son from Pisa named Leonardo Fibonacci published a book called Liber Abaci, the Book of Calculation. He had grown up in Bugia (modern Béjaïa, Algeria), where his father managed a trading post, and he had learned arithmetic from Arab mathematicians who used a numeral system and a set of arithmetic rules unlike anything then in use in Christian Europe. In the preface of Liber Abaci, Fibonacci describes his wonder at the new system and names its origin explicitly. He calls it the modus Indorum, the method of the Indians. Every rule for arithmetic with zero and with negative numbers that his Arab teachers had learned came, at second or third hand, from the Brāhmasphuṭasiddhānta of Brahmagupta, written in 628 CE in a Rajasthani caravan town that Fibonacci had probably never heard of. The transmission path was clear: Brahmagupta's Sanskrit text was translated into Arabic in Baghdad around 773 CE under the title Sindhind, al-Khwārizmī absorbed its arithmetic in the 9th century, and the resulting Arabic treatises were translated into Latin in Toledo and other Spanish cities in the 12th century. Fibonacci read those translations and wrote the book that finally gave medieval Europe the numerals and the rules it had been lacking for a thousand years.
Fibonacci's acknowledgment is unusual for its honesty. Many transmissions of ancient Indian science into Europe lost the attribution along the way. Numerical notation and arithmetic in particular became known as Arabic numerals, even though the Arab scholars who carried them had consistently named their Indian source. The arithmetic rules for dhana, ṛṇa, and kha that Fibonacci taught his European readers were Brahmagupta's rules, translated across language, script, and culture, and arriving in Pisa almost six hundred years after they were written in Sanskrit. The fact that a merchant's son had to travel to North Africa to find them tells you how completely the pre-Brahmagupta European arithmetic had failed.
Liber Abaci triggered the gradual replacement of Roman numerals with the Hindu-Arabic decimal system in European commerce and mathematics. The process took about three centuries to complete. By the 16th century, the system was universal in European banking, and by the 17th century, negative numbers had finally been accepted as legitimate answers to equations. European mathematics had, at long last, caught up to what Brahmagupta had written in 628 CE.
Ideas travel much more slowly than people assume, and they often travel under false names. When an idea finally arrives where it is needed, the receiving culture usually credits the middlemen, not the originators. A useful habit when you inherit a tool is to trace it back to the very first person who wrote it down. That person is almost never the one the tool is named after.
The Brāhmasphuṭasiddhānta was written in 628 CE. Liber Abaci was published in 1202 CE. The lag between Brahmagupta writing the rules of zero and Europe reading them in a translated form is 574 years.
Ariane 5 and the Cost of Unhandled Arithmetic
On 4 June 1996, the European Space Agency launched the first Ariane 5 rocket from Kourou, French Guiana. Thirty-seven seconds into flight, the rocket veered off course, began to break apart under aerodynamic stress, and was destroyed by the automatic range safety system. The payload, four scientific satellites worth approximately 370 million US dollars, was lost. The cause, identified by the inquiry board within weeks, was a single unhandled arithmetic operation. The inertial reference system had been inherited from the earlier Ariane 4 rocket without reanalysis. A 64-bit floating-point number representing horizontal velocity was being converted to a 16-bit signed integer. On Ariane 5, with its much higher acceleration, the velocity exceeded the range that a 16-bit signed integer could represent. The conversion overflowed. The software raised an exception it did not know how to handle, dumped diagnostic data to the guidance computer which interpreted the dump as flight data, and the rocket responded by swerving. Thirty-seven seconds, one unhandled edge case in arithmetic, and a decade of work was gone.
Brahmagupta's gift to arithmetic was not just that he wrote the rules for zero. It was that he wrote the rules for every edge case he could think of, including the ones he did not fully understand, such as division by zero. His instinct was to name the edge case and give it a rule, even an imperfect one, rather than leave the arithmetic silently incomplete. The Ariane 5 failure is a mirror image of this instinct. A team of excellent engineers left an arithmetic edge case unhandled, the system met it in flight, and the edge case destroyed the system. The lesson Brahmagupta codified in 628 CE, that every operation needs a rule for every input, had to be relearned at a cost of 370 million dollars.
The Ariane 5 inquiry board's report became a canonical case study in software engineering curricula. The fix was simple once identified: add range checks on the conversion, or use a wider integer, or handle the exception instead of propagating it. The deeper fix was cultural. Modern safety-critical software development now treats unhandled arithmetic edge cases as hard defects, not warnings.
An operation that works for the common case but silently breaks at an edge case is not a complete operation. Brahmagupta's habit of writing a rule for every input, including the hard ones, is the oldest working model of defensive programming in the history of arithmetic. When you define a function, define it on its entire domain. Nothing you ship should have an input it does not know how to answer.
The Ariane 5 loss in 1996 is estimated at 370 million US dollars for the rocket and payload, and roughly 7 billion US dollars over a decade of development. The unhandled conversion that caused it was a single line of Ada code. The arithmetic distinction Brahmagupta named khaccheda in 628 CE is a lineal ancestor of the edge-case discipline that modern software engineering spent the 1990s learning at public expense.
Historical context
Early Post-Gupta Period, Classical Indian Mathematics (c. 628 CE)
The Gupta empire had collapsed in the mid-6th century, and north India in 628 CE was a patchwork of regional powers. Harṣavardhana of Kannauj (reigning 606 to 647 CE) held loose paramountcy over much of the north. Brahmagupta's home town, Bhillamāla in western Rajasthan, lay on the trade routes linking the western Indian Ocean ports to the Gangetic heartland and to Central Asia, and it had become a significant Jain and Hindu learning center. Ujjain, where Brahmagupta would later lead the astronomical observatory, remained the traditional prime meridian of Indian astronomy and the continuing home of the mathematical tradition Āryabhaṭa had revived in 499 CE.
The Brāhmasphuṭasiddhānta was written at the precise moment that Arab scholarship was about to begin absorbing Indian science. Within roughly 150 years of Brahmagupta's death, his text had been translated into Arabic in Baghdad and was feeding the arithmetic of al-Khwārizmī, whose name would give the world the word 'algorithm'. The rules for zero and for negative numbers travel from Bhillamāla to Baghdad to Toledo to Pisa, and the chain of transmission is unbroken. This chapter of this book is the document from which the modern global arithmetic descends.
Living traditions
Every time a calculator, spreadsheet, or programming language adds a positive to a negative, multiplies two negatives into a positive, or returns an error for division by zero, it is executing rules that were first written down in 628 CE in Brāhmasphuṭasiddhānta 18.30 to 18.35. The IEEE 754 floating-point standard, which governs how essentially every computer on earth handles arithmetic, includes explicit rules for signed zero, signed infinity, and indeterminate forms. Those rules are the direct operational descendants of Brahmagupta's dhana, ṛṇa, kham, and khaccheda. The Indian Mathematical Society and NCERT school curricula continue to cite Brahmagupta by name in class 6 and class 7 arithmetic textbooks, making him one of the few ancient scientists whose actual operational rules, not just his legend, are transmitted to every Indian schoolchild.
- Bhinmal (ancient Bhillamāla): The town where Brahmagupta is believed to have been born and where he wrote the Brāhmasphuṭasiddhānta in 628 CE. Bhinmal was a thriving capital of the Gurjara kingdom and a Jain and Hindu learning center on the western Indian trade routes. Today it is a quiet town with several medieval Jain and Hindu temples and an archaeological presence testifying to its ancient importance. The Varāha Shyama temple and the Kshemankari Mata temple preserve stone work from the period. A modest statue of Brahmagupta now marks the town's claim to be the birthplace of the mathematician who gave the world zero.
- Vedh Shala (Jantar Mantar Observatory), Ujjain: Brahmagupta became head of the astronomical observatory at Ujjain later in his career. The Ujjain observatory was the continuing home of Indian mathematical astronomy from before Āryabhaṭa until well past Bhāskara II. The current structure, known as Vedh Shala or Jantar Mantar, is the 18th century observatory built by Maharaja Jai Singh II, but it stands on the site of the continuous astronomical tradition that Brahmagupta served and extended. Ujjain was historically treated as the prime meridian of Indian astronomy, the zero line of longitude for Indian celestial calculation.
Reflection
- In a system you work with or a habit you follow, what is one edge case you have never written a rule for, where you currently just hope the case will not come up?
- Why do you think Brahmagupta was comfortable treating debt (ṛṇa) as a full mathematical equal of wealth (dhana), when European mathematicians resisted negative numbers for another thousand years?
- Bhāskara II corrected Brahmagupta's error about zero divided by zero five hundred years after Brahmagupta wrote it. What does this say about the relationship between reverence for a foundational text and the obligation to correct it?