Liu Hui's derivation is contained in his commentary on the mathematical classic Jiuzhang suanshu ("Arithmetic in nine chapters"). This book appears to contain some very ancient materiel, but probably reached its present form in the second half of the first century A.D. [Qian 1964, 32-33]; it is the oldest extant Chinese mathematical book. The only historical data available on Liu Hui and his edition of the Jiuzhang suanshu is the date 263 A.D., given in a source written four centuries later [Jin shu 1974, 491; Sui shu 1973, 409]. This date is presumably that of a now-lost preface or colophon in an edition in circulation in the seventh century.
There is some reason to suspect that the commentary attributed to Liu Hui is in fact a conflation of two or more commentaries (a detailed argument has been given in Wagner [1978b]). For example, Section 6.4 in the derivation translated below is clearly a digression and might well be a further comment on Liu Hui's comment by some later writer. It seems fairly sure, however, that the commentary attributed to Liu Hui is no later than the time of the commentator Li Chunfeng (602-670).