Abstract
The remarkable algebra of polynomials used by mathematicians in the Song and Yuan periods was the product of a development that started in the Han period or before. This article traces that development through examples from four important books.
Introduction
Mathematical texts from the Song and Yuan periods use a remarkably sophisticated algebraic method, describing manipulations of what we would call ‘polynomial expressions’ to solve geometric problems. This was the highest point of a development that started more than a millennium before, with the Nine Chapters on the Art of Mathematics (Jiuzhang suanshu 九章算术, hereafter the Nine Chapters) 1 and Liu Hui (刘徽; 3rd century CE). In this article, I analyse examples from four mathematical books and show some high points in the development of the system.
The story starts with Liu Hui's geometric explanation of the square- and cube-root algorithms in the Nine Chapters. These are essentially methods of numerical solution of the simple polynomial equations
Liu Hui and the Nine Chapters
The Nine Chapters is certainly the most important book in the history of Chinese mathematics. Its date has long been uncertain. Zou Dahai (2022: 34–51) has reviewed many attempts to date the book and concluded that its origin was before the Qin period, but that it reached its present form in the Western Han period. 2 I feel no need to go much further into this question here: the book is early. Liu Hui's commentary, which can be securely dated to 263 CE, corrects, extends and explains its methods. 3
The algorithms for extracting square and cube roots are in Chapter 4 (See Qian, 1963: 149–151; Chemla and Guo, 2004: 322ff., 360–368, 800–804 n. 27–55); Guo et al., 2013: 373–409; Shen et al., 1999: 175ff., 203–213). 4 In explaining the square-root algorithm, Liu Hui uses a diagram, now lost, that may have resembled Figure 1d.

The geometric interpretation of the square-root algorithm in the Nine chapters.
Problem 12 in Chapter 4 asks for the square root of 55,225. The Nine Chapters text describes the root extraction step by step, and from its terminology it is clear that this algorithm had from the beginning been interpreted geometrically. Liu Hui makes the geometric interpretation explicit.
See Figure 1 a–d. The starting situation is a square with area 55,225 square paces. The first digit of the root, 2, is determined. Its value is 200 paces; a corresponding square is cut out of the original square, leaving a gnomon with area 15,225 square paces. The second digit is 3, and a gnomon corresponding to 30 paces is removed, leaving 2,325 square paces. The third digit is 5, and when the corresponding gnomon is removed, there is nothing left of the original square. The result is therefore exactly 235 paces.
The Nine Chapters includes in a single case the direct use of the geometric interpretation of the square-root algorithm to solve a geometric problem, Problem 20 in Chapter 9 (see Qian, 1963: 255–256; Chemla and Guo, 2004: 689–693, 736–738; 892–893 n. 107–112; Guo et al., 2013: 1137–1143; Shen et al., 1999: 507–512). This and Liu Hui's comment are translated in Appendix 1.
It is quite possible that Liu Hui provided a diagram, now lost, with his comment, but Figure 2 is simply my diagram, not an attempt to reconstruct his. A square city, LKPS, has gates at B and C, the centres of LK and SP. A tree is at A. Someone walks from C to D and then to E, where he sees the tree. The given quantities are
a = 20 paces b = 14 paces c = 1,775 paces
and x is to be calculated. Liu Hui uses the similarity of triangles ABL and ADE to show that 2ac is equal to the area of the rectangle FGHJ. He then dissects and rearranges areas to construct the gnomon LWQPRU in Figure 3, which has the same area and is essentially the same as a result of the first step of the square-root algorithm (Figure 1(b)). Here, ½(a + b) corresponds to the first digit of a square root. Continuing the steps of the algorithm gives x = 250 paces. In a modern interpretation, this corresponds to solving the polynomial

To illustrate Problem 20 of Chapter 9 in the Nine Chapters.

