There’s a famous story that the German mathematician Carl Friedrich Gauss published a method for solving systems of linear equations in 1809, and the technique that now bears his name — Gaussian elimination — became one of the foundational algorithms of modern science. What most textbooks leave out is that this same algorithm appears, fully formed, in a Chinese mathematical text compiled during the Han Dynasty, around the year 179 CE. That text is called 九章算术, the Nine Chapters on the Mathematical Art, and it has been quietly waiting in the bamboo-slip archives for almost two thousand years while the Western world slowly caught up.
The Nine Chapters is not a marginal curiosity. It contains 246 worked problems across nine chapters, organized around the practical mathematics of imperial administration: surveying land, exchanging grain, distributing labor, calculating taxes, transporting goods equitably, and measuring construction. It is also the first known text to lay out matrix-style linear systems (the fangcheng 方程 method), the first to publish a rigorous proof of what we call the Pythagorean theorem (the gougu 勾股 theorem), and the foundation that later mathematicians like Zu Chongzhi used to push pi to 355/113 — a value so accurate that no one in Europe would match it for more than a thousand years. To read the Nine Chapters is to realize that the history of mathematics has been told for centuries as if it happened only along the Mediterranean. It didn’t.
What the Nine Chapters Actually Is
The full title of the text — 九章算术, Jiǔzhāng Suànshù, “Nine Chapters on the Mathematical Art” — tells you its shape but not its ambitions. The book is a collection of 246 problems arranged in nine thematic chapters, each chapter organized around a different kind of practical calculation. The chapter on land surveying (方田 fāng tián) teaches area formulas for rectangles, triangles, trapezoids, and circles. The chapter on grain exchange (粟米 sù mǐ) handles proportional conversion between different cereals — twenty kinds of grain, each with its own unit, each requiring a different ratio to convert into millet. The chapter on equitable transport (均输 jūn shū) solves the kind of problem that anyone who has tried to distribute a delivery across multiple destinations with different costs will recognize instantly.
The compilation took shape over a long stretch of the Han Dynasty, roughly from 202 BCE through 220 CE. Most of the problems were circulating as individual teaching examples for centuries before they were gathered together. The version that survives today was finalized around 179 CE, when the famous scholar-official Zhang Cang (張蒼) and others compiled the working text. Then, in 263 CE, the mathematician Liu Hui (劉徽) wrote a brilliant commentary on it — a kind of detailed mathematical exegesis that doubled the length of the original and added proofs, alternative methods, and corrections. Liu Hui’s commentary is the reason we still have the Nine Chapters at all, and it is also where some of the most remarkable mathematics in the book first gets explained.
The nine chapters, in order, are: 方田 (land measurement), 粟米 (grain exchange), 衰分 (proportional distribution), 少广 (reducing dimensions — extracting square and cube roots), 商功 (estimating labor for construction), 均输 (equitable transport), 盈不足 (excess and deficit), 方程 (fangcheng, “rectangular arrays” — linear systems), and 勾股 (the right-angle, i.e. Pythagorean, theorem). Notice what is not there: no abstract axioms, no metaphysical speculation about the nature of number, no theological framing. The Chinese mathematical tradition, as the Nine Chapters embodies it, was relentlessly practical. Every problem is a problem someone actually had to solve: how much grain do I owe the tax collector? How many workers do I need to dig this canal? How much silk will a bolt of this width make into a robe of that length?
This is one of the great virtues of the book. It is also, for Western-trained readers, one of the things that makes it easy to underestimate. Euclid’s Elements, written around 300 BCE, is overwhelmingly a book of proofs — the geometry you can derive from a small set of self-evident axioms. The Nine Chapters is overwhelmingly a book of recipes — the calculations you need to run an empire. Euclid wants you to understand why the theorem is true. The Nine Chapters wants you to know how to solve the problem on your desk. Both approaches are mathematically legitimate. They are just different intellectual temperaments, shaped by different state needs: a city-state culture with leisure for abstract debate, and a continental empire with millions of taxpayers to count.
The Revolutionary Methods Inside
The single most important chapter in the Nine Chapters for the history of mathematics is the eighth one, 方程 fangcheng. The word translates literally as “rectangular arrays” or “rectangular tables,” and it refers to a method of laying out a system of linear equations in a grid, with the coefficients of the unknowns arranged by column and the constants arranged on the right. Then the algorithm walks through the grid, eliminating one variable at a time by row operations — exactly, in every detail, the procedure we now call Gaussian elimination.
Take a typical problem from the chapter. Three grades of grain — good, medium, poor — are bundled together in unknown quantities. We know the total weight and the total price of each bundle. How much grain of each grade do we have? Set up the equations, write them into the fangcheng array, and then perform the row operations that the text describes. Step by step, variable by variable, you arrive at the unique solution. The Nine Chapters does this for problems with two, three, four, and even five unknowns. The bookkeeping is done with bamboo counting rods laid out on a flat surface, because paper does not yet exist in Han China in the form we would recognize — the standard medium for calculation is physical rods, manipulated like an early abacus.
What makes this so striking is not just the existence of the method but its age. The Nine Chapters was finalized around 179 CE. Gauss published his Theoria motus corporum coelestium in 1809, presenting the elimination method that has since carried his name. The Chinese version is roughly sixteen hundred years older. Gauss did not borrow from the Nine Chapters — there is no plausible transmission route in his lifetime — but the algorithm was already ancient when he rediscovered it. The history of linear algebra, as it is usually told in Western textbooks, is a history of rediscovery.
The gougu theorem in chapter nine is the second showstopper. The theorem — that the square on the hypotenuse of a right triangle equals the sum of the squares on the other two sides — is what the West calls the Pythagorean theorem, after the Greek philosopher Pythagoras, who is said to have proven it around 530 BCE. The Nine Chapters states and proves the theorem, and uses it as the central tool of an entire chapter of practical problems: given two sides of a right triangle, find the third; given the diagonal of a square, find its side; given the depth of a well and the length of a rope, find how far the rope reaches across the bottom. Liu Hui’s commentary on the chapter includes a diagram-based proof that is geometrically rigorous and visually elegant. Pythagoras may have known the special case; the Nine Chapters and Liu Hui gave the world the general proof and the working toolkit.
The ying bu zu 盈不足 method, in chapter seven, is a third gift to the world. Translated as “excess and deficit,” it is an algorithm for solving problems where the answer lies between two guesses. You guess too high, you guess too low, you interpolate linearly, you get the answer. The method works for any problem that is linear in the unknown — and the Nine Chapters shows how to apply it to mixed linear, geometric, and even simple nonlinear problems by clever reformulation. This algorithm was independently rediscovered in medieval Europe as the “rule of double false position,” and it appears in Fibonacci’s Liber Abaci (1202). The transmission route is well documented: from the Nine Chapters into the Islamic mathematical tradition via Al-Khwarizmi and others, then into Latin translations during the Renaissance. The Europeans renamed what they had received, but the underlying technique was Chinese in origin.
The fifth chapter, 商功 (shāng gōng), is the construction chapter. It calculates volumes — of rectangular prisms, frustums of pyramids, cones, and frustums of cones — for earthworks, canals, dikes, and granaries. These are not abstract exercises. The Han Dynasty was constantly building and rebuilding its waterworks, its walls, and its tomb chambers, and the volume formulas in this chapter are the formulas the engineers would have used. A few centuries later, Zu Chongzhi (祖沖之, 429–500 CE) — one of the great mathematicians of medieval China — used Nine Chapters techniques, refined through Liu Hui’s commentary, to compute pi to an astonishing degree of accuracy. By inscribing a 12,288-sided polygon in a circle, Zu arrived at the approximation 355/113, which is correct to six decimal places. The next improvement on this value in Europe would not come until the late sixteenth century. Liu Hui himself, using a 192-sided polygon in his 263 CE commentary, had already gotten pi to 3.14159 — five decimal places, centuries before anyone in the West.
Problems From the Book, Still Solvable Today
To get a feel for what the Nine Chapters actually teaches, it helps to look at the problems themselves. They are written in a distinctive style: a short narrative setup, often involving officials and farmers; a list of known quantities; a question. Then the solution, presented as a sequence of operations on the fangcheng array or with rods.
One of the most famous is the “too much / too little” problem that gives chapter seven its name. Two buyers jointly purchase a quantity of silk. Each contributes a sum of money; each pays a price per bolt. Buyer A paid more than his share; buyer B paid less. Given the totals and the rates, how much silk does each get? The Nine Chapters solves this with the ying bu zu method — set up two assumed solutions, one for “too much” and one for “too little,” and interpolate. The numerical answer comes out cleanly, and the technique generalizes to any problem where the relationship is monotonic.
Another classic problem, from chapter two, handles grain exchange. Twenty kinds of grain are listed, each with a conversion ratio to the standard unit of millet. The problem asks: given some quantity of beans, how many units of millet do they equal? The Nine Chapters gives the conversion table and demonstrates how to use proportional reasoning to handle multi-step conversions. It sounds mundane until you realize that the imperial economy depended on exactly this kind of conversion, done millions of times per year, across a continent. The Nine Chapters is, in a real sense, the operating manual for the Han tax and supply system.
The well-digging problem is the most charming of the standard examples. A square well of unknown side length is being dug. The reed used to measure its depth turns out to be too long by a known amount. By how much should the side of the well be adjusted so that the depth (measured by the reed) equals a certain target? Solve it, and you have both the side length of the well and the depth — using the gougu theorem to relate the diagonal measurements to the sides. The problem is the kind that any Han-era county magistrate responsible for irrigation works might actually have faced, and it ties the abstract theorem directly to physical infrastructure.
These problems were not meant to be admired from a distance. They were meant to be solved, by working officials, in the field, using rods and tables. That orientation — mathematics as a tool of statecraft — is what gave the Chinese tradition its particular character, and it is also what made the Nine Chapters so directly portable to the Islamic world when it arrived there. Al-Khwarizmi’s Al-Kitab al-Mukhtasar fi Hisab al-Jabr wal-Muqabala — “The Compendious Book on Calculation by Completion and Balancing” — written in Baghdad around 820 CE, is structurally a descendant of the Nine Chapters. The very word algebra comes from the Arabic al-jabr in that title. And the word algorithm comes from the Latinized form of Al-Khwarizmi’s own name. The Arabic word for the Chinese counting rods, khwarizmi’s tables, would even enter European mathematical vocabulary through him. We owe more to the Nine Chapters than we usually acknowledge.
How the Book Traveled and Changed the World
The Nine Chapters did not stay in China. The Silk Road — that web of overland and maritime trade routes connecting Chang’an to Central Asia, Persia, the Levant, and eventually the Mediterranean — was as much a conduit for ideas as for silk. Mathematical techniques traveled with merchants and diplomats. By the seventh and eighth centuries, Chinese mathematical methods had reached India, where they merged with local Indian innovations in place-value notation and the use of zero. By the ninth century, the combined tradition had reached Baghdad, the capital of the Abbasid Caliphate and the most active intellectual center in the world at the time.
Al-Khwarizmi, working in the House of Wisdom in Baghdad, drew on this combined inheritance to write his two foundational books: one on arithmetic (which introduced Hindu-Arabic place-value notation to the Arabic-speaking world), and one on algebra (which gave the discipline its name). The Hindu-Arabic numeral system — the digits 0 through 9 that we still use today — is itself a product of this East-West fusion, with roots in Indian mathematics, transmitted via Arabic scholars, who had learned in part from Chinese sources. The familiar story of how “Arabic numerals replaced Roman numerals in Europe” hides a deeper story: those Arabic numerals were already partly Chinese in origin, having passed through a chain of transmission that began with texts like the Nine Chapters.
Liu Hui’s commentary, in particular, made its way into the Korean and Japanese mathematical traditions by the seventh century. Japanese scholars of the Heian and Edo periods studied the Nine Chapters as part of their standard curriculum. The Chinese mathematical tradition continued to develop — Qin Jiushao, Jia Xian, and others in the Song and Yuan dynasties added polynomial algebra and methods that anticipated Pascal’s triangle by centuries — but the Nine Chapters remained the foundational text, the one every serious mathematician was expected to master.
Comparing the Nine Chapters to Euclid’s Elements is instructive, and a little unfair to both books. Euclid is the more rigorous document, organized around proof and deduction from a small set of axioms. The Nine Chapters is the more practically useful book, organized around the problems a working mathematician actually has to solve. Euclid’s geometry shaped Western science in profound ways — through Archimedes, through Newton, through the very idea of mathematical physics. The Nine Chapters shaped state administration, engineering, and commerce across East Asia. Both books deserve their place in the canon. Neither is the whole story of mathematics. The convention of treating the Elements as if it were the singular source of mathematical thinking is a habit of the Western tradition, not a feature of the evidence.
What the Nine Chapters finally shows us is that mathematics is bigger than any one civilization’s version of it. The Chinese contribution — practical, algebraic, oriented toward systems of equations and algorithms rather than geometric proof — is a parallel tradition of comparable depth and far greater longevity. When you open a modern textbook and read about Gaussian elimination, you are reading a method that has been in continuous use, in one form or another, for roughly two thousand years. The two-thousand-year-old version of it is in the Nine Chapters. The newer version is in your linear algebra class. The line between them is unbroken.



