Jiuzhang Suanshu Fangcheng 1

## **Problem**

答曰：上禾一秉，九斗、四分斗之一，中禾一秉，四斗、四分斗之一，下禾一秉，二斗、四分斗之三。

方程術曰：置上禾三秉，中禾二秉，下禾一秉，實三十九斗，於右方。中、左禾列如右方。以右行上禾遍乘中行而以直除。又乘其次，亦以直除。然以中行中禾不盡者遍乘左行而以直除。左方下禾不盡者，上為法，下為實。實即下禾之實。求中禾，以法乘中行下實，而除下禾之實。餘如中禾秉數而一，即中禾之實。求上禾亦以法乘右行下實，而除下禾、中禾之實。餘如上禾秉數而一，即上禾之實。實皆如法，各得一斗。

Answer: 1 bundle of top-grade millet is

9

1
4

{\displaystyle 9 \frac{1}{4} }

 *dou*; 1 bundle of medium-grade millet is

4

1
4

{\displaystyle 4 \frac{1}{4} }

*dou*; 1 bundle of low-grade millet is

2

3
4

{\displaystyle 2 \frac{3}{4} }

*dou*.

*Fang cheng* method: Set on the right side 3 bundles of top-grade millet, 2 bundles of medium-grade millet, 1 bundle of low-grade millet, and their total is 39 *dou*. Set the middle and left columns of millet just like the one on the right column. Use the number of top-grade millet in the right column to multiply the middle column, and then directly subtract (直除 *zhi chu*). Again multiply the next column by the number of top-grade millet, and then directly subtract. The left column is eliminated. Likewise use the remaining number of medium-grade millet in the middle column to multiply the left column, and directly subtract. On the left side, the lower-grade millet has not been eliminated yet. Let the number of upper-grade millet be the divisor, and the number of lower-grade millet be the dividend. The dividend is the total amount of low-grade millet. To find the amount of medium-grade millet, use the divisor [of the left column] to multiply the total amount at the bottom of the middle column, and then subtract the total amount of low-grade millet. The difference divided by the number of bundles of medium-grade millet gives the total amount of medium-grade millet. To find the amount of top-grade millet, also use the divisor [of the left column] to multiply the total amount at the bottom of the right column, and then subtract the total amounts of low-grade millet and the medium-grade millet. The difference divided by the number of bundles of top-grade millet gives the total amount of top-grade millet. Divide the *shi* by their divisors respectively, which gives the each amount in *dou*.

## **Solution**

This problem is characterized by the system of simultaneous linear equations in three variables

