The page is not correctly displayed by Internet Explorer running in Windows XP.
Use another browser, for example Firefox or Chrome.

Mathematics, astronomy, and the planning of public works in China, Han to Yuan
(1st century BCE – 14th century CE)

Donald B. Wagner

1 May 2013

Most of the images on this page are scaleable. To enlarge an image, simply zoom in your browser.

This article is a reworking of a presentation which I gave at a seminar of the European Research Council Project ‘Mathematical Sciences in the Ancient World’ (SAW) on 6 April 2012. I am grateful to the organizer, Karine Chemla, for making my participation possible.

I was asked to speak on ‘Civil works, constructions, excavations, and the like’, and in preparing the presentation I realized that I had never before been serious about the applications of mathematics in ancient China. When I started looking, I discovered that the subject has some very interesting aspects. One of these is the close relation which appears to have existed between astronomy and public works. I am not aware of any other culture, ancient or modern, in which this relationship is seen.

The Nine Chapters

The Jiuzhang suanshu, ‘Arithmetic in nine chapters’, is a book of the Han dynasty, perhaps the first century CE. Chapter 5, ‘Calculation of labour’ (Shang gong 商功, gives exercise problems which involve the calculation of (1) the volumes of geometric solids and (2) the labour requirements for public works. Historians of mathematics have concentrated their attention on the chapter’s solid geometry, but the labour calculations, though less interesting mathematically, may have been very important to the book’s intended audience. An example is Problem 4, which begins:


A dyke has breadth 2 zhang, upper breadth 8 chi, height 4 chi, and length 12 zhang 7 chi. What is the volume?

Answer: 7,112 [cubic] chi.

(In this period 1 zhang 丈 = 10 chi 尺 ≈ 2.3 metres.]

The method for calculating this volume has already been given in Problem 1: It is equivalent to


In this case,


Problem 4 continues:

By the winter norm, one person’s labour is 444 [cubic] chi. How many labourers are used?

Answer: 16 2/11 persons.

Method: Let the volume in [cubic] chi be the dividend and the norm in [cubic] chi be the divisor. Divide the dividend by the divisor; [the result] is the number of labourers.

This calculation is


This labour calculation was quite simple, but Problem 21 complicates things. It begins:


A pool has upper breadth 6 zhang, length 8 zhang, lower breadth 4 zhang, length 6 zhang, and depth 2 zhang. What is the volume?

Answer: 70,666 2/3 [cubic] chi.

The method for calculating this volume has already been given under Problem 18. It is equivalent to


In this case,


The problem continues:

The carrying of the earth is 70 bu [‘paces’], with 20 paces up and down wooden steps. Two [bu] on the steps correspond to five on a level path. For resting time, one is added for each 10. Time for loading and unloading is equivalent to 30 bu. One round trip is determined to be 140 bu. The capacity of a basket of earth is 1 chi 6 cun [i.e. 1.6 cubic chi]. The autumn norm for one person’s labour is equivalent to walking 59 1/2 li.

What is the volume [of earth] carried by each person, and how many labourers are used?

Answer: One person carries 204 [cubic] chi, and the number of labourers is 346 62/153.

Method: . . .

(In this period  1 li 里 = 300 bu 步 = 1800 chi 尺 ≈ 400 metres.)

The method given (not translated here) amounts to


This calculation is simple arithmetic, and the point of the problem seems to be to exercise the student’s ability to organize a complicated calculation.

 Large labour forces

These labour calculations must remind us of one of the primary characteristics of Chinese governments throughout the ages – their ability to organize large numbers of workers for major projects. One example is that the First Emperor put 700,000 forced labourers to work building his palace and mausoleum; archaeology is beginning to show how it was possible not only to house, feed, and control so many workers, but also to organize their efforts in such a way that useful work was actually accomplished (Wagner 1993: 206).

Jumping two millennia ahead we can see the same phenomenon in this illustration of the digging of a canal in about 1840:

Needham 1971, p. 262.

(Needham 1971: 262)

Click to enlarge

This picture is worth some study. At first sight it appears chaotic, but a closer look shows an amazing degree of organization. One can distinguish officials, surveyors, foremen, labourers of various categories, and soldiers guarding the whole.


An even more recent example is the building of the Red Flag Canal (Hongqi Qu 红旗渠) in Linzhou Municipality 林州市, Henan. The film from which the accompanying photographs were taken shows numerous examples of how a large labour force is organized and kept at work. For example, we see at one point a long file of workers carrying building materials up a hill; musicians are stationed at intervals to entertain them in their hard and boring work.

... ...

Xu Shang 許商, 1st century BCE

Xu Shang was the first of a number of astronomers who are known to have been active in the planning of public works. He held various high positions in government (Han shu, 19b: 836, 841–842; Loewe 2000: 622), and the Han shu bibliography lists two books by him:

Wuxing zhuanji 五行傳記 or Wuxing lun li 五行論曆, in one chapter, seemingly a commentary concerning natural phenomena and calendrical calculations for the ancient classic Shang shu 尚書 (or Shu jing 書經, ‘Book of documents’) (Han shu, 30: 1705, 88: 3604).

Xu Shang suanshu 許商算術, in 26 chapters, on calendrical calculations (Han shu, 30: 1766).

A story of unfortunate advice by Xu Shang to the Emperor (Han shu 9: 1686; tr. Needham 1971: 329–331) shows the importance of labour calculations like those we have seen above in the Jiuzhang suanshu in the administration of the Empire. About 100 BCE the Yellow River had bifurcated, forming a tributary which was called the Tunshi River 屯氏河. In 39 BC this river silted up; seven years later, the chief commandant of Qinghe Commandery 清河郡 (near modern Handan, Hebei), Feng Qun 馮逡, reported that the Yellow River was in danger of overflowing its dykes, and that dredging the Tunshi River would ease the pressure and reduce the danger of flooding.

The memorial was passed to the Chancellor and the Imperial Counsellor. They responded that Xu Shang was an authority on the Shang shu, that he was good at calculating, and that he could estimate the labour required. He was sent to inspect the situation, and reported that the Tunshi River was the cause of flooding, but that the local labour resources were insufficient, and dredging could be postponed.

The author of the original memorial, Feng Qun, has a very brief biography in the Han shu (79: 3305), seemingly only because his family had a certain importance. He held various local administrative posts, rising to Governor of Longxi Commandery 隴西郡 (near modern Lanzhou 兰州, Gansu). We may perhaps surmise that the initiative for public works often came, as in this case, from local officials at lower levels of the bureaucracy who most often are invisible in the extant sources. It was then the task of officials at higher levels to organize a labour force for the project, drawing on the population of more than one locality. This would often involve calculating volumes of earth to be moved; then the number of man-days required could be calculated and compared with the corvée labour available according to prevailing norms. (Very little is known about these norms in the Han period.)

Xu Shang’s advice was unfortunate, for three years later the Yellow River overflowed its dykes and caused devastation, flooding 5000 square kilometres to a depth up to 7 metres. Wang Yanshi 王延世 was sent to deal with the problem, and he repaired the dyke with bamboo ‘stoppers’ (zhu luo 竹落, ‘gabions’), ca. 9 metres long and 5 metres in circumference, filled with small stones.

An incident two years later shows something of the attitude toward calculation experts. The Yellow River again overflowed its dykes. It was proposed that Wang Yanshi should be sent, but Du Qin 杜欽 objected that an additional expert, Yang Yan 楊焉, should be sent, together with Xu Shang and Shengma Yannian 乘馬延年:

Wang Yanshi and Yang Yan will certainly have violent disputes; there will be deep discussions and mutual criticism. Xu Shang and Shengma Yannian both understand calculation and can estimate labour requirements, so that they can distinguish truth from error. They can choose the correct plan and follow it, so that there surely will be success.

The expedition was a success, and Wang Yannian was given a rich reward.

Zu Xuan 祖暅, 5th century CE

Zu Xuan was the son of the famous mathematician Zu Chongzhi 祖冲之 ( 429–500 CE), and was himself an important mathematician. He is especially well known for his derivation of the correct formula for the volume of a sphere, using a version of Cavalieri’s Theorem (see e.g. Wagner 1978). Less well known is his work on astronomy, for example in the discussion translated here:


This statement by Jiang Ji is incorrect: ‘Stars are like the moon, receiving [light] from the sun and only then being visible.’ If stars were inside the sun [?], they would necessarily have phases; this is not the case. It is well known that stars • • • have a constant brightness. Thus the bodies of stars have their own light and do not receive [light] from the sun before they shine. • • •
(Kaiyuan zhanjing 開元占經, Siku quanshu edn, 1: 23b).


A story of unwanted advice by Zu Xuan to the Emperor, and his subsequent imprisonment, indicates that his duties included the supervision of public works. About 500 CE, Wang Zu 王足 presented calculations and proposed that the Huai River 淮水 should be dammed to provide irrigation for Shouyang 壽陽 (perhaps in modern Anhui).

The Emperor Gaozu 高祖 was in favour of this, and sent the waterworks master Chen Chengbo 陳承伯 and the Construction Supervisor [caiguan jiangjun] Zu Xuan to inspect the topography. They both reported that the sandy mud of the Huai River was too light and insubstantial, so that the project could not be completed.

The Emperor did not accept the experts’ advice, and set some 200,000 labourers to work building the dam. It was to be closed in 515, but various difficulties were encountered, the people were distressed, and many labourers died. It was finally closed in 516, and was a great success. Later, however, it was not properly maintained.

In the autumn, in the 8th month, the Huai River rose disastrously, the dam broke in many places, and the river flowed violently to the sea. Zu Xuan was charged and sent to prison.

It seems that Zu Xuan, as ‘Construction Supervisor’, was responsible for the maintenance of the dam, and was punished because he failed in this duty. 

Wang Xiaotong 王孝通 (6th–7th century CE)

Wang Xiaotong was an important astronomer, known for, among other things, his contribution to a debate on the exact amount of the precession of the equinoxes. He served the Sui and Tang dynasties in posts concerned with calendrical calculations. His book, Jigu suanjing 緝古算經, presented to the Imperial Court shortly after 626, contains very little about astronomy or the calendar and a great deal about public works.

The book contains:

• One simple pursuit problem, stated as an astronomical problem.

• 13 problems in solid geometry, stated as construction problems.

• 6 problems in plane geometry, completely abstract.

The dimensions of a dyke

Problem 3 is as follows:

Suppose a dyke is to be built. The difference between the upper and lower widths of the west end is 6 zhang 8 chi 2 cun, the difference between the upper and lower widths of the east end is 6 chi 2 cun, the height of the eastern end is  3 zhang 1 chi less than the height of the western end, the upper width is 4 chi 9 cun greater than the height of the eastern end, the straight length is 476 chi 9 cun greater than the height of the eastern end.

(In this period 1 zhang 丈 = 10 chi 尺 = 100 cun 寸 ≈ 3 metres)


The given quantities are:

b2a2 = 682 cun

b1a1 = 62 cun

h2h1 = 310 cun

ah1 = 49 cun

lh1 = 4,769 cun

a = a2 = a1

Labour data, translated directly below, allows the computation of the volume V of the dyke, and its dimensions are found by solving numerically the cubic equation





h13 + 5,004 h12 + 1,169,953 ⅓ h1 = 41,107,188 ⅓ cun3

h1 = 31 cun  ≈ 93 cm

after which the other dimensions are easily found using the given differences:

h2 = 341 cun ≈ 10 m

a1 = 80 cun ≈ 2.4 m

a2 = 80 cun ≈ 2.4 m

b1 = 142 cun ≈ 4.3 m

b2 = 762 cun ≈ 23 m

l = 4,800 cun ≈ 144 m

Hints in the text indicate that the cubic equation above was derived using a volume dissection something like this:


It is clear that this first part of the problem does not reflect actual practice, since no practical construction starts with the differences of dimensions. However we shall see further on that this same dissection method is used in problems which do appear more practical.

Building the dyke

Problem 3 continues:

County A [sends] 6,724 workers, county B 16,677 workers, county C 19,448 workers, county D 12,781 workers. Each person from the four counties can during one day excavate 9 dan 9 dou 2 sheng [= 9920 ge] of soil. Each person can build a constant volume of 11 chi6/13 cun [i.e. 114 6/13 cun3 = 11  29/65 chi3] per day. Digging out 1 [cubic] chi of soil results in 8 dou [= 800 ge] of soil.

People in former times, carrying 2 dou 4 sheng 8 ge [= 248 ge] of soil on their backs and travelling 192 bu on a level road, did 62 trips in one day. In the present situation there are hills to climb and rivers to cross to obtain the soil: there are only 11 bu of level road, the slanted height of the hill is 30 bu, and the width of the river is 12 bu. When climbing a hill 3 [bu] is equivalent to 4 [bu of even road], when descending a hill 6 [bu] is equivalent to 5 [bu], and when crossing water 1 [bu] is equivalent to 2 [bu]. • • •

(In this period 1 dan 石 = 10 dou 斗 = 100 sheng 升 = 1000 ge 合 ≈ 60 litres.)

As noted above, from these figures the total volume of the dyke can be calculated, as follows.

Labour for the task of transporting earth:



Labour for the three tasks (digging, transporting, and tamping the earth):


Volume of the dyke:


There has been a tendency to see this kind of complicated problem in simple arithmetic as a gratuitous ‘imbroglio’ (Martzloff 1997: 140), and indeed, just as in the first part of Problem 3, where differences of dimensions are given, this part is far from real practice, for the volume of a dam is not calculated from the amount of labour expended. However, the next part of the problem uses much the same methods, and is much closer to the needs of administrators of public works like Xu Shang and Zu Xuan.

The contributions of each county


We now encounter a semi-realistic situation in which the labour used is given and the dimensions of a construction are to be calculated. The counties build on the dyke in turn, starting from the eastern end, as seen in the figure. First the volume of County A’s contribution is calculated from the number of labourers sent:

VA = 4,960 cun3 / man × 6724 men = 33,351,040 cun3

Then the length lA of the county’s contribution is calculated. This is a root of the cubic equation



K5 = (b2b1)( h2h1) = 192,200 cun2



lA3 + 3298 2/31 lA2 + 2474941 29/31 lA = 23,987,761,548 12/31 cun3

lA = 1,920 cun ≈ 58 metres

(The other dimensions are calculated by considering similar triangles.)

The administrator can hereafter mark out the end-point of the construction which County A’s labourers must reach before they are finished and may return home. Presumably the detailed organization of this labour is the responsibility of local officers of the county.

The dimensions of the contributions of Counties B, C, and D are calculated by the same method.

The cubic equation given above seems to have been derived by a volume dissection something like this:



Correspondents have suggested to me that books like the Jiuzhang suanshu and Jigu suanjing could not seriously have functioned as textbooks, for problems like the ones translated here are not really practical problems. Even the last problem above, which looks more practical than the others, is not a real-world problem, for real dykes follow terrain rather than being strictly rectilinear. Labour forces might also be expected to  be  more differentiated – note the many different categories of workers in the 1840 drawing above.

But this view appears to follow from a misunderstanding of the way textbooks function. Take for example a problem from a modern calculus textbook for engineers (I have unfortunately forgotten which):

...What relation between the height and the diameter of a tin can minimizes the amount of material used for a given volume?

Answer: height = diameter.

This is not at all a real-world problem: the form of a tin can is determined by all manner of considerations, among which the cost of materials is barely significant. Try this Google search to see some of the variety of forms of tin cans in daily use. But the techniques used to solve the problem are important for any engineer, and they are best taught using such simple ‘unreal’ problems.

Similarly, it is not reasonable to expect in an ancient Chinese mathematics textbook a realistic description of the planning of an actual dyke or canal, including all of the complications that arise from the particular characteristics of the terrain, the labour force, and much else. But historical sources, some of which have been cited above, suggest that the techniques taught in these books were in fact used by officials responsible for organizing public works.

A handbook of river conservancy, 11th–14th century

A book of the Song and Yuan periods shows the sort of calculations which river conservancy officials in this time were expected to carry out. Hefang tongyi 河防通議, ‘Comprehensive discussion of Yellow River conservancy’, was originally written by Shen Li 沈立 in the 11th century and extensively edited by Shakeshi 沙克什 in the 14th century. Discussions in the book include the history of the Yellow River, the administrative organs responsible for its control, engineering details concerning the construction of walls, dykes, and canals, and a whole chapter devoted to labour norms for various types of work. A final chapter on ‘calculation’, Suanfa 算法, gives 27 calculation problems.

Labour calculations

In the fifth of these problems we see a fairly simple calculation concerning labour:

Suppose 15,350 bundles of straw [shaocao 梢草] are to be carried on foot to a site. The carrying cost has been set to 244 coins per 100 li 里 [56 km] and 100 jin [60 kg]. Each bundle weighs 15 jin [9 kg], and the distance to the site is 90 li. How much is the total carrying cost?

Answer: 505 strings [of 1,000 coins] and 629 coins.

Method: Lay out the carrying cost for 100 li, 244 coins. Multiply by 90 li,  obtaining 21 strings and 960 coins. Divide by 100 li, obtaining 219.6 coins for 90 li, the carrying cost for 100 jin. Divide by 100 jin, obtaining 2.196 coins, the carrying cost for one jin. Multiply [tong 通] by 15 jin per bundle, obtaining 32.94 [coins], the carrying cost for one bundle. Multiply by the total quantity of straw; the result is the answer.

This calculation is


Volume calculations

Several other problems concern calculations with volumes. The most interesting of these is the last, in which the length of a part of a canal constructed by one group of labourers is to be calculated. See Wagner 2012 for details; briefly, the dimensions and the volume, V, of the whole canal are given. From simple labour data the volume of the ‘cut’ at the western end, W, can be calculated, and the length of the cut, x, is to be calculated.



The given quantities are:

V = 23,625,000 chi3

W = 5,778,000 chi3

l = 500 bu = 2,500 chi ≈ 780 metres

a1 = 1040 chi

a2 = 890 chi

b1 = 1,000 chi

b2 = 850 chi

d = 1 zhang = 10 chi

The length of the cut is a root of the equation

15x2 + 94,500x = 2W = 11,556,000 chi3

x = 120 bu

No doubt this result could have been arrived at using the sort of volume dissections which we have seen above in the Jigu suanjing, but here a more advanced method is used, the algebraic system generally referred to as tian yuan yi 天元一. In this system the coefficients of polynomials are represented with rods on the counting board in the same way as had long been done in the Chinese version of Horner’s method, and are manipulated in much the same way as we manipulate equations algebraically; see Wagner 2012 for details (and for a discussion of a philological problem which has been ignored here). The quadratic equation above is represented like this:


Concluding remarks

We have seen here two astronomers, Xu Shang and Zu Xuan, whose official duties included the organization of public works. A later example is the famous astronomer Guo Shoujing 郭守敬 (1231–1316). He was one of the leading figures in the major astronomical reform of 1280, but throughout his career he held posts concerning the maintenance of waterways. It may be that the reason for this connection between astronomy and public works is that both fields require the organization of large quantities of data in their calculations.

The three mathematical texts discussed above include many problems concerning, on the one hand, volumes and dimensions of solids, and on the other, labour norms and costs. We may also note the specific mention in the source of Xu Shang’s ability to ‘estimate the labour required’.

To repeat what has already been suggested above, it is likely that the actual detailed design of a dyke or canal or other large project would have been the responsibility of local officials, but that the overall organization of the project, which would have required workers and materials from more than one jurisdiction, was the responsibility of officials at a higher level of the bureaucracy. It is these higher officials whom we can see in the historical sources. Among their specific tasks were the calculation of volumes of earth and the organization of the workers involved, and these two types of calculation are richly represented in the extant mathematical texts used in their training.


Bielenstein, Hans. 1980. The bureaucracy of Han times.  (Cambridge studies in Chinese history, literature and institutions). Cambridge: Cambridge University Press. 

Chemla, Karine, and Guo Shuchun. 2004. Les neuf chapitres: Le classique mathématique de la Chine ancienne et ses commentaires. Paris: Dunod. 

Guo Shuchun 郭书春. 1997. ‘“Hefang tongyi – Suanfa men” chutan’ «河防通议»初探 (Notes on the mathematical chapter of Hefang tongyi). Ziran kexue shi yanjiu 自然科学史研究 (‘Studies in the history of natural sciences’) 16.3: 223–232. English abstract, pp. 231–232.

Guo Tao 郭涛. 1994. ‘Shuxue zai gudai shuili gongcheng zhong de yingyong – «Hefang tongyi · Suanfa» de zhushi yu fenxi’ 数学在古代水利工程中的应用—«河防通议•算法»的注释与分析 (The use of mathematics in ancient water-control engineering: analysis of the mathematical chapter of Hefang tongyi). Nongye kaogu 农业考古 (‘Agricultural archaeology’) 1994.1: 271–278, 285.

Han shu. 1962.  漢書. Beijing: Zhonghua Shuju 中華書局. 12 vols.

Hanyu da cidian. 1986–93.  漢語大詞典. Shanghai: Hanyu Da Cidian Chubanshe 漢語大詞典出版社. 12 vols. + index.

Hucker, Charles O. 1985. A dictionary of official titles in Imperial China. Stanford: Stanford University Press. 

Jiu Tang shu. 1975.  舊唐書. Shanghai: Zhonghua Shuju 中華書局. 

Lim, Tina Su-lyn 林淑鈴, and Donald B. Wagner. 2013. ‘The Grand Astrologer’s platform and ramp: Four problems in solid geometry from Wang Xiaotong’s “Continuation of ancient mathematics” (7th century AD)’. Historia Mathematica 40.1: 3–35. Preprint

———. forthcoming. ‘Wang Xiaotong on right triangles: Six problems from ‘Continuation of ancient mathematics’ (7th century AD)’. East Asian science, technology, and medicine. Preprint

Liang shu. 1973.  梁書. Beijing: Zhonghua Shuju 中華書局. 

Loewe, Michael, ed. 1993. Early Chinese texts: A bibliographical guide. Berkeley: Society for the Study of Early China & Institute of East Asian Studies, University of California. 

Loewe, Michael. 2000. A biographical dictionary of the Qin, Former Han and Xin periods (221 BC – AD 24).  (Handbuch der Orientalistik 60). Leiden, Boston, Köln: Brill. 

Martzloff, Jean-Claude. 1997. A history of Chinese mathematics. Tr. by Stephen S. Wilson. Berlin / Heidelberg: Springer-Verlag. ‘Corrected second printing’, 2006. Orig. Histoire des mathémathiques chinoises, Paris: Masson, 1987.

Nan shi. 1975.  南史. Beijing: Zhonghua Shuju 中華書局. 

Needham, Joseph. 1971. Science and civilisation in China. Vol. 4, part 2: Civil engineering and nautics. Cambridge: Cambridge University Press. 

Qian Baocong 錢寶琮, ed. 1963. Suanjing shi shu 算經十書 (Ten mathematical classics). Beijing: Zhonghua Shuju.

de Rachewiltz, Igor, Hok-lam Chan, Hsiao Ch’i-ch’ing, and Peter W. Geier, eds. 1993. In the service of the Khan: Eminent personalities of the early Mongol-Yüan period (1200–1300). Wiesbaden: Harrassowitz. HPY-GuoShoujing.pdf

Shen Kangshen 沈康身, John N. Crossley, and Anthony W.-C. Lun. 1999. The nine chapters on the mathematical art: Companion and commentary. Oxford / Beijing: Oxford University Press / Science Press.

Sivin, Nathan. 2009. Granting the seasons: The Chinese astronomical reform of 1280, with a study of its many dimensions and a translation of its records 授時曆叢考.  (Sources and studies in the history of mathematics and physical sciences ). New York: Springer. 

Todd, O. J. 1949. ‘The Yellow River Reharnessed’. Geographical Review 39.1: 38–56. 

Wagner, Donald B. 1978. ‘Liu Hui and Tsu Keng-chih on the volume of a sphere’. Chinese science 3: 59–79.

Wagner, Donald B. 1993. Iron and steel in ancient China.  (Handbuch der Orientalistik, vierte Abteilung: China 9). Leiden: Brill. 

———. 2012. ‘Another ignorant editor? Note on a mathematical problem in a 14th-century Chinese treatise on river conservancy’.

Xin Tang shu. 1975.  新唐書. Shanghai: Zhonghua Shuju 中華書局.