Answer
Over twenty years, Lagrange resided in Berlin, where he made significant contributions to mathematics and astronomy. His work there included developing the method of variations and Theory of secular perturbations, which had a profound impact on celestial mechanics. Lagrange's time in Berlin was a period of great intellectual growth and productivity, solidifying his legacy as one of the most influential mathematicians and astronomers of his time.