Jiu Zhang Suan Shu and

the Gauss Algorithm for Linear Equations

Ya-xiang Yuan

2010 Mathematics Subject Classification: 01A25, 65F05

Keywords and Phrases: Linear equations, elimination, mathematics history, ancient China

Jiu Zhang Suan Shu, or The Nine Chapters on the Mathematical Art, is an ancient Chinese mathematics book, which was composed by several generations of scholars from the tenth to the second century BC. Liu Hui (225–295), one of the greatest mathematicians of ancient China, edited and published The Nine Chapters on the Mathematical Art (Jiu Zhang Suan Shu) in the year 263. In the preface of that book [5], Liu Hui gave a detailed account of the history of the book, including the following sentences:

When Zhou Gong^{1} set up the rules for ceremonies, nine branches of mathematics were emerged, which eventually developed to the Nine Chapters of the Mathematical Art. Brutal Emperor Qin Shi Huang^{2} burnt books, damaging many classical books, including the Nine Chapters. Later, in Han Dynasty, Zhang Cang^{3} and Geng Shou Chang were famous for their mathematical skills. Zhang Cang and others re-arranged and edited the Nine Chapters of Mathematical Art based on the damaged original texts.

From what Liu Hui recorded, we can clearly infer that Zhang Cang played an important role in composing The Nine Chapters of Mathematical Art, and that the current version of the book remains more or less the same as it was in the 2nd century BC, but may not be the same as it had been before the Qin Dynasty.

The contents of The Nine Chapters of Mathematical Art are the followings:

1Zhou Gong, whose real name was Ji Dan, was the fourth son of the founding King of the Zhou Dynasty, Zhou Wen Wang (C. 1152BC – 1056BC).

2Qin Shi Huang (259BC – 210BC) was the first emperor of China, whose tomb in XiAn is famous for its annex Terracotta Army.

3Zhang Cang (256BC – 152BC), was a politician, mathematician and astronomer. He was once the prime minister of Western Han.

Documenta Mathematica · Extra Volume ISMP (2012) 9–14

Figure 1: Liu Hui (225–295)

• Chapter 1, Fang Tian (Rectangular field).

• Chapter 2, Su Mi (Millet and rice).

• Chapter 3, Cui Fen (Proportional distribution).

• Chapter 4 Shao Guang (Lesser breadth).

• Chapter 5, Shang Gong (Measuring works).

• Chapter 6, Jun Shu (Equitable transportation).

• Chapter 7, Ying Bu Zu (Surplus and deficit).

• Chapter 8, Fang Cheng (Rectangular arrays).

• Chapter 9, Gou Gu (Base and altitude).

Many elegant mathematical techniques are discussed in The Nine Chapters on the Mathematical Art. For example, Chapter 9 is about problems of measuring length or height of objects by using properties of right-angled triangles. The main theorem of Chapter 9 is the Gou Gu theorem, which is known in the West as the Pythagorean theorem.

Chapter 8 of the book, Fang Cheng, is dedicated to solve real-life problems such as calculating yields of grain, numbers of domestic animals, and prices of different products by solving linear equations. There are 18 problems in the chapter. Problem 13 is essentially an under-determined linear system (6 variables and 5 equations), the other 17 problems are problems which can be formulated as well-defined linear equations with variables ranging from 2 to 5.

Figure 2: Problem 1, Chapter 8 of Jiu Zhang Suan Shu

The technique given in the chapter for solving these problems is elimination, which is exactly the same as the so-called Gauss elimination in the West. For example, Problem 1 in the chapter states as follows:

Problem I. There are three grades of grain: top, medium and low. Three sheaves of top-grade, two sheaves of medium-grade and one sheaf of low-grade are 39 Dous^{4}. Two sheaves of top-grade, three sheaves of medium-grade and one sheaf of low-grade are 34 Dous. One sheaf of top-grade, two sheaves of medium-grade and three sheaves of low-grade are 26 Dous. How many Dous does one sheaf of top-grade, medium-grade and low-grade grain yield respectively?

In the book, the solution is given right after the problem is stated. Afterwards, Liu Hui gave a detailed commentary about the algorithm for solving the problem. The algorithm described in the book is as follows.

Putting three sheaves of top-grade grain, two sheaves of mediumgrade grain, and one sheaf of low-grade grain and the total 39 Dous in a column on the right, then putting the other two columns in the middle and on the left.

4Dou, a unit of dry measurement for grain in ancient China, is one deciliter.

Documenta Mathematica · Extra Volume ISMP (2012) 9–14

This gives the following array:

1 2 3
2 3 2
3 1 1
26 34 39

Then, the algorithm continues as follows.

Multiplying the middle column by top-grade grain of the right column, then eliminating top-grade grain from the middle column by repeated subtracting the right column.

