Surfaces are basic objects in mathematics, appearing in many guises. The surface of our planet is a sphere, but from local observations alone one cannot be sure of this: the Earth could be shaped like a bagel, for example, or a bagel with a few handles attached. A bagel-like surface is known in mathematics as a torus.

To make a torus, one can take a square piece of material and glue the bottom edge to the top to form a cylinder, then bend the cylinder and glue its ends together. A less distorted view of the torus is obtained by thinking of a square video screen with a character that wanders off the top only to reappear at the bottom directly below where it exited, and then wanders off the left edge but reappears at the right, moving with the same speed and direction at the same height. This character is living on a flat torus.

One can vary the shape of the torus by making the screen rectangular, or by skewing it to be a parallelogram (identifying points on opposite sides with a suitable shift). The variety of shapes that arise is described by a moduli space -a mathematical object where each point represents a specific flat torus.

If we replace our square screen with a regular octagon, retaining the rule that when our character disappears across an edge it emerges at the opposite edge, then our character is no longer living on a torus: we are now observing it moving around a "surface of genus 2": a sphere is a surface of genus 0, a bagel is of genus 1, and genus 2 can be drawn as a bagel with a handle, and so a second hole. If we replace the octagon by more complicated polygons, we observe our character living on higher genus surfaces: we are looking at flat models for surfaces obtained from a bagel by attaching more handles.

With a rectangular screen, the four corners of our flat model fit together so that the glued-up torus is flat everywhere. In the higher genus case, naive gluing produces a cone point, so a distorted, non-flat geometry is needed to get a smooth, homogenous glued-up surface. This is hyperbolic geometry, which lies at the heart of much of what Maryam achieved. The moduli space for tori is itself a surface, but the moduli spaces for higher genus surfaces (and surfaces with punctures) are high-dimensional objects whose beguiling structure is enormously rich and complicated, presenting huge challenges to our understanding.

Maryam's earliest breakthroughs answered fundamental questions of classical origin concerning the hyperbolic geometry of individual surfaces. Straight lines on a torus are easy to understand: according to the slope it follows on our flat screen, the line will either wind around the torus indefinitely without intersecting itself, or it will wind around a few times and then close up, repeating its trajectory. The behaviour of lines (geodesics) on hyperbolic surfaces is vastly more complicated.

Counting how many closed geodesics there are of a given length is a subtle problem that requires ideas from number theory and analysis (advanced forms of calculus) as well as geometry. In her Harvard PhD thesis (2004), Maryam gave a precise estimate of how many of the closed geodesics of a given length do not cross themselves, though in order to solve a simply stated problem about curves on a single surface, it was necessary for her to understand all manner of additional structures on the space of all surfaces of the same genus.

Her later breakthroughs were rooted in dynamical systems. Such systems describe motion. They arise throughout mathematics and physics, and through appropriate abstractions one can transfer knowledge gained in one setting to whole classes of problems in another. Thus a penetrating study of how a billiard ball bounces around a polygonal table can provide insights into the behaviour of many physical systems (the motion of gases for example), and equally it can be used to build bridges between different aspects of the structure of moduli spaces.

This is a key theme in Maryam's monumental project to illuminate the geometric and dynamical properties of moduli spaces, much of which was joint work with Alex Eskin from the University of Chicago.

Born and brought up in Tehran, Maryam was the daughter of Ahmad Mirzakhani, an electrical engineer, and his wife, Zahra (nee Haghighi). She spoke warmly of her parents'encouragement and support, and credited her older brother, one of three siblings, with firing her interest in mathematics by explaining to her what he was learning at school.

She won a place at Farzanegan secondary school, for exceptionally talented students, where she found inspiring teachers and friends. Supported by her headteacher, Maryam entered mathematical competitions previously reserved for boys and represented Iran at the International Mathematical Olympiad, winning gold medals in 1994 and 1995, the second with a perfect score. She gained her bachelor's degree at Sharif University in Tehran, and in 1999 she moved to Harvard, where she studied under the direction of Curtis McMullen, also a Fields medallist.

A calm, modest and friendly person, with immense intellectual ambition, Maryam spoke eloquently about the fun that she had unravelling the intricate mysteries that she spent her life exploring, and the joy of getting to know the key characters that emerged and evolved in the unfolding of her mathematical plots -a joy that resonated with her childhood dream of becoming a writer.

Her doctoral thesis brought her widespread recognition and a fellowship from the Clay Mathematics Institute, in New Hampshire, giving her freedom to pursue her own research agenda. She was assistant professor and then professor at Princeton University (2004-08) before moving to Stanford University as professor.

Maryam is survived by her husband, Jan Vondrák, a Czech computer scientist at Stanford, and their daughter, Anahita.

*Maryam Mirzakhani, mathematician, born* 3 *May* 1977; *died* 14 *July* 2017

**Martin Bridson**

19 July 2017 © Guardian Newspapers Limited