Robert attended Garlieston School and from there went to Fettes College, an independent school in Edinburgh. He obtained a scholarship to Clare College, Cambridge, which he entered in 1934. There he was particularly influenced by Littlewood and Ingham whose lectures he attended while taking Part III of the Mathematical Tripos. Rankin graduated in 1937 and in the same year his father became Professor of Old Testament Language, Literature and Theology at the University of Edinburgh.
At Cambridge Rankin began to undertake research in number theory under Ingham's supervision. Dalyell recalls in  that Ingham told him:-
Robert was the most serious of all my gifted pupils.The research which Rankin undertook at this time, on the difference between two successive primes, won him the Rayleigh Prize in 1939. He published four papers on The difference between consecutive prime numbers between this time and 1950.
Rankin was elected a Fellow of Clare College in 1939. In the same year he began to work with G H Hardy on the results of Ramanujan. Although Ramanujan had died nearly twenty years earlier, he had left a number of unpublished notebooks filled with theorems that Hardy and other mathematicians continued to study. Rankin did not work long on Ramanujan at this time, however, before World War II meant that he had to devote himself to war work. He did return to study Ramanujan's work and in many ways it can be seen as a continuing theme throughout his life. He wanted to join the army and become involved in the fighting but he was ordered to work for the Ministry of Supply at Fort Halstead in Kent. A mathematician of his calibre was seen to have a much more important role to play in the war effort.
At Fort Halstead Rankin worked on the development of rockets. He developed a theory to allow the trajectory of the rocket to be calculated from the initial conditions. The British Government, however, paid little attention to the work of Rankin and his team. He was transferred from Fort Halstead to Wales where he continued to work until the end of the war. Of course during the war his work on rockets was classified information, but once the war was over the information was declassified and Rankin was released early from his war service on the condition that he wrote up the theoretical work which he had done on rockets. Indeed he did write the work up as The mathematical theory of the motion of rotated and unrotated rockets and it was published in the Philosophical Transactions of the Royal Society in a paper which was longer than any previously published in that journal. Kelley, in a review of the paper, writes:-
The author makes a thorough and comprehensive study of the motion of a rocket during burning. ... The problem is to devise a mathematical theory which will, after experimental measurement of suitable constants, predict position, velocity, angular position, and angular velocity of a rocket at the end of burning from a knowledge of these and other physical data at the beginning of burning. Of necessity, since the work is intended for direct application to ballistic calculations, considerable detail is given, and this, in turn, requires a truly formidable list of notations.During the war Rankin had married Mary Llewellyn in 1942; they would have four children, one son and three daughters. Rankin returned to Cambridge with his wife in 1945 where he became a Faculty Assistant Lecturer. In 1947 he became an Assistant Tutor and then in the following year he was promoted from Assistant Lecturer to Lecturer. In 1949 he became a Praelector at Cambridge. A colleague who worked with him at Cambridge at this time recalled (see ):-
He was a conscientious teacher and had a wide interest in mathematics. Those who took the trouble to ask him serious questions were rewarded with precise and very serious answers.In 1951 Rankin left Cambridge when he was appointed Mason Professor of Pure Mathematics at Birmingham University. He was not to spend long in Birmingham for, in 1954, T M MacRobert retired from the Chair of Mathematics at the University of Glasgow and the Principal of that university tempted Rankin to move back to Scotland to fill the vacancy. Martin writes :-
Thus began a period of 28 years during which Robert's powerful intellect, exceptionally accurate memory and tremendous energy, along with his absolute integrity and unstinted devotion to duty, enabled him to render signal service to the university.Rankin wrote over 100 research papers, mostly on the theory of numbers and the theory of functions. He wrote The modular group and its subgroups published in 1969 and Modular forms and functions which was published in 1977. The former of these is described by Rankin himself in the Preface:-
This short course of lectures was given at the Ramanujan Institute for Advanced Study in Mathematics, in the University of Madras, in September 1968. The object of the course was to study the modular group and some of its subgroups, with help of algebraic rather than analytic or topological methods.Of course the connection with Ramanujan, the continuing theme we mentioned earlier, was not only that the lectures were given in the Ramanujan Institute but that The Ramanujan Institute in Madras published the book. A major historical work was Ramanujan : Letters and commentary a joint work with B C Berndt which Rankin published in 1995; it has been instantly recognised as a exceptional contribution to the history of mathematics. Earlier he had published the papers Ramanujan as a patient in 1984, and Srinivasa Ramanujan (1887-1920) in 1987. At the conference Ramanujan revisited in Urbana- Champaign, Illinois in 1987 he presented a paper on Ramanujan's t-function and its generalizations. The paper appeared in the conference proceedings of which Rankin was himself an editor. Marvin Knopp writes:-
This is an informed (and informative) account of Ramanujan's function t(n) and many of the important later developments grounded in that work. With his usual fine sense of history, [Rankin] begins the discussion, not with Ramanujan himself, but rather with the older English mathematician J W L Glaisher (born in 1848), who initiated the study of multiplicative properties of the Fourier coefficients of modular forms in his series of papers, published in 1907, dealing with ... the number of representations of n as a sum of s squares. Taking up this work where severe complications had forced Glaisher to abandon it (18 was the largest value of s he treated), Ramanujan was led to his seminal work on t(n) in investigating [the number of representations of n as a sum of 24 squares].We should note that Rankin himself had made a number of contributions to studying the number of representations of an integer as a sum of squares. Although the above comments on his publications concentrate on his historical contributions, we have only given it this slant since this aspect is more easily described. We should emphasise that his remarkable contributions to the theory of numbers have played a majr part in the modern developemnt of the topic.
One characteristic of Rankin was the care with which he undertook all things in his life. Not only was his research articles written with great care but he applied the same attention to detail in running the Department of Mathematics at Glasgow and also in his teaching. Directly coming out of his teaching was the undergraduate text An introduction to mathematical analysis.
He was still publishing papers, and giving lectures, up to the time of his death. He published The books studied by Ramanujan in India in 2000 (again collaborating with B C Berndt) and travelled to London to lecture there shortly before his death although his doctors had strongly advised him not to go.
Rankin received many honours for his outstanding contributions to mathematics. Elected a fellow of the Royal Society of Edinburgh in 1955, he received the Society's Keith Prize for his publications in 1961-63. The London Mathematical Society awarded him their Senior Whitehead Prize in 1987 and the De Morgan Medal in 1998.
Mathematics was certainly not Rankin's only interest. He was very musical :-
The organ works of JS Bach were of special interest to him and he had a detailed knowledge of many of the chorale preludes. He played the organ very competently.He took a scholarly approach to his interest in Scottish Gaelic being President of the Glasgow Gaelic Society from 1957 until his death, and he enjoyed hill walking. He used his knowledge of Gaelic in a professional capacity when he was external examiner at University College, Galway in Ireland when he examined mathematics papers written in Irish Gaelic.
May I [EFR] finish this biography on a personal note. I knew Rankin from the late 1960s. He always made me feel very welcome whenever I visited Glasgow University and treated me with great kindness. Latterly, with his deep interest in the history of mathematics, Rankin was extremely encouraging to me in developing this archive. He contributed an excellent article on Robert Simson to the archive based on a lecture he gave at the Royal Society of Edinburgh; one which I was fortunate enough to hear.
Article by: J J O'Connor and E F Robertson