This gives the following tabular:

\begin{matrix}1 & 2 × 3 & 3 \\ 2 & 3 × 3 & 2 \\ 3 & 1 × 3 & 1 \\ 26 & 34 × 3 & 39 \end{matrix} ⟹ \begin{matrix}1 & 6 − 3 − 3 & 3 \\ 2 & 9 − 2 − 2 & 2 \\ 3 & 3 − 1 − 1 & 1 \\ 26 & 102 − 39 − 39 & 39 \end{matrix} ⟹ 1  3 2 5 2 3 1 1 26 24 39

From the above tabular, we can see that the top position in the middle column is already eliminated. Calculations in ancient China were done by moving small wood or bamboo sticks (actually, the Chinese translation of operational research is Yun Chou which means moving sticks), namely addition is done by adding sticks, and subtraction is done by taking away sticks. Thus, when no sticks are left in a position (indicating a zero element), this place is eliminated. The algorithm goes on as follows.

Similarly, multiplying the right column and also doing the subtraction.

The above sentence yields the following tabular:

\begin{matrix}1 × 3 − 3 & & 3 \\ 2 × 3 − 2 & 5 & 2 \\ 3 × 3 − 1 & 1 & 1 \\ 26 × 3 − 39 & 24 & 39 \end{matrix}  ⟹  3 4 5 2 8 1 1 39 24 39

Then, multiplying the left column by medium-grade grain of the middle column, and carrying out the repeated subtraction.

\begin{aligned}& & 3 \\ 4 × 5 − 5 × 4 & 5 & 2 \\ 8 × 5 − 1 × 4 & 1 & 1 \\ 39 × 5 − 24 × 4 & 24 & 39 \end{aligned}  ⟹  3 5 2 36 1 1 99 24 39

Now the remaining two numbers in the left column decides the yield of low-grade grain: the upper one is the denominator, the lower one is the numerator.

Figure 3: Algorithm descriptions, Chapter 8 of Jiu Zhang Suan Shu

Thus, the yield of low-grade grain = 99/36 = 2\frac{3}{4} Dous. The algorithm continues as follows.

Now, to obtain the yield of medium-grade grain from the middle column, the denominator is the top number, and the numerator is the bottom number minus the middle number times the yield of lowgrade grain.

Therefore, the yield of medium-grade grain = [24 − 1 × 2\frac{3}{4}]/5 = 4\frac{1}{4} Dous.

To calculate the yield of top-grade grain by the right column, the denominator is the top number, and the numerator is the bottom number minus the second number times the yield of medium-grade grain and the third number times the yield of low-grade grain.

Consequently, the yield of top-grade grain = [39 − 2 × 4\frac{1}{4} − 1 × 2\frac{3}{4}]/3 = 9\frac{1}{4} Dous.

It is easy to see that the above procedure is exactly the same as the Gauss elimination [2] for the following linear equations:

3x + 2y + z = 39
2x + 3y + z = 34
x + 2y + 3z = 26

The only difference is the way in which the numbers are arranged in the arrays. To be more exact, if we rotate all the above rectangular arrays anti-clockwise 90 degree, we obtain the corresponding matrices of the Gauss elimination. This is not unexpected, as in ancient China, people wrote from top to bottom, and then from right to left, while in the West, people write from left to right and then from top to bottom.

Thus, from the algorithm description in Chapter 8 of The Nine Chapters on the Mathematical Art, we conclude that the Gauss elimination was discovered at least over 2200 years ago in ancient China. Recently, more and more western scholars [1, 6] credit this simple yet elegant elimination algorithm to ancient Chinese mathematicians. For detailed history of the Gauss elimination, there are two very good review papers [3, 4], where many interesting stories are told.

Acknowledgement. I would like to my colleague, Professor Wenlin Li for providing all the pictures used in this article.

References

[1] P. Gabriel, Matrizen Geometrie Lineare Algebra, Birkhäuser, 1997.

[2] G.H. Golub and C.F. Van Loan, Matrix Computations (3rd ed.), Johns Hopkins, 1996.

[3] J.F. Grcar, How ordinary elimination became Gaussian elimination, Historia Mathematica 38:(2), 163–218, 2011.

[4] J.F. Grcar, Mathematicians of Gaussian elimination, Notices of the American Mathematical Society, 58:(6), 782–792, 2011.

[5] H. Liu, Jiu Zhang Suan Shu Zhu, (in Chinese), 263.

[6] C.D. Meyer, Matrix Analysis and Applied Linear Algebra, SIAM, 2000.

Ya-xiang Yuan

Academy of Mathematics and Systems Science Chinese Academy of Sciences Zhong Guan Cun Donglu 55 Beijing 100190 China

                    yyx@lsec.cc.ac.cn