Formulaic Magic

Modern science loves explaining complex physical phenomena through comparatively simple-looking mathematical abstractions. Motion of an object? F = ma. Energy content of a mass? E = mc2. State of a gas? pV = nRT. Exceptions to these rules are themselves often explainable through math—more intimidating calculations, of course, but still math. These equations are only useful, however, because they accurately describe physical interactions in nature; without this connection, they're just meaningless jumbles of symbols.

Authors often neglect to establish this link between math and reality, instead treating equations as if they possess a power all on their own. This often manifests in two ways:


 * Reduction of math to a magical artifact: The simple knowledge of an equation is powerful in itself. Committing a mathematical expression to memory might unlock superpowers, for instance.
 * Giving math a will of its own: The mere presence of some mathematical statement on paper or in someone's mind has some effect on its surroundings—discoverers immediately go insane, or logical reasoning ceases to work in its presence.

Such "magical math" (or "mathemagic" or "Mathamancy") doesn't have to be connected to any aspect of reality, so it will often be rather nonsensical as a result. In this way, such math is somewhat related to the Numerological Motif, in which numbers get intrinsic properties.

On the flip side, writers will occasionally make systems of magic describable through math, much like their physical science counterparts. This use of math is more readily justified, though usually still not explained in sufficient detail to make mathematical sense.

This may be Functional Magic under rule magic. Arguably Truth in Television if you consider science to be a form of magic, and that its formulas are being applied to create technology, thus hacking the universe and having magic-like powers over things.

Anime and Manga

 * Witches in Soul Eater use "calculation magic" to make their spells more effective.
 * It's revealed in the supplementary manga of Magical Girl Lyrical Nanoha that constructing the Instant Runes needed for magic in that setting requires a very good grasp of math. In fact, one of the reasons why Nanoha and Fate are such powerful mages is because they're both math geniuses.
 * The reality warping abilities of human interfaces in Suzumiya Haruhi seem to work like this.
 * Grimoires and parchments in A Certain Magical Index seem to contain complex formulas which need to be deciphered in order for it to work—kind of like math books, except those don't attempt to destroy their user.

Comic Books

 * Multiple times in The DCU:
 * The Anti-Life Equation is usable as a method of Mass Hypnosis. It runs.
 * Its more benign counterpart, the Life Equation, reads.
 * The Pre Crisis DCU Round Robin maxiseries DC Challenge had a series of numbers in the first issue (written by Mark Evanier) that were somehow important—but none of the other writers could ever really figure out how. Several of them later used the numbers in formulas for this, that, and the other. The secret?
 * Golden Age superhero Johnny Quick accessed his superspeed powers by reciting the mathematical formula "3X2(9YZ)4A". More recent materials have retconned this as a mantra that allows him to tap into the mystical Speed Force.
 * One member of the Green Lantern Corps is a sentient mathematical equation, and so is his ring.
 * In the Marvel Universe, Amadeus Cho (the seventh-smartest person on the planet) sees the world as mathematical formulas. The Incredible Hulk does as well, according to Cho (albeit unconsciously), which explains how he somehow doesn't hurt any innocent bystanders while Hulk-smashing.
 * Small time Marvel villain Mathemanic has an array of math psycho-powers. For example, making people aware of galactic-scale distances so that they can't aim properly.
 * There was a Fantastic Four arc where Reed whipped up a mathematical equation that became sentient. It was a low-grade Reality Warper that dealt with reality in mathematical terms and demanded that Reed create a formula that equalled himself.

Film

 * Pi: Max starts the film with a dogmatic belief that "mathematics is the language of nature," which straddles the line between "math is capable of explaining everything in existence" and "math determines our existence." He later encounters a 216-digit number that seems to have a catastrophic effect on anything it touches:.
 * The John Carpenter horror movie Prince of Darkness, much like H.P. Lovecraft's stories, has ancient, complex mathematical equations of extraterrestrial origin with seemingly magical powers. They predict the existence of a God and Anti-God and, once understood, they open up whole range of bizarre phenomena, including leaping headlong through mirrors into an abyssal darkness on the other side.

