The Man Who Knew Infinity (out Friday, April 29) is the latest in a series of largely English-based biopics in the “misunderstood genius” genre—following on the back-to-back 2014 releases of The Imitation Game (about Alan Turing) and The Theory of Everything (about Stephen Hawking).

While those films treated pioneers in computer science and physics, respectively, and were mostly set in the WWII and 1960s eras, the new offering is a kind of mathematical love story unlike any told before. Anchored by the University of Cambridge experience of the outbreak of WWI a century ago, it concerns the extraordinary and unlikely academic relationship between the poor and poorly educated Srinivasa Ramanujan from India, and G. H. Hardy, one of England’s most eminent mathematicians.

Starring Dev Patel (Slumdog Millionaire) as the free spirited and enigmatic Ramanujan and Jeremy Irons (The French Lieutenant's Woman, Reversal of Fortune) as stuffy, socially awkward Hardy—with cameos by Stephen Fry and Jeremy Northam—The Man Who Knew Infinity has a screenplay by Matt Brown, who also directed, based on Robert Kanigel’s 1991 book of the same name. Both the book and the screenplay were partly underwritten by the Alfred P. Sloan Foundation, which has been pushing for more public recognition of Ramanujan for a quarter of a century (the foundation has also supported a musical about Ramanujan that hasn't been produced, a play titled Partition, which has, and several other projects, including another screenplay).

The core of the story is well-known to many mathematicians, and thanks to this release it’s about to get much-deserved wider exposure. Ramanujan was born in a small Tamil village in 1887, and initially did well in school, but in 1905 he was a college dropout in Kumbakonam. Moving to Madras for a second try at university, he once again blew it by excelling at mathematics but failing all other subjects. Undaunted, he pursued highly original mathematical research alone, using his own notation and methods. Often he re-invented the wheel, finding results already known to others, and sometimes he stumbled on new vistas and baffling formulae. In 1912, he secured a job as a clerk, having by now published an article in theJournal of the Indian Mathematical Society.

There is no question that Ramanujan had a mysterious “direct line” to sophisticated and deep mathematical truths quite unlike any other human recorded by history. This autodidact dared to send some of his startling discoveries to Hardy (as well as others) in Cambridge, which in time led to his making a forbidden (for a devout Brahmin) sea journey to England. After spending five challenging years working with atheist Hardy—and his lifetime collaborator J. E. Littlewood, here played by affable Toby Jones—in a culture unwelcoming of his vegetarian ways, he was beset with illness.

Returning to India in 1919, and to the bride he had left behind there, he died a year later at the age of 32, but not before filling more notebooks with his divinely inspired scribbling. “An equation has no meaning for me unless it expresses a thought of God,” was his own view. Some of the mysteries of these lost notebooks have finally been unlocked recently, after almost 100 years, thanks to the efforts of Emory University’s Professor Ken Ono and others.

Ono acted as special advisor and part-time coach to the film’s actors, and one pleasing by-product of this is the absence of the usual cringe-inducing gaffs and inaccuracies so typical of mainstream portrayals of mathematicians. The film strikes a good balance between portraying too much and too little mathematics, considering that it’s aimed at a general audience. As Ono puts it, “Director Matthew Brown made it a point to get the mathematics right. Instead of shying away from mathematics, it was important to him to make a film that mathematicians embrace. He has done that.”

One of the most famous of all mathematical anecdotes, concerning Ramanujan’s fascination with the number 1729, is naturally highlighted. What has only come to light recently, uncovered by Ono in his researches in India, is just why Ramanujan already knew that 1729 was a sum of two cubes in two different ways: he encountered this fact while searching for “near solutions” to the impossible whole number equation x3 + y3 = z3. This is revealed at the bottom of this notebook page, which is in Ramanujan’s own handwriting.

Credit: Ken Ono

Patel and Irons are very convincing as hard-headed outsized mathematical talents from two different worlds, trying to find common ground and build a productive relationship despite their vastly different approaches to life, innovation and certainty. Hardy, a lifelong bachelor, said of his (purely professional) relationship with Ramanujan that it was “the one romantic incident in my life.”

Hardy’s assessment of Ramanujan’s claims, which at first lacked any justifications or proofs in the traditional sense, was the oft-quoted, “I had never seen anything in the least like them before. A single look at them is enough to show that they could only be written by a mathematician of the highest class. They must be true because, if they were not true, no one would have the imagination to invent them.”

Where did Rananujan’s unprecedented insights come from? According to Ono,

“Ramanujan claimed many of his fantastical formulas were literally presented to him in his sleep, by the Hindu goddess Namagiri. However we interpret this, he was certainly operating at a high level of creativity. In the larger sense, he had confidence that he could by his own powers tackle huge mysteries. His dreams drove him on a number of levels.”

In Ono's view, the film succeeds on many levels. "In Ramanujan," he says we have an archetype of incomprehensible talent overcoming impossible circumstances. His story resonates with mythological overtones. Yet the story speaks most vitally to our modern era. One might ask: Wasn’t Ramanujan the tip of the iceberg, just one example of a self-motivated, self-made genius working in isolation? He matters today because he represents untapped potential that we have to believe in to proceed in science.”

The Man Who Knew Infinity also forces us to reflect on the current state of education in the world, says Ono. "Ramanujan flunked out of college twice. ('It is the worst instance that I know of the damage that can be done by an inelastic educational system,' commented Hardy.) Today’s educators are flooded with a depressing litany of complaints–disaffected students, teacher burn-out, overtesting, failure to keep up with technology, inadequate and unequal funding, and lack of relevancy, to name a few. How would we recognize and nurture an outlier like Ramanujan today? This is the question that demands attention.”

It's important to note that Ono himself is a spectacular example of a one-time educational system drop-out who went on to scale great mathematical peaks, inspired by the story of Ramanjuan—and a letter his mathematician father received decades ago from Ramanujan’s widow—as detailed in his new soul-baring book My Search for Ramanujan: How I Learned to Count (Springer, 2016), co-authored with the late Amir Aczel.

Those wondering if the Indian savant’s name is pronounced Ra-MAN-ujan or Raman-UJ-an will still wonder after seeing the film: on screen—and also in press appearances and interviews by the biopic’s personnel—both versions are liberally used. Ono explains: “Ra-MAN-ujan is Tamil, Raman-UJ-an is British.” That’s one Ramanujan mystery that can be solved without needing to understand difficult mathematics.

.Editor's note (4/27/16): This post was changed to correct the spelling of Ramanujan's name

The views expressed are those of the author(s) and are not necessarily those of Scientific American.

Scientific American is part of Springer Nature, which owns or has commercial relations with thousands of scientific publications (many of them can be found at www.springernature.com/us). Scientific American maintains a strict policy of editorial independence in reporting developments in science to our readers.