- Liu Hui's π algorithm
Liu Hui's π algorithm is a mathematical algorithm invented by
Liu Hui (fl. 3rd century), a mathematician ofWei Kingdom . Before his time, the ratio of the circumference of a circle to diameter was often taken experimentally as 3 in China, whileZhang Heng (78–139) rendered it as 3.1724 (from the proportion of the celestial circle to the diameter of the earth, ) or as . Liu Hui was not satisfied with ; he commented that it was too large and overshot the mark. Another mathematicianWan Fan (219–257) provided [Schepler, Herman C. (1950), “The Chronology of PI”, Mathematics Magazine 23 (3): 165–170, ISSN 0025-570X] . All these empirical π values were accurate to 2 digits (ie. 1 decimal place). Liu Hui was the first Chinese mathematician to provide a rigorous algorithm for calculation of π to any accuracy. Liu Hui's own calculation with a 96-gon provided an accuracy of 5 digits: π ≈ 3.1416.Liu Hui remarked in his commentary to the
The Nine Chapters on the Mathematical Art [Needham, Volume 3, 66. ] , that the ratio of the circumference of an inscribed hexagon to the diameter of the circle was 3, hence π must be greater than 3. He went on to provide a detailed step-by-step description of an iterative algorithm to calculate π to any required accuracy based on bisecting polygons; he calculated π to between 3.141024 and 3.142708 with a 96-gon; he suggested that 3.14 was a good enough approximation, and expressed π as 157/50; he admitted that this number was a bit small. Later he invented an ingenious quick method to improve on it, and obtained π ≈ 3.1416 with only a 96-gon, with an accuracy comparable to that from a 1526-gon. His most important contribution in this area was his simple iterative π algorithm.Area of a circle
Liu Hui argued:
"Multiply one side of a hexagon by radius, then multiply by 3, yields the area of dodecagon; if we cut a hexagon into dodecagon, mulitply its side with radius, then again multiply by 6, yields the area of 24-gon; the finer we cut the smaller the loss with respect to the area of circle, thus with further cut after cut, the area of the resulting polygon will coincide and become one with the circle, there will be no loss".
Apparently Liu Hui had already mastered the concept of limit [First noted by Japanese mathematician
Yoshio Mikami ] .: area of N-gon area of circle.Further, Liu Hui proved the area of circle = half of circumference multiplied by radius. He said
"Between a polygon and a circle, there are excess radius. Multiply the excess radius with a side of polygon. The resulting area exceeds the boundary of circle".
In the diagram "d" = excess radius. Multiplying "d" with one side results in oblong "ABCD" which exceeds the boundary of circle. If a side of polygon is so small (i.e. there is a very large number of sides) then there will be no more excess radius, hence no nore excess area.
As in the diagram, when "N" infinity, "d" 0, and "ABCD" 0.
"Multiply a side of polygon with radius, the area doubles, hence multiply half circumference with radius, yields the area of circle"."
When "N" infinity, half the circumference of "N"-gon approaches a semicircle, thus half a circumference of circle multiply by radius area of circle.Liu Hui did not explain in detail this deduction. However this is self-evident by using Liu Hui's
In-out complement principle he provided elsewhere in "The Nine Chapters on the Mathematical Art ": Cut up a geometric diagram into parts, move the parts like a jigsaw puzzle around to form another diagram, the area of the two diagrams will be identical.Thus move around the 6 green triangles 3 blue triangles and 3 red triangles into an oblong, with width = 3"L", and height "R",
:hence the area of dodecagon = ;
In general, multiplying half of the circumference of "N"-gon with radius yields area of 2"N"-gon. He used this result repetitively in his π algorithm.
Liu Hui's π inequality
Liu Hui went one step forward, and proved a π inequality with only one inscribed 2N polygon ::In the diagram, yellow area represents area of N-gon:Yellow area+ green area represents area of 2N-gon::Green area represents difference between 2N_gon and N-gon::Red area = green area =
(Yellow area+ green area )+ red area= :Let C represents area of circle:Then :
:If radius of circle =1,:Liu Hui's π inequality::
Iterative algorithm
Lui Hui began with an inscribed hexagon. Let "M" be the length of one side "AB" of hexagon, "r" is the radius of circle.
Bisect "AB" with line "OPC", "AC" becomes one side of dodecagon, let its length be "m".
"AOP", "APC" are two right angle triangles. Liu Hui used Gou Gu theorem repetitively:
: : : : :
With "R" = 10 units, he obtained
: area of 96-gon : area of 192-gon : Difference of 192-gon and 96-gon:
:
:from Liu Hui's π inequality:
:
:Since r= 10, C = :therefore:::::
He never took π as the average of the lower limit 3.141024 and upper limit 3.142704. Instead he suggested that 3.14 was a good enough approximation for π , and expressed it as a fraction ; he pointed out this number is slightly less then the real thing.
Liu Hui carried out his calculation with
rod calculus , and expressed his results with fractions. However, the iterative nature of Liu Hui's π algorithm is quite clear::
in which "m" is the length of one side of next order polygon bisected from "M", then repeat the same calculation, each step required only one addition, one square root extraction.
Begin with for hexagon:
Length of one side of successive polygons:: : : :
Area of successive polygons inscribed in a circle with radius=1.::::
Liu Hui's π algorithm can be carried through to higher order polygons to any accuracy. However, an ordinary computer spreedsheet or table top calculator has only an accuracy of 15 digits, hence it is possible at most to calculate up to 49152-gon. For example: :
::
However, with a high precision math package (accuracy up to 1000 digits), it is easy to calculate π to higher accuracy, for example:
::::
With with 1000th iteration to 6*2^1000-gon, π can be calculated to 595 digits with Liu Hui's algorithm:
A_{6*21000}gon(6.4290516431 x10^301-gon):::3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348:253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055:596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486:104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903:600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185:480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247:37190702179860943702770539217176293176752384674818467669
Quick method
Calculation of square roots of irrational numbers was not an easy task in the third century with
counting rods . Liu Hui discovered a short cut by comparing the area differentials of polygons, and found that the proportion of the difference in area of successive order polygons was approximately 1/4. [Yoshio Mikami: Ph.D. Dissertation 1932]Let "D""N" denotes the difference in areas of "N"-gon and ("N"/2)-gon
:
He found:
:
: fn|1
Hence:
:
Area of unit radius circle=
In which
:
That is all the subsequent excess areas add up amount to one third of the
: area of unit circlefn|2
Liu Hui was quite happy with this result; he said he got the same result by calculation to 1536-gon and obtained the area of 3072-gon.
This explained four questions:
1) Why he stopped short at "A"192 in his presentation of his algorithm. Because he discovered a quick method of improving the accuracy of "π", achieving same result of 1536-gon with only 96-gon. After all calculation of square roots was not a simple task with
rod calculus . With the quick method, he only needed to perform one more subtraction, one more division (by 3) and one more addition, instead of four more square root extractions.2) Why he preferred to calculate "π" through calculation of areas instead of circumferences of successive polygons, because the quick method required information about the difference in areas of successive polygons.
3) Who was the true author of the paragraph containing calculation of
:
That famous paragraph began with "A Han dynasty bronze container in the military warehouse of Jin dynasty....".
Many scholars, among them
Yoshio Mikami andJoseph Needham , believed that the "Han dynasty bronze container" paragraph was the work of Liu Hui and not Zu Chongzhi as other believed, because of the strong correlation of the two methods through area calculation, and because there was not a single word mentioning Zu's 3.1415926 < π < 3.1415927 result obtained through 12288-gon.Later developments
Liu Hui established a solid algorithm for calculation of π to any accuracy.
*Zu Chongzhi was familiar with Liu Hui's work, and obtained greater accuracy by applying his algorithm to a 12288-gon.:From Liu Hui's formula for 2N-gon:::For 12288-gon inscribed in a unit radius circle::.
:From Liu Hui's π inequality:::In which :.:Therefore:Truncated to eight significant digits::.That was the famous Zu Chongzhi π inequality.
Zu Chongzhi then used
He Chengtian 's interplolation formula and obtained an approximating fraction: .
*Yuan dynasty mathematicianZhao Yu Xin worked on a variation of Liu Hui's π algorithm, by bisecting an inscribed square instead of a hexagon.ignificance of Liu Hui's π algorithm
Liu Hui's π algorithm was one of his most important contributions to ancient Chinese mathematics. It was based on calculation of N-gon area, in contrast to the Archimedean algorithm based on polygon circumference. Archimedes used a circumscribed 96-gon to obtain an upper limit , and an inscribed 96-gon to obtain the lower limit . Liu Hui was able to obtain both his upper limit 3.142704 and lower limit 3.141024 with only an inscribed 96-gon; furthermore, both the Liu Hui limits were tighter than Achimedes's:
:
Wikimedia Foundation. 2010.