Lists

10 Fantasy Books Where Math is Magic

This content contains affiliate links. When you buy through these links, we may earn an affiliate commission.

Katie Moench

Contributor

Katie Moench is a librarian, runner, and lover of baked goods. A school librarian in the Upper Midwest, Katie lives with her husband and dog and spends her free time drinking coffee, trying new recipes, and adding to her TBR.

How do you conjure magic? What underlies a magical world? These are the questions authors of fantasy novels are challenged to answer when building their fictional worlds. While the settings of these books may be fantastical, there is often a logic and system of rules upon which magical powers are built. These systems might draw upon magic found in nature, magic revealed through ancient texts, or magic conjured up through the laws of math and physics. What makes fantasy such a fascinating genre is not just the plotlines and characters in fantasy books, but also getting to escape into an intricately crafted system where the author has spent time perfecting what magic looks like in the world of their story. 

The books here all have magic systems that depend on a branch of mathematics. It might be the math scholars of Neal Stephenson’s work, or the computer science codes of Alechia Dow’s writing; each of these books uses the principles of mathematics and its applications to shape magic in their world. In the following novels and novellas, you’ll find everything from mathematical ideas shaping how time travel is possible, to stories that explore the nature of infinity. If you’re looking to explore worlds where math is magic, the 10 books below are a great place to start.

cover of Ninefox Gambit (The Machineries of Empire) by Yoon Ha Lee POC (he/him)

Ninefox Gambit (Machineries of Empire Series #1) by Yoon Ha Lee

Captain Kel Cheris of the hexarchate has been dismissed from the Kel Command in disgrace but is given a chance to redeem herself by retaking the Fortress of Scattered Needles. Kel aligns herself with skilled, but unconventional tactician Jedao in a gamble to preserve both her own reputation and the hexarchate. The technologies and magic of the hexarchate are based on complex mathematics and the author uses them well in building the world of Kel and Jedao.

Mandelbrot the Magnificent book cover

Mandelbrot the Magnificent by Liz Ziemska

This historical reimagining takes place in Poland, where mathematician Benoit Mandelbrot is a pioneer in fractal geometry. Mandelbrot uses his understanding of the topic to develop his wizarding powers, which then allows him to fight against the Nazis in World War II.

cover of The Sound of Stars

The Sound of Stars by Alechia Dow

After an invasion of Earth by the Ilori that killed one-third of the human population, the Ilori now rule Earth, and art and books are illegal. However, high school student Ellie maintains a secret library in the Ilori-controlled New York City where she is living, as a means of keeping human knowledge alive. By teaming up with rebels and using math and codes to communicate, Ellie is able to harness her powers against the Ilori in an attempt to save humanity.

Passing Strange book cover

Passing Strange by Ellen Klages

Set in 1940s San Francisco, six women find their lives intersecting on the magical edges of the city. The book incorporates mathematical concepts like tesseracts, Klein bottles, and fourth-dimensional travel into its storyline. The story plays with the power of math and art to sustain us, and tells stories of forbidden love in the gay and lesbian communities of the 1940s.

The Library of Babel and Other Stories book cover

The Library of Babel and Other Stories by Jorge Luis Borges

Several of the short stories in this collection play around with the magic and philosophy of mathematics. In the title story, a magical library is filled with books containing every possible combination of words and letters, including some that are completely nonsensical. The magic in this library explores the notion of infinity and randomness to generate the library’s magic.

the magicians book cover

The Magicians by Lev Grossman

High school math genius Quentin Coldwater is fascinated with a series of fantasy novels set in a land called Fillory and finds his real life dull by comparison. When Quentin is unexpectedly admitted to a magical school and realizes that his fantasies are real, he has to face up to the fact that magic is both darker and more complex than he had imagined. Far from casting spells with simple words or phrases, the magicians at the school must use complex, mathematical formulas to achieve their magical aims.

Book cover of The Fever King by Victoria Lee

The Fever King by Victoria Lee

Sixteen-year-old Noam Álvaro is the sole survivor of the viral magic that killed his family and turned him into a technopath, AKA a person with the ability to control technology. Noam has spent his life since then fighting for his fellow refugees and undocumented immigrants who have been targeted by the government’s magical control. In the society Noam lives in, magic is both highly feared and tightly controlled by the government, which uses it to keep the population in line. When Noam is offered the chance to learn how magic works, in exchange for helping advance defense technologies, he sees it as both a means of creating change and of getting a better life for himself. But, as Noam agrees to use his mathematical abilities to help the government manipulate technology, he begins to question where his loyalties lie.

Anathem book cover

Anathem by Neal Stephenson

In a world of cloistered scholars living in monastic kingdoms called “maths,” Erasmus, one young scholar, has uncovered a conspiracy that threatens to destroy the world. This will call him and his fellow scholars into the world beyond their cloister, to try and halt the coming global disaster. Throughout the book, Stephenson uses the laws of math and physics to build the fantasy world in which Erasmus and his fellow scholars live and the story includes many explanations of the complex logic that underlies the mathic communities.

Threshold book cover

Threshold by Sara Douglass

A book that plays around with the concept of infinity, this is part fantasy, part science fiction, and part evil empire story. In the kingdom of Ashdod, the ruling Magi are a math-obsessed group of leaders who have spent decades building a pyramid they believe will allow them to connect with the infinite, at the cost of the lives of the enslaved laborers working on it. When Tirzah, an enslaved glassblower, comes to the attention of the Master of the Magi, he becomes determined to manipulate her and use her for his own power. But what the Magi don’t understand is that Tirzah has a gift for communicating with glass and that her magical powers allow her to see the threat from infinity that might end them all.

The City We Became N.K. Jemisin Book Cover

The City We Became by N. K. Jemisin

In this interdimensional journey through the boroughs of New York City, six characters represent the city’s souls and its history. Each character is an avatar that must team up with the others and save the city from destruction. Though the math in this book is more subtle, it does a great job of pairing interdimensional concepts, a fascinating premise, and a rich, fantasy world.

Looking for more magical worlds? Check out these stories about word-based magic systems or these magical mysteries. And if you’re a fan of math in your novels, we have plenty of suggestions for those too!