The result of dissecting and rearranging parts of Figure 2.
This is then the first known use of a non-trivial polynomial in classical Chinese mathematics, the beginning of a long development. It is interpreted entirely geometrically, without the use of any algebraic reasoning.
Wang Xiaotong (王孝通) was an official of the Sui and Tang dynasties concerned with mathematics education, astronomy and the calendar. His dates are tentatively given as ‘579?–638?’. His book, Jigu suanjing (缉古算经, The Continuation of Ancient Mathematics, hereafter the Continuation), was presented to the Tang Emperor around 638 (Lim and Wagner, 2017: 3–5).
In this book, the numerical solution of cubic polynomials by the Chinese version of Horner's method (see Wagner, 2017) is part of the background knowledge assumed on the part of the reader. This root extraction is directly related to the extraction of square and cube roots in the Nine chapters (and other early books), as is clear from the terminology used.
Reading the book, it becomes clear that Wang Xiaotong sees the columns of numbers used in the root-extraction algorithm as representing what we would call equations: they are statements that certain operations on an unknown quantity result in a certain quantity.
Building a tamped-earth dyke
Two of the problems in Wang Xiaotong's book are translated in appendices 2 and 3. In the first, the second part of Problem 3, the dimensions and volume are given for a tamped-earth dyke (Figure 4) to be built by workers from four counties. The volume that each county is responsible for is given, and the dimensions of the county's part are to be calculated. Many of the book's problems are ‘textbook exercises’ without direct practical application, 5 but this one is real, a simplified version of one of the tasks of imperial officials: administering the assignment of corvée labour for public works (Wagner, 2013; Lim and Wagner, 2017: 6–12).

To illustrate the second part of Problem 3 of Wang Xiaotong's Continuation.
See Figure 4. The dimensions of the whole dyke have been determined in the first part of Problem 3:
a = 80 cun 寸 b1 = 142 cun b2 = 762 cun h1 = 31 cun h2 = 341 cun l = 4800 cun VA = 33,351,040 cun3
The volume of County A's section is
In the second part of the problem, the length of County A's section, x, is determined, after which its other dimensions are determined by considering similar triangles. A cubic equation is built up using the volume dissection shown in Figure 5. The volumes of the four parts are all products of known quantities and powers of x:

Dissection of Figure 4 to derive the contribution of County A.
However, Wang Xiaotong's cubics always have the cubic coefficient equal to 1. His calculation is therefore
This equation has one real root,
At the end of Wang Xiaotong's book are six problems in plane geometry, which he solves using three-dimensional constructions. Two of these, Problems 19–20, are translated in Appendix 3. A challenge here is that all extant versions of the Continuation go back to a damaged copy (now lost) in which large parts of the last pages are fragmentary. Various attempts have been made to reconstruct the original text. These are discussed by Lim and Wagner (2017: 104–108); for convenience, I accept here Zhang Dunren's (张敦仁) reconstruction. Others differ in detail but not in the overall method, which is my concern here.
Problem 19 states that in a right triangle (see Figure 6),

A right triangle, with the classical Chinese names for its parts and their commonest English translations.
The calculation is then the numerical solution of
It is easy to derive (1) algebraically, for
However, what remains of the fragmentary text of a comment in smaller characters appears to imply a geometric explanation. That in turn would seem to imply a four-dimensional construction. But the lack of units in the given quantities makes the construction shown in Figure 7 plausible. Here, both b and b2 are used as linear measures. The volume of the solid is

Proposed construction to derive the leg of a right triangle in Problem 19 of Wang Xiaotong’s Continuation.
These two examples show that an important insight had been gained by Wang Xiaotong's time: the columns of numbers used in root extraction represent what we call polynomial equations, and they can be used in more complex calculations than were dealt with in the Nine Chapters. He does not manipulate them, but constructs them using ad hoc geometric constructions. His algebra is thus still tightly tied to geometry.
Ceyuan haijing (测圆海镜, Sea Mirror of Circle Measurements, hereafter the Sea Mirror), by Li Ye (李冶; 1192–1279), is one of several books of the late Song and Yuan periods that use manipulations of polynomials in solving complex mathematical problems (Mei, 1966; Martzloff, 1997: 17–18). The system was called Tianyuan shu (天元术, ‘the method of the celestial unknown’). 6 The variable in the polynomial was called the tianyuan. The Sea Mirror appears to be the one of these books that uses the method in its most general form, at least with respect to polynomials of one variable. Later, Zhu Shijie (朱世杰) extended it to work with up to four unknowns.
The book begins with a diagram, reproduced here in Figure 8, which shows a circular city and a number of roads inside and outside the city. Here, Chinese characters are used to mark points. In the same figure, I give a corresponding modern diagram in which capital letters are substituted for the characters.

