Credit: Maryam Mirzakhani/Corbis/Getty

Maryam Mirzakhani was one of the greatest mathematicians of her generation. She made monumental contributions to the study of the dynamics and geometry of mathematical objects called Riemann surfaces. Just as impressive as her theorems was her ability to push a field in a new direction by always providing a fresh point of view. Her raw talent was rare, even among the most celebrated mathematicians, and she was known for having a taste for difficult problems.

She became an icon without wanting to be. She was the first woman and first Iranian to win the Fields Medal, considered the highest honour in mathematics. For women, Mirzakhani was a role model, pursuing a successful career in a male-dominated field. For Iran, she represented the country's tradition of intellectualism. And for young scientists, she was a calming force that rose above the pressures of academia. She died aged 40 from breast cancer on 14 July.

Mirzakhani was born in May 1977 in Tehran. She attended school there and twice won gold medals for Iran in the International Mathematical Olympiad. Being hailed as a genius allowed her to pursue pure mathematics — not an easy career choice for women in Iran.

Mirzakhani gained a bachelor's degree in mathematics in 1999 from the Sharif University of Technology in Tehran. She left to do doctoral work in the United States and earned her PhD in 2004 from Harvard University in Cambridge, Massachusetts, under the supervision of Curtis McMullen. She turned down a junior fellowship there to become a Clay Mathematics Institute research fellow at Princeton University in New Jersey. She became a full professor at Stanford University in California in 2008, by which time she was considered a leader in the fields of hyperbolic geometry, topology and dynamics. She stayed at Stanford until her death.

Mirzakhani's PhD concerned Riemann surfaces. Picture a surface with several holes in it, like that of a pretzel or two doughnuts stuck together, and then imagine trying to wrap a rubber band around the surface without it overlapping itself. Mirzakhani wanted to work out how many different ways this can be done for a rubber band of a given length.

She realized that she could flip the method. Instead of fixing a surface and counting the number of curves, she could find the average of all such numbers corresponding to points in the 'moduli space' of Riemann surfaces: a 'space', or set, of points, each of which represents one of the shapes a surface can take. Computing such an average requires one to calculate the 'volume', or size, of the space of Riemann surfaces that contain a curve of a certain length. A clever recursive formula for the volumes of various moduli spaces solved the problem. The solution had several stunning ramifications in seemingly distant fields. For example, it offered a new proof of a famous theorem by the Russian–French mathematician Maxim Kontsevich, which had implications in quantum field theory.

In later work, Mirzakhani studied the dynamics of a billiard ball, or point mass, moving in a polygon. A ball moves in a straight line until it hits the edge of the polygon; then it bounces back at the same angle at which it hit. A mathematician could ask several questions about such a system. For instance, is it possible for a ball to move inside a given polygon in such a way that the path it takes is eventually repeated — and, if so, how many such paths are there, and what do they look like? The problem of whether a repeating path exists for a general polygon is still unsolved.

In some cases, it is helpful to embed the space of certain billiard tables in a larger space in which every point is a surface that is locally either flat or cone-shaped. With Alex Eskin, a mathematician at the University of Chicago in Illinois, Mirzakhani used this method to prove, for such spaces, a version of a theorem about a group of symmetric geometric objects known as Lie groups. The theorem was proposed by Marina Ratner, another leading mathematician in the field who also died in July, aged 78. The proof — a monumental work written up in a 200-page paper (A. Eskin and M. Mirzakhani Preprint at; 2013) — tied together disparate fields including geometry, topology and dynamical systems, and spawned a field of its own. It has been dubbed the 'magic wand' theorem because it enabled many previously intractable mathematical problems to be solved.

Despite the fame and attention she received, Mirzakhani remained humble and grounded, always avoiding the spotlight. She listened to the work of other mathematicians with excitement and asked forward-looking questions that hinted at possible new directions. At conferences, she could be found talking with graduate students and Fields medallists alike. She generously shared her ideas with the community and helped others to further their careers.

I visited Maryam in December 2016. We walked from her home in Palo Alto, California, to Stanford's maths department to listen to a lecture by the Russian–French mathematician Mikhail Gromov. Mirzakhani was diagnosed with cancer in 2013 and had already been treated for the illness, but by this time it had returned and spread, and she was in pain. We stopped every few minutes along the walk so that she could lie down on a bench to rest. Maryam told me that she didn't want to take long-term leave from work for her illness and that she would like to continue her responsibilities as an editor of the Journal of the American Mathematical Society. I couldn't resist telling her about the maths problems I was thinking about, and despite all that was going on in her life, she was happy to listen and offer helpful insights.

The mathematics community has lost one of its greatest minds much too early, and I have lost a friend.