In 1768 Lexell was invited to St Petersburg. The St Petersburg Academy of Sciences had been founded by Catherine I, the wife of Peter the Great, in 1725 and Euler had worked there since 1727. By this time Euler was getting quite old, being 62 years of age when the young mathematician Lexell arrived in 1769. However, working in the same Academy as Euler and other high quality scientists was something which Lexell found exciting and enjoyable. Euler discussed research plans with Lexell and the other mathematicians at the Academy. They shared ideas while Lexell sometimes developed further ideas suggested by Euler, sometimes calculating tables, and compiling examples. For example Lexell is given full credit on the title page for his help with Euler's 1772 publication Theoria motuum lunae, nova methodo pertractata Ⓣ.
In 1771 Lexell was appointed professor of astronomy at the St Petersburg Academy of Sciences and a few years later he was approached by the Swedish government trying to persuade him to return to Sweden. By this time Lexell had achieved quite a fine reputation as both a mathematician and astronomer and he was highly involved in the exciting work at the Academy. Knowing this, the Swedish government tried too attract him with back with a cleverly worked out offer. He would be appointed to a chair at the University of Abo immediately (this was in 1775) but since he was so involved at work being undertaken at the St Petersburg Academy he would be allowed to remain there for five years to complete the work before returning to Abo. Despite the attractive proposition, Lexell was having none of it and turned it down in favour of staying permanently in St Petersburg.
Despite wanting to remain in St Petersburg after 1780, Lexell did in fact spend two years travelling through to the mathematical centres of excellence throughout Europe, in particular visiting Germany, France and England. He returned to St Petersburg in 1782 and, following Euler's death in 1783, Lexell was appointed to succeed him to the chair of mathematics at the St Petersburg Academy of Sciences. He did not hold this chair for very long since he died in the following year.
Lexell's work in mathematics is mainly in the area of analysis and geometry. Lexell made a detailed investigation of exact equations differential equations. His work here extended a necessary condition which had been discovered earlier by Condorcet and Euler. He also gave a proof which was not based on using the calculus of variations. In addition Lexell developed a theory of integrating factors for differential equations at the same time as Euler but, although it has often been thought that he learnt of the technique from Euler, the author of  argues that he independently discovered original methods to solve problems investigated by Euler.
Lexell did work in analysis on topics other than differential equations, for example he suggested a classification of elliptic integrals and he worked on the Lagrange series. He was also the first to develop a general system of polygonometry. This is a study of polygons similar to earlier work on triangles. It involves the solution of polygons given certain sides and angles between them, their mensuration, division by diagonals, circumscribing polygons around circles and inscribing polygons in circles. His work on this topic was continued by Lhuilier.
Lexell made major contributions to spherical geometry and trigonometry. In fact trigonometry was the main tool used by Lexell in his work on polygonometry. Spherical geometry was a major tool in his astronomical studies.
Specific problems which Lexell studied in astronomy were his calculation of the solar parallax and his calculation of the orbits of several comets. One comet for which he calculated an orbit had been discovered by Messier. Lexell found that it had a period of five and a half years which made it the first comet to be discovered with a short period. He observed it pass close to Jupiter and its moons and since the moons were unaffected Lexell deduced that, despite the large size of comets, their mass was extremely low.
When William Herschel discovered a new body in the solar system on 13 March 1781, Lexell computed its orbit which showed that it was a planet (later named Uranus) twice as far from the sun as Saturn, rather than a comet as had been thought at first. Although he did not predict the position of Neptune, as did Adams and Le Verrier, Lexell's initial calculations of the orbit of Uranus showed that it was being perturbed and he deduced that the perturbations were due to another more distant planet.
Article by: J J O'Connor and E F Robertson