In 1644 the Qing dynasty seized power in China. Its Manchu elite were at first seen by most of their subjects as foreigners from beyond the Great Wall, and the consolidation of Qing rule presented significant cultural and political problems, as well as military challenges. It was the Kangxi emperor (r. 1662-1722) who set the dynasty on a firm footing, and one of his main stratagems to achieve this was the appropriation for imperial purposes of the scientific knowledge brought to China by the Jesuit mission (1582-1773). For almost two centuries, the Jesuits put the sciences in the service of evangelization, teaching and practising what came to be known as 'Western learning' among Chinese scholars, many of whom took an active interest in it. After coming to the throne as a teenager, Kangxi began his life-long intervention in mathematical and scientific matters when he forced a return to the use of Western methods in official astronomy. In middle life, he studied astronomy, musical theory and mathematics, with Jesuits as his teachers. In his last years he sponsored a great compilation covering these three disciplines, and set several of his sons to work on this project. All of this activity formed a vital part of his plan to establish Manchu authority over the Chinese. This book explains why Kangxi made the sciences a tool for laying the foundations of empire, and to show how, as part of this process, mathematics was reconstructed as a branch of imperial learning.