The publicity-averse Maryam Mirzakhani, who died Friday, is the only woman ever to win the Fields Medal, math’s highest honor. Photograph by Mariana Cook

The Iranian mathematician Maryam Mirzakhani, who died on Friday, at the age of forty, was known to her colleagues as a virtuoso in the dynamics and geometry of complex surfaces—“science-fiction mathematics,” one admirer called it—and to her young daughter, Anahita, as something of an artist. At the family’s home, near Stanford University, Mirzakhani would spend hours on the floor with supersized canvases of paper, sketching out ideas, drawing diagrams and formulae, often leading Anahita, now six, to exclaim, “Oh, Mommy is painting again!”

Mirzakhani could be private and retiring, but she was also indomitable and energetic, especially at the blackboard. According to Roya Beheshti, an algebraic geometer at Washington University in St. Louis, and a lifelong friend—the two talked math, read math, and did math, sometimes competitively, for several years growing up—Mirzakhani’s passion was evident early on. “Maryam’s work was driven by a certain pure joy,” Beheshti told me. “A lot of people have been saying how humble she was, and that’s true. She was very humble. She was also really, really ambitious. From the very beginning, from a very young age, it was clear that she had very big goals.” When Mirzakhani was in sixth grade, in Tehran, a teacher discouraged her interest in mathematics, noting that she was not particularly talented, not at the top of the class. A quarter century later, in 2014, she became the first woman (and the first Iranian) to win the Fields Medal, math’s highest honor.

Mirzakhani took pride in the accolades, but they were not her main concern. When her doctoral adviser, Harvard’s Curtis McMullen, delivered the Fields Medal laudation on her work, at the 2014 International Congress of Mathematicians, in Seoul, Mirzakhani sat in the front row with her daughter and her husband, the Stanford computer scientist Jan Vondrák. Looking out into the audience, McMullen noticed that Mirzakhani wasn’t paying full attention to her moment of glory, instead allowing herself to be distracted by a very excited Anahita. “Some scientists and mathematicians engage in a problem to go beyond what other people have done; they measure themselves against others,” McMullen told me. “Maryam was not like that. She would engage directly with the scientific challenge, with the mathematics, no matter how hard it was, and really go deep into the heart of the matter.”

The Princeton mathematician Manjul Bhargava, who also won a Fields in 2014, said that Mirzakhani “was a master of curved spaces.” As he explained in an e-mail, “Everyone knows that the shortest distance between two points on a flat surface is a straight line. But if the surface is curved—for example, the surface of a ball or a doughnut—then the shortest distance. . . will also be along a curved path, and can thus be more complicated. Maryam proved many amazing theorems about such shortest paths—called ‘geodesics’—on curved surfaces, among many other remarkable results in geometry and beyond.”

Bhargava and Mirzakhani met at Harvard as doctoral students, but they only ever solved one problem together. It was at the I.C.M. meeting in Seoul, where they collected their Fields medals, along with Artur Avila and Martin Hairer. The presenters apparently hadn’t realized that the medals were engraved with the recipients’ names, and they doled them out incorrectly. “I received Martin’s, who received Maryam’s, who received Artur’s, who received mine,” Bhargava said. “An unlikely scenario, even if the medals were distributed randomly.” The mathematicians had a real-life combinatorial problem in their hands. “After the ceremony, it was very busy, and there was little chance for all four of us, or even say three of us, to be in the same place simultaneously,” Bhargava explained. “Also, due to constant photo shoots, we each needed a medal with us at all times so that we could fulfill our duties and pose with one when asked.” When Mirzakhani and Bhargava ran into each other, they laughed and tried to figure out the optimal path toward a solution. What to do, standing there, Bhargava with Hairer’s medal, and Mirzakhani with Avila’s?

Avila, who has dual appointments at the French National Center for Scientific Research, in Paris, and the Institute for Pure and Applied Mathematics in Rio de Janeiro, first met Mirzakhani in 1995, when as teens they both won gold at the thirty-sixth International Mathematical Olympiad, in Toronto. Over the years, their research interests converged on the dynamics of billiards. In 2010, Avila learned that Mirzakhani had proved, together with the University of Chicago’s Alex Eskin, the so-called magic-wand theorem. “Upon hearing about this result, and knowing her earlier work, I was certain that she would be a front-runner for the Fields medals to be given in 2014, so much so that I did not expect to have much of a chance,” Avila told me. And then there they were in Seoul, with Mirzakhani in possession of Avila’s medal. Meanwhile, Hairer, of the University of Warwick, was doing the rounds with Mirzakhani’s medal, though before that day they had never met. His first impression, he told me, was of “a very modest person, who certainly wasn’t seeking publicity and who didn’t particularly enjoy the whole media circus she was subjected to.”

Mirzakhani had first received news of the Fields Medal in an e-mail from the Duke mathematician Ingrid Daubechies, then president of the International Mathematics Union, which adjudicates and awards the prize. At first, Mirzakhani assumed someone was playing a joke; she ignored Daubechies’s note. When the two finally spoke, Mirzakhani was pleased, of course, but she was concerned that, having just undergone chemotherapy for breast cancer, she wouldn’t be well enough to attend. Plus, as the first female Fields medalist, she was wary of being hounded by the press. Once it became clear that Mirzakhani would come, Daubechies and a number of other distinguished women mathematicians devised a plan to insulate her. “There were six of us,” Daubechies told me. “We called ourselves the M.M. Shield.” Whenever Mirzakhani was in public, two women were always near; one would intercept any hovering journalists and offer herself as an interlocutor, and the other would facilitate Mirzakhani’s escape. “We felt, as a community, we should really help,” Daubechies said. “We wanted to help her celebrate. It was so unfair—here she was, and sick.”

Despite her illness, Bhargava said, Mirzakhani “was still producing some of her most amazing mathematics just these last few years.” She had an “uncanny intuition” about difficult geometric problems, even if they might require decades of work. Still, though she took the long view of mathematics, she wasn’t above more mundane and immediate concerns. When she and Bhargava brainstormed about their predicament in Seoul, they worked out that the easiest way to untangle the medals was for each of them to perform two trades. “Maryam and I exchanged our medals; then Maryam waited to run into Martin to exchange medals with him, while I waited to run into Artur to exchange medals with him,” Bhargava said. Then he offered a more mathy explanation for the solution to the four-medal mix-up:

A four-cycle cannot be expressed as the composition of fewer than three transpositions, or “swaps.” Therefore, since exchanging our medals resulted in a permutation that was the composition of two swaps, it was clearly making progress (two swaps is better than three); moreover, those last two swaps could now be carried out in parallel, making it better than any other possible solution. We had this amusing mathematical conversation very quickly, exchanged medals, and then ran off to our next obligations.

Mirzakhani stayed for a couple of days at the congress but, as she and Daubechies had planned, left before delivering her lecture, which was scheduled toward the end of the proceedings. That morning, Daubechies said, “people looked for her, but she was gone.”