Left: The diagram at the start of Li Ye's Sea Mirror, with translations added for the characters used to mark points. Right: a representation of this diagram using letters to mark points. (For the convenience of readers, the letters used here are the same as those used by Karine Chemla (1982) in her version of the diagram.).
The diagram is followed by a chapter which states 692 geometric identities. These are the raw material for the core of the book: 171 problems demonstrating the use of the method of the celestial unknown. The parts of this chapter that are relevant for the following discussion are translated in Appendix 4.1.
One of the simpler problems, Problem 12 in Chapter 5, is translated in Appendix 4.2: A man walks from Q to C and then to F in Figure 8; he has walked a total of 1,144 paces. Another man walks from G to T and then to F; the difference between these two walks is 56 paces. The diameter of the circular city is required. Thus
Two non-obvious facts, stated in Chapter 1 (see Appendix 4.1.2), are used:
These follow from two facts stated in the Nine Chapters and proved by Liu Hui (Chemla and Guo, 2004: 726, 728–729; Guo et al., 2013: 1110–1121; Qian, 1963: 252–253; Shen et al., 1999: 494–495; Wagner, 2022):
From these follow
It follows immediately from (2), (3), and (4) that
The polynomials are, as before, columns of counting-rod numbers. Representations of these are included directly in the text, as can be seen in Appendix 4.2. How these small drawings are to be interpreted is shown in Figures 9 and 10.

The two series of counting-rod numerals. Numerals of the two series are used alternately to allow closer spacing on the counting board.

Two examples of the use of counting rods (chou 筹) to represent polynomials.
Li Ye's text gives first the calculation of the coefficients of the cubic equation to be solved numerically:
The first polynomial on the counting board is an expression for CO:
Next, an expression for FT is needed. Considering similar triangles, this is
In the following steps, the divisor CO is ‘set aside’, so that the next polynomial is in effect






