We know for certain that Gregory studied at Marischal College, part of the University of Aberdeen, between 1671 and 1675. Notice that he started his university education at the age of 12 years. There is however, no evidence that he took his degree. After his university studies David, still only 16 years old, returned to live with his family at Kinnairdy but by this time his mother had died (her death occurred in the year that he entered Marischal College). At this stage he became more interested in mathematics for after his uncle James Gregory died in October 1675 he left his papers to David's father and David began to study them carefully. Leaving Scotland in 1679, he visited several countries on the Continent, particularly the Netherlands and France, and did not return to Scotland until 1681.
While Gregory was on the Continent he took the opportunity to study mathematics, although he began his time abroad as a medical student at the University of Leiden. During his travels he studied the works of Descartes, Hudde, and Fermat but in addition to mathematical interests he also became increasing interested in physics and astronomy. He spent the spring of 1681 in London where he was invited to attend meetings of the Royal Society. He made good use of the chances that came his way and made sketches of Newton's reflecting telescope and the air pump invented by Boyle.
We have not yet mentioned Gregory's friendship with Archibald Pitcairne. Details of when the two first met are not known but they may have met while Gregory was on the Continent. Between 1681 and 1683 Gregory lived at Kinnairdy where he continued his study of James Gregory's papers. However in 1683 Pitcairne publicly challenged John Young, who had taught mathematics at Edinburgh University since James Gregory's death, as to his suitability to do so. Young certainly was a poor mathematician and Pitcairne's challenge was well founded. It led to Young being dismissed and, at the age of 24, David Gregory was appointed Professor of Mathematics at the University of Edinburgh, filling the chair previously held by his uncle.
At Edinburgh David Gregory taught some Newtonian theories but it now realised that he laid much less influence on this than was at one time thought. He is famed for this, however, since he was the first university teacher to have students who were acquainted with Newton's work. These 'modern' theories were not taught in universities until much later and at this time even Cambridge was still teaching Greek natural philosophy. He lectured at Edinburgh University on optics, geometry, mechanics and hydrostatics. His lecture notes on geometry were to form the basis of Maclaurin's Treatise of Practical Geometry which was published in 1745. Gregory himself published Exercitatio geometria de dimensione curvarum in 1684 while at Edinburgh which was an interesting work developing his uncle's work on infinite series. Gregory sent Newton a copy of his paper on infinite series, taking care to offer extensive praise to Newton. Gregory received a copy of Newton's Principia in 1687, and again he replied with a letter heaping the highest praise on the author. In  a strong case is put that the copy of the Principia now in Moscow University was the one originally owned by Gregory. It was purchased from the library of Archibald Pitcairne in 1718 and contains numerous marginal notes with annotations :-
... the analysis of these notes suggests that the copy is the one annotated by David Gregory.In 1688 there was political and religious unrest in Scotland. By 1690 all university teachers were required to swear an oath of allegiance to the new Scottish rulers, but although he refused, Gregory was not dismissed. However the difficult position he was in as an Episcopalian was certainly one of the reasons that David decided to leave for England. It was not that Gregory held strong religious views, but his background and Jacobite friends gave him difficulties. The paper  by Friesen explains the background to Gregory's move which was linked to political, religious and scientific causes. James J Tattersall, reviewing , explains Friesen's arguments:-
... why most Tory Newtonians in early eighteenth century England were Scottish instead of English. The cause can be traced back to Scottish Episcopalians, in particular David Gregory and Archibald Pitcairne, who were among the most influential and charismatic Scottish Newtonians. Scottish Episcopalians embraced Newton's natural philosophy primarily as a justification to use reason to combat the religious enthusiasm of Scottish Presbyterians. Scottish Episcopalians were more tolerant of new ideas and fearful of the fanaticism, sectarianism, and anti-intellectualism exhibited by Presbyterians. As a whole, Tories/High Churchmen in England supported passive obedience, were less tolerant, and were wary of using reason in matters of faith. As a consequence, Scotland provided a much more fertile ground for Newtonianism than England. In 1691, the year after Presbyterianism was established as the official state religion in Scotland, Gregory resigned the mathematical chair at the University of Edinburgh and assumed the Savilian Professorship of Astronomy at Oxford. ... Primarily under the influence of Gregory and Pitcairne's Scottish disciples and colleagues at Oxford, Newtonian concepts were transmitted to High-Church Anglicans. A number of Tories embraced Newton's mathematical natural philosophy, not to combat Presbyterianism and not because they were unaware that such uses of reason could undermine traditional sources of religious authority such as Scripture, but because they were convinced it offered a more structured view of how the universe operated and provided a justification of an ordered society based on hierarchy, so important to High-Church Anglicans.In 1691 Gregory, as indicated in the above quote, was elected Savilian Professor of Astronomy at Oxford. Newton was a major influence in his appointment but another factor was that his greatest rival for the post was Flamsteed and he was considered not to be suitable since he was not a religious man. We mentioned above that Gregory did not have strong religious convictions so perhaps the views of one of his contemporaries that Flamsteed was the only man (quote from ):-
... that has less religion than Dr Gregoryexplains the position rather clearly. His inaugural lecture at Oxford is reproduced in  which gives interesting background on the inverse square law of gravitation. The lecture also shows that Gregory was very happy to have left the troubles of Scotland behind him. Despite this, having received Kinnairdy from his father in 1690, he visited there most summers.
In 1692 Gregory was made a fellow of Balliol College and was awarded a degree from Oxford for a thesis on optics which he based on the lectures he had given in Edinburgh. In the same year he was elected a Fellow of the Royal Society. In 1695 he married Elizabeth Oliphant, and in the same year he published Catoptricae et dioptricae sphericae elementa which is a work on optics. It describes telescopes which were a special interest of his. He also experimented with making an achromatic telescope and describes the principles behind such lenses in the above work. At Oxford he made quite a reputation for himself as a teacher :-
He was interested in the reform of mathematics teaching and drew up several papers on this topic, none of them published. He suggested that teaching be in English rather than Latin, and emphasized practical knowledge. He was a well-liked teacher and strongly influenced several of his students, including James and John Keill and John Freind.Many leading men of this period felt that royal patronage was necessary for them to achieve the highest status within their professions. Gregory, supported by Newton, was appointed as a mathematics tutor to the young Duke of Gloucester in 1699. The young Duke was the son of Princess Anne who became Queen Anne in 1702. Again he defeated Flamsteed in a competition for this post which certainly did nothing for the relationship, already pretty cool following Flamsteed's failure to obtain the Savilian chair, between these two leading mathematical astronomers. However this was not the triumph that Gregory hoped for since the young Duke died in 1700. Had Gregory been mathematics tutor to the Queen's son when she took the throne in 1702 he would have had a position influence of the highest order.
David Gregory certainly supported Newton strongly in the Newton - Leibniz controversy arguing, as did Gregory's friend Wallis, that Leibniz had learnt of the calculus through a letter from Collins. In 1702 Gregory published Astronomiae physicae et geometricae elementa which was a popular account of Newton's theories. Originally published in Latin with a preface by Newton, the book was brought out in an English version in 1715. It continued to be influential well after Gregory's death and second editions of both the English and Latin versions were published in 1726.
In 1704 Gregory moved to London and three years later, again with Newton's support, he was appointed to the position of master of the Scottish mint. In fact 1707 marks the union of the parliaments of England and Scotland, an event which Gregory had strongly supported. It was in many ways rather surprising that it took place at all, but the English parliament saw strategic advantages and made favourable proposals, including a substantial grant, while the Scottish parliament saw major advantages in gaining free trade rights to England and its colonies. The grant which the English parliament made to Scotland, called the 'Equivalent', was to equal the share of the English national debt that Scotland would assume on the union. Gregory spent some months in Edinburgh in his role with the Scottish mint working on bringing the Scottish currency into line with that of England. He also worked on the calculation of the precise figure for the Equivalent.
Gregory's health had been poor over a number of years and he was advised to go to Bath so that he might be cured. He travelled there in 1708 but took ill on the return journey from Bath to London and stopped at the Greyhound Inn in Maidenhead. From there he summoned his friend, the doctor and fellow mathematician John Arbuthnot, but he died in the inn shortly after Arbuthnot's arrival. In fact Gregory and his wife had nine children, but seven died while still children.
Article by: J J O'Connor and E F Robertson