The Man Who Knew Infinity, now screening in Australian cinemas, presents some of the best descriptions of mathematics yet seen in a film.

Based on a book of the same name by Robert Kanigel, it is the story of the mathematician Srinivasa Ramanujan (played by Dev Patel) from Tamil Nadu in India.

Initially, Ramanujan works alone in Madras, India, self-taught from books but taking his mathematics beyond the frontiers of the field, attributing his inspiration to the Hindu goddess Namagiri.

He writes a long letter full of equations to the brilliant Cambridge mathematician G.H. Hardy (Jeremy Irons), who is so impressed by Ramanujan’s remarkable discoveries that he brings him to Trinity College, Cambridge, in 1914.

Ramanujan leaves his wife and mother behind, and does not return to India until 1919.

In Cambridge, Hardy and Ramanujan collaborate, with the first world war as backdrop. But there is considerable tension between their approaches: the untutored genius Ramanujan, with his intuition and inspiration; the dry, crusty Hardy, traditionally educated and steeped in the formality and rigour of the professional mathematician.

Hardy is joined at times by his Trinity colleague and close collaborator John Littlewood (Toby Jones).

Ramanujan is anxious to see his discoveries published, but experiences frustration due to Hardy’s insistence on rigorous proof.

Littlewood raises doubts about parts of Ramanujan’s work, and some of his results are found to be incorrect.

Ramanujan must learn to supplement his inspired explorations with technical discipline, so that his discoveries can be verified to be true and his efforts not wasted.

Hardy, in turn, is a strenuous advocate for him, eventually leading to the highest levels of recognition by British academia.

## The nature of mathematics

I expect this film will lead to better-informed public perceptions of mathematics.

Too often, the field is seen as a set of methods for manipulating numbers, shapes or symbols. These methods are important and useful, but they are products of mathematics and tools used by it; they are not the essence of the field.

The film presents mathematics as art and as a creative process of discovery.

To Ramanujan, it reveals “thoughts of God”. Hardy, an atheist, would not describe it in such terms, but has a similar aesthetic sense.

Most mathematicians would agree with Hardy that mathematical facts (theorems) are discovered rather than invented. Hardy once described them as “notes of our observations”. They exist as fundamental truths independent of the activity of human beings, independent of time itself: their truth predates our recognition of them.

The film captures much of the spirit of mathematical research. The mathematician is guided by curiosity and seeks beautiful and elegant connections between abstract concepts.

These explorations typically involve some experimentation, but with ideas and symbols rather than physical things.

There are usually lots of mistakes and dead ends. Great persistence is needed. If a new connection is believed to have been found, there is a unique intellectual thrill and maybe a sense of awe.

But the game is not over. A proof – a complete, verifiable, logical justification – must be built. Constructing the proof can be difficult and often takes a lot longer than the initial discovery.

It is tempting to move on to try to discover other connections, rather than work on the proofs to support the ones already found, but we must learn to persist until the proof is finished. Tertiary education in mathematics aims to instil this.

In India, Ramanujan lacked such an education. At Cambridge, he had to catch up and fill in gaps.

You can read more about his time in Cambridge, and Hardy’s mentoring, in an article by Bela Bollobas.

Students, teachers and practitioners of mathematics will see some good practices in this film.

Here is one. In Madras, paper is expensive and Ramanujan must constrain his use of it. But at Cambridge he is empowered by the large pile of blank sheets he finds on his desk.

Having plenty of paper available for working out – even if the answer has to fit within some box on a worksheet or an exam paper – allows the mind full flight.

## Primes and partitions

The Man Who Knew Infinity touches on topics that at the time lay at the forefront of pure mathematics but today are connected to a multitude of practical applications.

Some of Ramanujan’s early work is on prime numbers: a number is prime if no other numbers divide it exactly except for itself and one.

These are the “atoms” from which every number is made; they are “bonded” together by multiplication.

Mathematicians have long been interested in how the prime numbers are distributed among all whole numbers, and in the intriguing patterns they form.

We have good estimates for how often prime numbers tend to occur as we travel along the number line. The formal statement, known as the Prime Number Theorem, was proved in 1896.

Early in his correspondence with Hardy, Ramanujan proposed a more precise version of the theorem. Alas, this version was wrong, a serious disappointment at the time. Nonetheless Ramanujan went on to do important work with primes.

In those days, prime numbers were of interest only for their beauty and their curious behaviour. Hardy himself, at heart the purest of pure mathematicians, rejoiced in the fact that his field had no practical applications.

But today prime numbers underpin the cryptographic algorithms used to provide secrecy and authentication in most electronic transactions and communications.

The other mathematical topic that features in the film is partitions, in which a positive integer is expressed as a sum of other positive integers.

In how many ways can this be done? The film illustrates this with the five partitions of 4, namely, 1+1+1+1, 2+1+1, 2+2, 3+1, and 4 itself.

The count of partitions increases as the positive integer itself gets larger – there are 204,226 partitions of 50 – but in a way that is difficult to capture with a simple formula.

The expert on the topic was Major Percy MacMahon, who used the long-winded methods of the day to work out the partition count for all numbers up to 200.

Hardy and Ramanujan developed a completely new approach, using mathematical ingredients that seem, at first sight, out of place when working with positive whole numbers: integral calculus, which concerns areas bounded by curves, complex numbers, involving the square root of -1, and elliptic functions, which generalise the circular functions – sin, cos and tan etc – that many of us met at school.

They could then calculate numbers of partitions much more efficiently, to the amazement of their peers.

Partitions are part of combinatorics, the mathematics of arranging objects in patterns according to rules.

Combinatorics was then seen as young and recreational, but now permeates the modern world through the design and analysis of network structures, encoding schemes and optimisation algorithms.

## Look out for …

The film has lots of fascinating details, easily missed, but rewarding when caught.

Hardy and Littlewood are seen early playing Real Tennis, an ancestor of tennis with some squash-like elements, popular in Oxford and Cambridge.

Ramanujan has an Indian friend in Cambridge, Chandra Mahalanobis (Shazad Latif) from Calcutta. But we are told no more about him. In real life, he became a famous statistician who co-founded the renowned Indian Statistical Institute in Calcutta.

Most of the academic staff in the film use the title “Mr”. The PhD degree was first available in Britain only from 1917 and it was decades before it became the standard apprenticeship for academic employment.

Mathematicians will anticipate the appearance, late in the film, of Ramanujan’s Taxicab Number 1729. The taxi with this number becomes symbolic of Ramanujan himself. It has also appeared elsewhere in popular culture.

The film is also worth watching for its excellent cast and its depictions of Indian culture.

It tells of the struggles and achievements of the protagonists without excessive distortion or stereotyping (in happy contrast to The Imitation Game, for example). The human story is compelling, inspiring and moving.

Ramanujan’s extraordinary contributions continue to influence and surprise mathematicians. His singular story deserves to be better known.

This film’s rich and eloquent portrayal of the nature and practice of mathematics is ground-breaking cinema and sets a very high standard for future filmmakers to follow.