Confirming the problem solutions. The equation (6) has three roots: d = 168.737, d = 240, and d = 1,991.26. The third is clearly not a solution, since d > QC. The first two are solutions.
If QC and d are given, all of the other dimensions of the triangle are determined. From the Pythagorean Theorem and (4), the following can be derived:
Then, given QC = 600, it can be calculated that both d = 168.737 and d = 240 can satisfy (2) and (3).
This example shows us the classical Chinese algebra of polynomials in one variable close to its full development, used in solving complex problems. The system clearly has limitations. In particular, Li Ye states all of his problems in geometric terms, the unknown quantity is in each case a linear measure, and all of his polynomials are functions of this unknown.
In the Siyuan yujian (四元玉鉴, Jade Mirror of Four Unknowns, 7 published in 1303, hereafter Jade Mirror), we see the classical Chinese algebra of polynomials at its highest level of sophistication. Here, the columns of numbers representing polynomials in one unknown that we have seen in Li Ye's Sea Mirror are extended to rectangular arrays of numbers, which represent polynomials in up to four unknowns. The author, Zhu Shijie (朱世杰), appears to have drawn on several earlier works, but these are no longer extant (Du, 1966: 168).
In Li Ye's polynomials, the single unknown is called tianyuan yi (天元一) or simply tianyuan, the ‘celestial unknown’. In Zhu Shijie's book, the unknowns are called tianyuan (天元), diyuan (地元), renyuan (人元) and wuyuan (物元), the ‘celestial’, ‘terrestrial’, ‘human’ and ‘creature’ unknowns. Modern scholars studying the Jade Mirror represent these with x, y, z and u.
In his book, Zhu Shijie introduces his methods with four worked examples, using one, two, three and four unknowns respectively. These have been translated several times (see Vanhée, 1931; Hoe, 1977, 2007; Guo et al., 2006: 42–85). This introduction is followed by statements of 284 problems with the barest of hints as to how they are to be solved. Fortunately, the Qing scholar Luo Shilin (罗士琳; 1789‒1853), in his Siyuan yujian xicao (四元玉鉴细草), published in 1837, gives detailed working (xicao) for each of them, and I depend heavily on his work in my discussion.
The counting-rod array notation for a polynomial in two variables is a rectangular array with a place for each coefficient, like this:
So that, for example, this array:
would represent the polynomial
The use of counting-rods is in general the same as laid out in Figures 9 and 10. In illustrations of polynomials in the book, the constant term is often but not always marked with the character tai (太, ‘supreme’). The calculator might have marked this on the counting board in some way, or he might simply have kept the position in mind.
This notation appears to be perfectly general for polynomials in two unknowns. Extending it to a general notation for polynomials in three or four unknowns, however, would seem to require three- or four-dimensional arrays. In these cases, Zhu Shijie uses a complex notation which I do not understand deeply enough to explain properly, and in the following, I shall be concerned only with the case of two unknowns.
It is apparent that the array notation owes much to the matrix approach to systems of linear equations presented in the Nine Chapters, Chapter 8. 8 The terms xiao (消, ‘clear’) and qi (齐, ‘homogenize’) are used here in ways analogous to their use there.
Multiplying or dividing an array by x is done simply by moving the whole array down or up. The same operations with y move the array to the left or right. This moving of the array requires only moving the character tai (太; or other indication of the constant term) accordingly.
The algorithm for multiplication of two arrays is never stated, but its result is of course the array corresponding to the product of the polynomials represented by the multiplicand arrays.
Each of the 288 problems in the book gives two equations, the first prefaced by jin you (今有, ‘now there is …’), and the second by zhi yun (只云, ‘it is only stated that …’). In Zhu Shijie's four worked examples, two equations are developed that correspond to these, called the jin array and the yun array. From these are developed the ‘left’ and ‘right’ arrays, corresponding to two polynomials which are both equal to zero. These are analogous to the matrices in the linear algebra of the Nine Chapters; the operations of ‘homogenizing’ and ‘clearing’ are used to eliminate all unknowns except x. The Chinese version of Horner's method is then used to find a numerical root of this equation.
With only two equations given in each problem, how are problems of three or four unknowns solved? Most or all of these involve right triangles, and an implicit third equation is the Pythagorean Theorem. And the worked example using four unknowns has only three actual unknowns, the three sides of a right triangle.
The example of a problem in two unknowns that I have chosen for this discussion is Problem 15 of Section 6. 9 It is translated, together with Luo Shilin's detailed working, in Appendix 5.
Letting a and b be the dimensions of a rectangle, the statements of Problem 15 amount, in modern notation, to
Zhu Shijie directs the reader to let the two unknowns be
Fortunately, Luo Shilin gives all the details. Using modern notation, from (11),
Further, from (10),
Luo Shilin expresses these polynomials as arrays:
Subtracting (16) from (15′),

Subtracting (14′) from (18) gives

Luo Shilin has now arrived at two polynomials in x and y, (17) and (19), each of which equals zero. The next step is to eliminate the two y2 terms in (17). Multiplying the yun array by the left column of the jin array, (17),
This is called the ‘left’ array. To make the ‘right’ array, the jin array, (17), is doubled and the ‘left’ array is subtracted from it,
On the counting board are now the ‘left’ and ‘right’ arrays:

