# Fangcheng (mathematics)

Fangcheng (sometimes written as fang-cheng or fang cheng) (Chinese: 方程; pinyin: fāngchéng) is the title of the eighth chapter of the Chinese mathematical classic Jiuzhang suanshu (The Nine Chapters on the Mathematical Art) composed by several generations of scholars who flourished during the period from the 10th to the 2nd century BC. This text is one of the earliest surviving mathematical texts from China. Several historians of Chinese mathematics have observed that the term fangcheng is not easy to translate exactly. However, as a first approximation it has been translated as "rectangular arrays" or "square arrays". The term is also used to refer to a particular procedure for solving a certain class of problems discussed in Chapter 8 of The Nine Chapters book.
The procedure referred to by the term fangcheng and explained in the eighth chapter of The Nine Chapters, is essentially a procedure to find the solution of systems of n equations in n unknowns and is equivalent to certain similar procedures in modern linear algebra. The earliest recorded fangcheng procedure is similar to what we now call Gaussian elimination.
The fangcheng procedure was popular in ancient China and was transmitted to Japan. It is possible that this procedure was transmitted to Europe also and served as precursors of the modern theory of matrices, Gaussian elimination, and determinants. It is well known that there was not much work on linear algebra in Greece or Europe prior to Gottfried Leibniz's studies of elimination and determinants, beginning in 1678. Moreover, Leibniz was a Sinophile and was interested in the translations of such Chinese texts as were available to him.

## On the meaning of fangcheng

There is no ambiguity in the meaning of the first character fang. It means "rectangle" or "square." But different interpretations are given to the second character cheng:
* The earliest extant commentary, by Liu Hui, dated 263 CE defines cheng as "measures," citing the non-mathematical term kecheng, which means "collecting taxes according to tax rates." Liu then defines fangcheng as a "rectangle of measures." The term kecheng, however, is not a mathematical term and it appears nowhere else in the Nine Chapters. Outside of mathematics, kecheng is a term most commonly used for collecting taxes.
* Li Ji's "Nine Chapters on the Mathematical Arts: Pronunciations and Meanings" also glosses cheng as "measure," again using a nonmathematical term, kelü, commonly used for taxation. This is how Li Ji defines fangcheng: "Fang means [on the] left and right. Cheng means terms of a ratio. Terms of a ratio [on the] left and right, combining together numerous objects, therefore [it] is called a "rectangular array"."
* Yang Hui's "Nine Chapters on the Mathematical Arts with Detailed Explanations" defines cheng as a general term for measuring weight, height, and length. Detailed Explanations states: What is called "rectangular" (fang) is the shape of the numbers; "measure" (cheng) is the general term for [all forms of] measurement, also a method for equating weights, lengths, and volumes, especially referring to measuring clearly and distinctly the greater and lesser.
Since the end of the 19th century, in Chinese mathematical literature the term fangcheng has been used to denote an "equation." However, as already noted, the traditional meaning of the term is very different from "equation."

## Contents of the chapter titled Fangcheng

The eighth chapter titled Fangcheng of the Nine Chapters book contains 18 problems. (There are a total of 288 problems in the whole book.) Each of these 18 problems reduces to a problem of solving a system of simultaneous linear equations. Except for one problem, namely Problem 13, all the problems are determinate in the sense that the number of unknowns is same as the number of equations. There are problems involving 2, 3, 4 and 5 unknowns. The table below shows how many unknowns are there in the various problems:
Table showing the number of unknowns and number of equations in the various problems in Chapter 8 of Nine Chapters :
| Number of unknowns in the problem | Number of equations in the problem | Serial numbers of problems | Number of problems | Determinacy |
| 2 | 2 | 2, 4, 5, 6, 7, 9, 10, 11 | 8 | Determinate |
| 3 | 3 | 1, 3, 8, 12, 15, 16 | 6 | Determinate |
| 4 | 4 | 14, 17 | 2 | Determinate |
| 5 | 5 | 18 | 1 | Determinate |
| 6 | 5 | 13 | 1 | Indeterminate |
| | | Total | 18 |
The presentations of all the 18 problems (except Problem 1 and Problem 3) follow a common pattern:
* First the problem is stated.
* Then the answer to the problem is given.
* Finally the method of obtaining the answer is indicated.

### On Problem 1

* Problem:
** 3 bundles of high-quality rice straws, 2 bundles of mid-quality rice straws and 1 bundle of low-quality rice straw produce 39 units of rice
** 2 bundles of high-quality rice straws, 3 bundles of mid-quality rice straws and 1 bundle of low-quality rice straw produce 34 units of rice
** 1 bundles of high-quality rice straw, 2 bundles of mid-quality rice straws and 3 bundle of low-quality rice straws produce 26 units of rice
** Question: how many units of rice can high, mid and low quality rice straw produce respectively?
* Solution:
** High-quality rice straw each produces ⁠9+1/4⁠ units of rice
** Mid-quality rice straw each produces ⁠4+1/4⁠ units of rice
** Low-quality rice straw each produces ⁠2+3/4⁠ units of rice
The presentation of Problem 1 contains a description (not a crisp indication) of the procedure for obtaining the solution. The procedure has been referred to as fangcheng shu, which means "fangcheng procedure." The remaining problems all give the instruction "follow the fangcheng" procedure sometimes followed by the instruction to use the "procedure for positive and negative numbers".

### On Problem 3

There is also a special procedure, called "procedure for positive and negative numbers" (zheng fu shu) for handling negative numbers. This procedure is explained as part of the method for solving Problem 3.

### On Problem 13

In the collection of these 18 problems Problem 13 is very special. In it there are 6 unknowns but only 5 equations and so Problem 13 is indeterminate and does not have a unique solution. This is the earliest known reference to a system of linear equations in which the number of unknowns exceeds the number of equations. As per a suggestion of Jean-Claude Martzloff, a historian of Chinese mathematics, Roger Hart has named this problem "the well problem."