{

3
x
2
y
# z
39

2
x
3
y
# z
34

x
2
y
3
# z
26

{\displaystyle \begin{cases} 3x + 2y + z = 39 \\
2x + 3y + z = 34 \\
x + 2y + 3z = 26
\end{cases} }

where

x

{\displaystyle x}

 represents 1 bundle of high-grade millet,

y

{\displaystyle y}

 represents 1 bundle of medium-grade millet,

z

{\displaystyle z}

 represents 1 bundle of low-grade millet.

According to the *fang cheng* method, the ancient Chinese mathematician would arrange counting rods to represent the coefficients of the equations in vertical columns from right to left. This is different from the horizontal arrangement in modern matrix notation. The solution below showcases a side-by-side comparison of both notations.

[

1

2

3

2

3

2

3

1

1

26

34

39

]

{\displaystyle \begin{bmatrix}
 1 & 2 & 3 \\
 2 & 3 & 2 \\
 3 & 1 & 1 \\
 26 & 34 & 39
 \end{bmatrix}
}

[

3

2

1

39

2

3

1

34

1

2

3

26

]

{\displaystyle \begin{bmatrix}
 3 & 2 & 1 & 39 \\
 2 & 3 & 1 & 34 \\
 1 & 2 & 3 & 26\\
 \end{bmatrix}
}

The first step is to eliminate the top entry in the middle column. This is achieved by scaling the entire middle column with the top entry in the right column, which is 3, and then subtract the middle column by the right column twice. The eliminated entry is then left empty.

[

1

6

3

2

9

2

3

3

1

26

102

39

]

{\displaystyle \begin{bmatrix}
 1 & 6 & 3 \\
 2 & 9 & 2 \\
 3 & 3 & 1 \\
 26 & 102 & 39
 \end{bmatrix}
}

[

1

3

2

5

2

3

1

1

26

24

39

]

{\displaystyle \begin{bmatrix}
 1 & & 3 \\
 2 & 5 & 2 \\
 3 & 1 & 1 \\
 26 & 24 & 39
 \end{bmatrix}
}

[

3

2

1

39

6

9

3

102

1

2

3

26

]

{\displaystyle \begin{bmatrix}
 3 & 2 & 1 & 39 \\
 6 & 9 & 3 & 102 \\
 1 & 2 & 3 & 26\\
 \end{bmatrix}
}

[

3

2

1

39

0

5

1

24

1

2

3

26

]

{\displaystyle \begin{bmatrix}
 3 & 2 & 1 & 39 \\
 0 & 5 & 1 & 24 \\
 1 & 2 & 3 & 26\\
 \end{bmatrix}
}

The second step is to eliminate the top entry of the left column. This is achieved by scaling the entire left column with the top entry in the right column, which is 3, and then subtract the left column by the right column.

[

3

3

6

5

2

9

1

1

78

24

39

]

{\displaystyle \begin{bmatrix}
 3 & & 3 \\
 6 & 5 & 2 \\
 9 & 1 & 1 \\
 78 & 24 & 39
 \end{bmatrix}
}

[

3

4

5

2

8

1

1

39

24

39

]

{\displaystyle \begin{bmatrix}
 & & 3 \\
 4 & 5 & 2 \\
 8 & 1 & 1 \\
 39 & 24 & 39
 \end{bmatrix}
}

[

3

2

1

39

0

5

1

24

3

6

9

78

]

{\displaystyle \begin{bmatrix}
 3 & 2 & 1 & 39 \\
 0 & 5 & 1 & 24 \\
 3 & 6 & 9 & 78\\
 \end{bmatrix}
}

[

3

2

1

39

0

5

1

24

0

4

8

39

]

{\displaystyle \begin{bmatrix}
 3 & 2 & 1 & 39 \\
 0 & 5 & 1 & 24 \\
 0 & 4 & 8 & 39 \\
 \end{bmatrix}
}

The third step is to eliminate the second entry of the left column. This is achieved by scaling the entire left column with the second entry in the middle column, which is 5, and then subtract the left column by the right column four times. Finally reduce all the entries of the left column by 9.

[

3

20

5

2

40

1

1

195

24

39

]

{\displaystyle \begin{bmatrix}
 & & 3 \\
 20 & 5 & 2 \\
 40 & 1 & 1 \\
 195 & 24 & 39
 \end{bmatrix}
}

[

3

5

2

36

1

1

99

24

39

]

{\displaystyle \begin{bmatrix}
 & & 3 \\
 & 5 & 2 \\
 36 & 1 & 1 \\
 99 & 24 & 39
 \end{bmatrix}
}

[

3

5

2

4

1

1

11

24

39

]

{\displaystyle \begin{bmatrix}
 & & 3 \\
 & 5 & 2 \\
 4 & 1 & 1 \\
 11 & 24 & 39
 \end{bmatrix}
}

[

3

2

1

39

0

5

1

24

0

4

8

39

]

{\displaystyle \begin{bmatrix}
 3 & 2 & 1 & 39 \\
 0 & 5 & 1 & 24 \\
 0 & 4 & 8 & 39 \\
 \end{bmatrix}
}

[

3

2

1

39

0

5

1

24

0

0

36

99

]

{\displaystyle \begin{bmatrix}
 3 & 2 & 1 & 39 \\
 0 & 5 & 1 & 24 \\
 0 & 0 & 36 & 99 \\
 \end{bmatrix}
}

[

3

2

1

39

0

5

1

24

0

0

1

11
4

]

{\displaystyle \begin{bmatrix}
 3 & 2 & 1 & 39 \\
 0 & 5 & 1 & 24 \\
 0 & 0 & 1 & \frac{11}{4} \\
 \end{bmatrix}
}

From here, one uncovers the third unknown quantity

# z

11
4

=
2

3
4

{\displaystyle z = \frac{11}{4} = 2\frac{3}{4} }

. Back-substitution of this value eliminates the third entry of the middle and right columns. Solving for the second unknown quantity gives

# y

17
4

=
4

1
4

{\displaystyle y = \frac{17}{4} = 4\frac{1}{4} }

.

[

3

4

2

4

1

11

17

39

]

{\displaystyle \begin{bmatrix}
 & & 3 \\
 & 4 & 2 \\
 4 & & 1 \\
 11 & 17 & 39
 \end{bmatrix}
}

[

12

4

8

4

11

17

145

]

{\displaystyle \begin{bmatrix}
 & & 12 \\
 & 4 & 8 \\
 4 & & \\
 11 & 17 & 145
 \end{bmatrix}
}

[

3

2

1

39

0

5

0

85
4

0

0

1

11
4

]

{\displaystyle \begin{bmatrix}
 3 & 2 & 1 & 39 \\
 0 & 5 & 0 & \frac{85}{4} \\
 0 & 0 & 1 & \frac{11}{4} \\
 \end{bmatrix}
}

[

3

2

0

145
4

0

1

0

17
4

0

0

1

11
4

]

{\displaystyle \begin{bmatrix}
 3 & 2 & 0 & \frac{145}{4} \\
 0 & 1 & 0 & \frac{17}{4} \\
 0 & 0 & 1 & \frac{11}{4} \\
 \end{bmatrix}
}

Another back-substitution of

# y
4

1
4

{\displaystyle y = 4\frac{1}{4} }

 eliminates the second entry of the right column. Solving for the first unknown quantity gives

# x

37
4

=
9

1
4

{\displaystyle x = \frac{37}{4} = 9\frac{1}{4} }

.

[

12

4

4

11

17

111

]

{\displaystyle \begin{bmatrix}
 & & 12 \\
 & 4 & \\
 4 & & \\
 11 & 17 & 111
 \end{bmatrix}
}

[

4

4

4

11

17

37

]

{\displaystyle \begin{bmatrix}
 & & 4 \\
 & 4 & \\
 4 & & \\
11 & 17 & 37
 \end{bmatrix}
}

[

3

0

0

111
4

0

1

0

17
4

0

0

1

11
4

]

{\displaystyle \begin{bmatrix}
 3 & 0 & 0 & \frac{111}{4} \\
 0 & 1 & 0 & \frac{17}{4} \\
 0 & 0 & 1 & \frac{11}{4} \\
 \end{bmatrix}
}

[

1

0

0

37
4

0

1

0

17
4

0

0

1

11
4

]

{\displaystyle \begin{bmatrix}
 1 & 0 & 0 & \frac{37}{4} \\
 0 & 1 & 0 & \frac{17}{4} \\
 0 & 0 & 1 & \frac{11}{4} \\
 \end{bmatrix}
}