Mei Juecheng was the grandson of Mei Wending. He learnt mathematics at Baoding, a city near Beijing which was a provincial capital and also a centre of culture. The Emperor Kangxi had come to power in 1661 when only seven years of age. Once he had become old enough to rule on his own he worked hard to promote learning. He was keen on both Chinese learning and the new European learning brought to China by the Jesuit missionaries. Two key players in the development of mathematics in China around this time are Yunzhi, the Emperor Kangxi's third son, and Li Guangdi who was a minister and mathematical scholar who the Emperor Kangxi had appointed to teach his sons. Mei Juecheng and Li Guangdi's son had both been taught mathematics at Baoding by Mei Wending and so Mei Juecheng's mathematical skills were known to the highest officials in the land.
The Emperor Kangxi himself had studied mathematics from 1689 to 1692 and realised that there was a lack of talented Chinese mathematicians at this time. He asked Li Guangdi to find the best mathematics books and in 1703 Li gave the Emperor Kangxi a copy of Lixue yiwen (Inquiry on Mathematical Astronomy) written by Mei Wending in 1701. Emperor Kangxi was greatly interested and summoned Mei Wending to an audience in 1703. By this time Mei Wending was seventy years old and he went to Baoding to meet Emperor Kangxi taking his grandson Mei Juecheng with him. From this time on Mei Juecheng played a major role in the compilation of mathematical and astronomical works. This became an important project under the Emperor Kangxi who had been advised that both Chinese and European mathematics texts should be compiled into a major encyclopaedia. Li Guangdi and the Emperor's son Yunzhi were both part of an editorial team comprising largely of men trained by either Li Guangdi or Mei Wending.
Of course there was much resistance to the new European learning brought by the Jesuits and the Chinese looked to be able to accept this material without making China feel inferior to Europe in learning. The acceptance of European learning was eased by the hypothesis that it was all of Chinese origin. This was set out by Mei Juecheng in 1710 when he wrote :-
Lately I served at the Imperial Court, receiving from His Majesty the Emperor Kangxi, a work on the 'Jie-fang-gen' [algebra], together with an Imperial Edict, saying that "the people from the Western Ocean name this method as 'A-er-re-ba-da' which can be translated into Chinese as 'Tong-lai-fa' (Method from the East)." Respectfully I read it and found its method extraordinary, capable of serving as a guide to mathematics. However, realizing its method to be very similar to that of 'Tian-yuan-i', I reexamined the 'Shou-shi-li-cao' ... and found out that although the terminology is different, actually the two systems are the same. During the Yuan dynasty, scholars, whether they were composing books on mathematics, or whether they were regulating mathematics, were all dealing with this subject of algebra. Somehow, for reasons unknown, its trace has been lost. Fortunately, from the distant people [the Jesuits], we have re-discovered the old subjects. Still, they have not forgotten where the term 'Tong-lai-fa' comes from.
Mei Juecheng was appointed as Court Mathematician in 1712. In the following year the Emperor Kangxi established the Mengyangzhai (the Academy of Mathematics) and Mei Juecheng joined the team of people working on the compilation Yuzhi shuli jingyun (Treasury of Mathematics) which was published in 1723. Unlike earlier efforts in compiling encyclopaedias of mathematical knowledge, no Jesuits were involved in this work. Mei Juecheng and Chen Houyao (1648-1722) were the chief editors and they were assisted by He Guozong, Ming Antu and, in the early stages of the project, by Mei Wending. Qi Han writes  that this work:-
... reapportioned credit to Chinese scholars for many discoveries that earlier Jesuit-Chinese compendiums had credited to Europeans. In particular, studying Western algebra enabled Mei Juecheng to decipher older Chinese mathematical treatises from the Song (920-1279) and Yuan (1206-1368) dynasties whose methods had been lost. This led him to expound a theory of the Chinese origin of Western knowledge. While now acknowledged as grossly overstated, his views helped to revive interest in traditional Chinese mathematics and remained highly influential for many decades.
Benjamin Elman writes :-
Altogether the emperor recruited more than one hundred scholars ... to join the Academy of Mathematics. ... In addition to those in the Academy of Mathematics, who studied mathematics, astronomy, and music, a large number of instrument makers were hired for the technical needs of the new academy. A team of fifteen calculators verified the computations based on the theoretical notions, mathematical techniques and applications, and numerical tables in the first part of the Treasury. Patterned after mathematical textbooks used in Jesuit Colleges, the Treasury introduced European algebra. The last part had a section on logarithms to base 10 and drew on the methods used in Briggs's 1624 'Arithmetica Logarithmica' to compute decimal logarithms. Although Briggs's work had been introduced in 1653, the 'Treasury' explained the use of logarithms in greater detail, and it also included tables for sines, cosines, tangents, cotangents, secants, and cosecants for every ten seconds up to ninety degrees, as well as a list of prime numbers and a log table of integers from 1 to 100,000 calculated to 10 decimal places.
In fact the Treasury of Mathematics was part of a larger project, the Luli yuanyuan (Sources of Musical Harmonics and Mathematical Astronomy). Also included in the Sources was the Compendium of Observational and Computational Astronomy. Again Mei Juecheng was the leading academic in this project which, like the Treasury, followed the style of European works. The first part was a general introduction to mathematical astronomy but then Mei Juecheng was able to make use of his grandfather Mei Wending's study of the motion of the moon to provide improved predictions of eclipses of the moon. By accepting the best of European and Chinese astronomical data, the Sources surpassed both.
In 1759 Mei Juecheng published Chishui yizhen (Pearls recovered from the Red River). This contained the infinite series expansion for sin(x) which was discovered by James Gregory and Isaac Newton. In fact the Jesuit missionary Pierre Jartoux (1669-1720) (known in China as Du Demei) introduced the infinite series for the sine into China in 1701 and it was known there by the name 'formula of Master Du'. In fact Pearls recovered from the Red River was one of two chapters that Mei Juecheng appended to the works of Mei Wending that he was editing and republishing. In this chapter, Jean-Claude Martzloff writes :-
[Mei Juecheng] reflects on various subjects (units of length in the classics, a formula of spherical trigonometry, comparison between the algebra of the 'jiegenfang' and the Chinese medieval algebra of the 'tianyuan', geometrical construction of the golden ratio, etc.). He also shows how to calculate:
(a) the length of the circumference given its diameter
(b) the sine of an arc (zhengxian )
(c) the versed sine of an arc (zhengshi )
using infinite series which he does not prove and refers to as "formulas from the Western scholar Du Demei."
Mei Juecheng compiled and edited Mei Wending's written commentaries publishing them as Mei shi congshu jiyao (Collected Works of the Mei Family) in 1761. Important work of Mei Wending on mathematics published in this collection included: Bisuan (Pen Calculations), Chou suan (Napier's bones), Du suan shi li (Proportional Dividers), Shao guang shi yi (Supplement to 'What Width'), Fang cheng lun (Theory of Rectangular Arrays), Gougu ju yu (Right-angled Triangles), Jihe tong jie (Explanations in Geometry), Ping san jiao ju yao (Elements of Plane Trigonometry), Fang yuan mi ji (Squares and Circles, Cubes and Spheres), Jihe bu bian (Supplement to Geometry), Hu san jiao ju yao (Elements of Spherical Trigonometry), Huan zhong shu chi (Geodesy), and Qiandu celiang (Surveying Solids).
Article by: J J O'Connor and E F Robertson