This result is (13), the equation given by Zhu Shijie to be solved numerically. It has two real roots, x = 1 and x = 9; and a = x = 9 is the correct solution. Luo Shilin does not indicate how b is calculated, but one simple way is to substitute a = 9 paces into (10) and (11) and take their difference, giving the result b = 16 paces. The root x = 1 is not a solution, as no value of b can in that case validate both (10) and (11).
The calculation in (13)–(21) needs some explanation. It follows from the equations in (20) that
And the difference of the products of the inner and outer columns in (20) is
This example shows something of the sophistication that the algebra of polynomials reached in Zhu Shijie's book. Polynomials in more than one variable are allowed, the tie to geometry is entirely broken, and variables can point to functions of the unknown as in (10),
We have seen in this article examples from four books ranging over more than a millennium. What can we say about the conceptual development that they show?
It is important to emphasize that more examples, from more books, would undoubtedly lead to more solid insights. Furthermore, there were many other mathematical books written and published in our period of interest, most of which are no longer extant. And we must also assume that there were many mathematicians who contributed to this development but never wrote a book and whose names we do not know. Therefore, while we naturally admire the accomplishments of Liu Hui, Wang Xiaotong, Li Ye and Zhu Shijie, we may not suppose that they alone moved the development forward.
The example from the Nine Chapters, with Liu Hui's commentary, showed that a well-known technique could be used for more than it was designed for—this is often the first step in the evolution of a technique or a technology. But as long as the technique of root extraction was conceptually tied to geometry, Problem 20 remained an interesting curiosity without practical application or obvious potential for further development.
The first major development that we see through these examples is the recognition in Wang Xiaotong's Continuation that the column of numbers used in the root-extraction process is what we would call an equation: it is in effect a statement that performing certain operations on an unknown quantity results in a certain quantity.
Wang Xiaotong formed his equations by ad hoc geometric constructions, so his algebra was still tied to geometry, but while Liu Hui saw the ‘coefficients’ of his ‘equation’ as areas or volumes, for Wang Xiaotong, they are simply numbers that appear in the calculation of certain volumes. 10
In the example from Li Ye's Sea Mirror, we see a break in the connection to geometry. Though all of the problems in the book are stated in geometric terms, the actual calculations are entirely concerned with numbers.
Further, in this book, a column of numbers is not always an equation to be solved numerically, but an expression for one unknown in terms of another. These expressions can be manipulated: added to, subtracted from, or multiplied by other expressions, or multiplied or divided by a constant. Looking only at the first steps in the example, the equation (7) states a relation between CO and d. The aim of the manipulations is to derive an expression in the unknown which is equal to zero. This is then an equation that can be solved numerically. The general method seems to be to find two different expressions in the unknown for the same variable and subtract the one from the other; in our example, equations (8) and (9), two expressions for
In Zhu Shijie's Jade Mirror, we see the highest level of sophistication that was reached in this algebraic system. It is extended to deal with up to four variables, manipulated using methods inspired by the matrix algebra of the Nine Chapters.
11
An advance that has received less attention is greater freedom in the choice of variables. In Li Ye's Sea Mirror, the variable in each polynomial expression is the unknown quantity of the respective problem. In the Jade Mirror, a variable can be a function; in our example, the variable
What were these books? Were they textbooks of practical mathematics? While their examples are often not at all practical, the mathematics that they present was definitely used in practical problem-solving (Lim and Wagner, 2017: 12; Wagner, 2013, 2023: 71–75). Both the Nine Chapters and Wang Xiaotong's Continuation were used in mathematical education in the Tang period (Lim and Wagner, 2017: 13–20), and presumably later as well; but the Sea Mirror and the Jade Mirror seem not to have been used as textbooks. Perhaps they should be categorized as ‘pure mathematics’ or ‘recreational mathematics’—though these are modern concepts, not necessarily applicable to ancient books.
Why was this marvellous algebra of polynomials totally forgotten by the late fourteenth century, the beginning of the Ming dynasty? No book later than Zhu Shijie's Jade Mirror mentions it before the renewed interest of Chinese mathematicians in the nineteenth century. The introduction of the abacus around this time may be part of the explanation, together with revised administrative practices in public works. It also seems likely that ‘pure mathematicians’ had developed the system as far as it could be taken without a radical paradigm change, and therefore turned to other interests.
Footnotes
Notes
Funding
The author received no financial support for the research, authorship, and/or publication of this article.
Declaration of conflicting interests
The author declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Author biography
.
Appendices: Translations
In the translations, my mathematical comments are given indented in the text. Philological comments are given in notes.