Literature

 * Magic in H.P. Lovecraft's mythos is often related to mathematics. In Dreams in the Witch House, for instance, the protagonist is a mathematician who discovers an equation that would allow him to travel outside angled space (basically, to create wormholes). If you can understand the true nature of the universe, you can use that knowledge to do things that seem physically impossible to us. Provided you don't first Go Mad from the Revelation or attract the attention of some Eldritch Abomination, of course.
 * Connected to the above, The Laundry Series by Charles Stross also shows magic as mathematics, to the point where computers solving certain equations can warp reality as per magical spells. Becomes a bit of a problem when the walls around reality start weakening, to the worst-case scenario of somebody solving equations in their head running the risk of accidentally summoning an Eldritch Abomination.
 * Jack L. Chalker's Well of Souls series: The Great Equation. A couple of supercomputers are capable of warping reality retroactively (that is, those who didn't see the change actually happen are incapable of realizing that anything actually changed) by "altering" the Equation, which basically is reality. By moving a few numbers in the equation, the result—that is, our reality—changes to suit.
 * The Harry Potter series has an Arithmancy class, whose name would imply divination through arithmetic. (Ironic, because Hermione actively loathes Divination itself.) The reader doesn't get to hear much about the subject, though, beyond the fact that Hermione's studying it (and apparently enjoys it).
 * In Fanon, Arithmancy is a common choice for Intelligent!Harry stories. In these stories, its usually presented as discussing (and learning) the rules that govern magic itself. For instance, Arithmancy masters can cast wandlessly easier, because they understand the way the magic flows and can create shortcuts, similar to simplifying a complicated equation. Its usually also implied that math in the magic world is dreadfully behind that of Muggles, with Trig being 'the last lesson before Mastery'. Cue Harry (and hermione, more often than not), learning Calc.
 * The Compleat Enchanter books by L Sprague De Camp are heavily based on mathematics causing magic.
 * In the Young Wizards series, all magic is based in math and science, and the kids have quite high-level discussions of these things, because part of magic is being able to completely describe what you want to change.
 * In "Career Day", one of the stories in the Chicks in Chainmail anthology, the protagonist comes from a world where magic is done with mathematical formulas. She brings her daughter's class there on a field trip to observe her in her career as a barbarian swordswoman. When her opponent in a duel cheats by hiring a wizard to help him, the other chaperon on the trip, her daughter's math teacher, counteracts the magic with his knowledge of calculus. It Makes Sense in Context.
 * The Hitchhiker's Guide to the Galaxy, in the later books, introduces the field of Bistromathics, math that can be used to warp spacetime for purposes of Faster-than-light travel by taking advantages of the unique properties numbers take on when written down within the confines of an Italian restaurant.
 * The Aons (runes) neccessary to make the magic system from Elantris work are very much like a combination of mathematical symbols and a very complex alphabet. Learning magic is incredibly difficult for this reason, and it can take weeks for even an experienced practitioner to write out the more complex spell "equations".
 * The premise behind Simon Bloom
 * The anthology "Chicks In Chainmail" gave us a short story by Margaret Ball, later expanded to a full novel, called Mathemagics with this entire premise for the magical system.

Live-Action TV

 * The Doctor Who story Logopolis features a planet where they've developed a branch of mathematics in which the act of performing the calculations changes the fabric of reality. The entire population takes shifts in calculating a never-ending formula that holds the end of the universe at bay.
 * Bonus points to the Master for destroying an entire quarter of the Universe by killing a couple of the guys doing the math.
 * A more abstract example is seen in the episode "The Shakespeare Code"; the Carrionites use words as magic, like witches, and the Doctor explains this as completely non-magical by comparing it to mathematics on earth; "With the right string of numbers you can split the atom!" Except, of course, that saying the number out loud will not cause an atom to spontaneously divide in two.
 * While not stated on Lost itself,the Alternate Reality Game The Lost Experience states that the numbers (4, 8, 15, 16, 23, 42) are.

New Media

 * SCP Foundation-033.

Newspaper Comics
If you want to join them, you first have to find their headquarters, and doing so requires knowing enough about math to calculate the mathematical center of the infinite plane of Mechanus. Once you find them, joining as an apprentice requires an exam that takes a week to finish, and is impossible to pass without a minimum Intelligence Score of 17; most would consider this Albert Einstein's level of genius, and many experienced Mathematicians are much smarter.
 * Bloom County: Oliver Wendell Jones writes a formula to explain the universe and accidentally wipes out Opus when he realises that, under this formula, flightless water fowl could not exist. He then realises he had forgotten to carry a one, causing an unimpressed Opus to pop back into existence when he makes the correction.
 * In Planescape, the Mathematicians are a splinter group of the Guvners who study the nature of Mechanus, the Plane of Ultimate Law, believing anything that can be imagined can be found somewhere on its multitude of gears, and their studies to this end are done using a form of mathematics that makes calculus and trigonometry look like first grade arithmetic in comparison. Naturally, nearly all of them are wizards.

Tabletop Games

 * In Complete Arcane, the 3.5 Edition of Dungeons & Dragons rulebook, there is a Prestige Class called the Geometer. They learn to describe magic as using abstract geometric designs. This is an advantage, if nothing else, because they can save a ton on spellbooks: they need only a single page to depict any spell, regardless of complexity, whereas with the traditional method one would need more pages with higher-level spells. They can also use scribe glyphs of these designs to cast a spell silently.

Video Games

 * Chaos;Head: fun10 × int40 = Ir2,.
 * In Dungeons of Dredmor, one of the skill sets you can choose at start is Mathemagics. It gives you access to fun spells such as Curse of the Golden Ratio and Beklam's Diminishing Calculus!
 * The World Ends With You: Minamimoto summons a nuke by initializing the Level i Flare, which consists of reciting pi to 150 digits. Of course, there are a lot of people capable of reciting pi to 150 digits, but they aren't Minamimoto.
 * Fun bit of math/Final Fantasy info here. "Level x Flare" is a type of spell that casts Flare on everything with a level divisible by whatever number x is. i is a mathematical term referring to the square root of -1, the consummate imaginary number. In addition to that, as the root of -1, that also makes it a possible factor in every number, real or imaginary. Nothing escapes Level i Flare.
 * That said, 1 holds that same property as well, because as the multiplicative identity, it is a factor of every number ever.
 * The beauty of Level i Flare is that it's a factor of every number, not just real numbers, meaning it would affect everything,
 * The Final Fantasy Tactics series has a Calculator class that uses various magical effects. How their abilities work from an in-universe perspective is not specified.
 * According to the remake for the PSP's tutorial, Calculators are attuned enough to the flow of mist that they can manipulate it in unique and bizarre ways which other classes just can't pull off. In other words: SE knew it made absolutely no sense and handwaved it.
 * In Umineko no Naku Koro ni, the Power Levels for Leviathan and are determined in how many hours they've experienced intense envy. In-game, Leviathan attempts the multiplication for the latter's multiplication formula, along with revealing her own, giving players the idea; in the TIPS,  is shown actually chanting her formula as she runs to give her husband (flirting with a younger girl) what for.
 * Final Fantasy VII has an interesting example: When Safer Sephiroth casts Super Nova, four equations fly by the screen. They are, roughly, the potential attractive force between the sun and the planet, the Earth's potential attractive force, and... the area of a circle. You should see the Epileptic Trees some fans go through to justify that one. Still, 75% good scientific formulae being used in a magic spell is better than average.
 * Rita's non-spell special attacks in Tales of Vesperia take the form of mathematical equations.
 * Reinhart Manx, the playable mage character in Dungeon Siege III employs both this and Magitek, using the power of math rather than fireballs.

Web Comics
"Kim: I am 87% confident you will burst into flames. (*fwoosh*)"
 * In a game of Dungeons & Discourse in Dresden Codak, Kim Ross plays a "Bayesian Imperimancer".


 * Bayesian probability concerns itself with the liklihood of a given event based upon the outcome of past events; for example, if a coin has landed heads ten times, bayesian probability dictates it is highly likely to land heads an eleventh time. Kim's class is a play on "Bayesian Imperitive" as in, she can basically tell the world how to work if she makes strong enough judgments about how it should work.
 * Erfworld has Mathamancy, which is described as, to paraphrase: "analyzing probabilities, predicting outcomes, and the raw calculations thereof".

Western Animation

 * Looney Tunes has Egghead Junior, who can accomplish anything, even to the point of bending reality, so long as he has a few seconds to write down an appropriate equation for doing so.
 * In an episode of Camp Lazlo, being flipped upside down gradually changes the Too Dumb to Live characters Chip and Skip into geniuses (it increases the blood flow to their heads). At the height of their intellect, they use their brains to flip themselves right-side up again: this involves rattling off a lengthy Newtonian formula, and then simply glowing with a pink light that levitates them into position. Unfortunately, this reduces the blood flow to their brains, and they soon turn right back into idiots.
 * There's a Donald Duck cartoon called "Donald Duck's Adventures In Mathemagic Land," which is Donald exploring (with the Narrator) the history of mathematics, and math's contribution to things such as music, games, and the natural world.

Real Life

 * From the times of ancient Egypt mathematics were associated with mystical properties and powers, and various theorems and systems passed in and out of cult fashion. The most famous of these were the Pythagoreans, who maintained a hermetic hierarchy back in the days when you could get away with executing your members for revealing their secrets.
 * And don't even ask what they did to people who failed to box their answers.
 * Legend has it that the Pythagoreans were so obsessed with all numbers being rational that, when someone worked out irrational numbers, they grabbed the guy and hurled him off a cliff.
 * Another telling of the story mentions how he was so pleased with the discovery that he sacrificed every sheep in town.
 * During the 19th century, 4th dimensional mathematics was seen by occultists as the key to understanding ghosts and the spirit world: if people could just teach themselves how to think and move in four dimensions rather than the normal three, they could become like ghosts themselves, teleporting and becoming intangible at will. While that's technically true (if oversimplified), today it's believed that, if higher spatial dimensions exist, they're curled up far too small for human beings to move through.