->''"Using the power of Mathemagic, you can multiply power, subtract hope, and cube-root the dreams of man himself."''
-->-- '''Mathemagic Skill-tree Description''', ''Videogame/DungeonsOfDredmor''

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'' = ''mc''[[superscript:2]]. 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. [[PowersAsPrograms 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 [[GoMadFromTheRevelation immediately go insane]], or logical reasoning ceases to work in its presence.

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

On the flip side, writers will occasionally make [[RitualMagic systems of magic]] [[SufficientlyAnalyzedMagic describable through math]], [[FantasticScience 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 FunctionalMagic under rule magic. Arguably TruthInTelevision if you [[ClarkesThirdLaw 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.


[[folder:Anime and Manga]]
* Witches in ''Manga/SoulEater'' use "calculation magic" to make their spells more effective.
* It's revealed in the [[AllThereInTheManual supplementary]] [[ComicBookAdaptation manga]] of ''Franchise/LyricalNanoha'' that constructing the InstantRunes 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 [[TeenGenius math geniuses]]. The [[MagicWand Devices]] aren't just conduits for mana, they're also highly advanced calculators.
* The [[RealityWarper reality warping]] abilities of human interfaces in ''LightNovel/HaruhiSuzumiya'' seem to work like this.
* Grimoires and parchments in ''LightNovel/ACertainMagicalIndex'' 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.
* Part 7 of ''Manga/JoJosBizarreAdventure'' takes geometry very seriously. A short 2 page lesson on the golden ratio gives the protagonist the power to create miniature wormholes.
* In ''Anime/YuGiOhGX'', Misawa has a monster called Mathematician, a goofy-looking wizard wearing a mortarboard and academic road. It's attack is called "Battle Curriculum" (or "Number Cruncher" in the dub) and consists of a beam of magical energy full of numbers and mathematical symbols. [[SureWhyNot Konami eventually]] made it into a [[http://yugioh.wikia.com/wiki/Mathematician real card.]]

* Magic in the version of the [[Franchise/MagicalGirlLyricalNanoha Nanoha]] multiverse the fanfic ''FanFic/TheNewMath'' is set in works via complex math equations. The most powerful mages are also really, really good at math.

[[folder:Comic Books]]
* Multiple times in Franchise/TheDCU:
** The [[BrownNote Anti-Life Equation]] is usable as a method of MassHypnosis. It runs [[spoiler:'''Loneliness + Alienation + Fear + Despair + Self-worth ÷ Mockery ÷ Condemnation ÷ Misunderstanding x Guilt x Shame x Failure x Judgment, n=y where y=Hope and n=Folly, Love=Lies, Life=Death, Self=''''''[+{{ComicBook/DARKSEID}}+]''']].
** The pre-ComicBook/{{Crisis|on Infinite Earths}} DCU RoundRobin maxiseries ''ComicBook/DCChallenge'' had a series of numbers in the first issue (written by Creator/MarkEvanier) 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? [[spoiler:Add them up on a calculator and turn the calculator upside down; it spelled out the name "ELI ELLIS", a character from the first issue who was key to the whole crisis.]]
** [[UsefulNotes/TheGoldenAgeOfComicBooks Golden Age]] superhero Johnny Quick accessed his superspeed powers by reciting the mathematical formula "3X2(9YZ)4A". More recent materials have [[{{Retcon}} retconned]] this as a mantra that allows him to tap into the mystical Speed Force.
** One member of the Franchise/GreenLantern Corps is a sentient mathematical equation, and so is [[GreenLanternRing his ring]].
* In the Franchise/MarvelUniverse, Amadeus Cho (the seventh-smartest person on the planet) sees the world as mathematical formulas. The Comicbook/IncredibleHulk 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.
** This is a severe understatement. On his first appearance, he made [[ComicBook/NewWarriors Firestar]] believe she was the equivalent distance between the earth and the sun away from EVERYTHING else. And I mean the smallest speck of matter. [[GoMadFromTheIsolation She promptly went catatonic.]]
* There was a ''ComicBook/FantasticFour'' arc involving a mathematical formula that gained sentience. It was a low-grade RealityWarper that dealt with reality in mathematical terms and saw Reed, its accidental "creator", as its only equal - to the point that it resembled a StalkerWithACrush. Reed stopped it by creating a formula version of himself, balancing the equation.
* The ComicBook/UltimateMarvel version of the Scarlet Witch needs to work out the statistical probability of her hexes before she casts them for desired effects.
* In ''Numbercruncher'', working out a particular mathematical theorem allows the mathematician to transcend the wheel of karma and retain his memories on his next {{reincarnation}}. Other forumulae let him escape the attention of God's enforcers, and also choose to lose his memories in his final rebirth.

* ''Film/{{Pi}}'': [[MadMathematician 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: [[spoiler:the stock market, his mentor's health, and eventually his (already tenuous) sanity]].
* The Creator/JohnCarpenter horror movie ''Film/PrinceOfDarkness'', 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 [[GodOfEvil Anti-God]] and, once understood, they open up whole range of bizarre phenomena, including [[MagicMirror leaping headlong through mirrors]] into an abyssal darkness on the other side.
* The made-for-TV movie Supernova (2005, Peter Fonda) contains a weird secular magic variant. The solar flares predicted to destroy the earth, and which ACTUALLY START TO DESTROY THE EARTH, stop suddenly. This happens as soon as the scientist discovers he made an error in the formula which predicted them.

* Magic in Creator/HPLovecraft's mythos is often related to mathematics, and it makes sense considering his preference for AlienGeometries. 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 GoMadFromTheRevelation or attract the attention of some EldritchAbomination, of course.
* Connected to the above, ''Literature/TheLaundrySeries'' 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 EldritchAbomination.
* Jack L. Chalker's ''[[Literature/WellWorld Well of Souls]]'' series: The Great Equation. A couple of supercomputers are capable of [[RealityWarper 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 ''Literature/HarryPotter'' series has an [[{{Whatevermancy}} 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 [[PeggySue 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 more easily, 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 [[ShipToShipCombat (and Hermione, more often than not)]], [[MarySue learning Calc]].
* The ''[[Literature/HaroldShea Compleat Enchanter]]'' books by Creator/LSpragueDeCamp are heavily based on mathematics causing magic.
* In the ''Literature/YoungWizards'' 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 ''Literature/ChicksInChainmail'' 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. ItMakesSenseInContext. Later expanded to a full novel, called ''Mathemagics'' with this entire premise for the magical system.
* ''Literature/TheHitchhikersGuideToTheGalaxy'', 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 ''Literature/{{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 ''Literature/SimonBloom''
* In Literature/MondayBeginsOnSaturday, a book called ''Equations of Mathmagic'' is mentioned.
* In ''Discworld/{{Pyramids}}'', You Bastard the camel is a genius mathematician, able to use complex equations to step in and out of pocket dimensions.

[[folder:Live Action TV]]
* The ''Series/DoctorWho'' 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.
*** Unless you're Logopolitan, of course.
* While not stated on ''Series/{{Lost}}'' itself,the AlternateRealityGame ''ARG/TheLostExperience'' states that the [[ArcNumber numbers]] (4, 8, 15, 16, 23, 42) are [[spoiler:parameters in the Valenzetti equation used to derive the time remaining before humanity's extinction]].

* ''Music/RhapsodyOfFire'' song "The Mystic Prophecy of the Demonknight " has the narrator mention the heroes using "black geometry" to create a bridge over a deep chasm. When being pursued on the way back, they don't have enough time to work it out and are forced to make a LeapOfFaith.

[[folder:Newspaper Comics]]
* ''ComicStrip/BloomCounty'': 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.

[[folder:Tabletop Games]]
* In ''TabletopGame/DungeonsAndDragons'' 3.5's ''Complete Arcane'' rulebook, there is a PrestigeClass 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.
* ''TabletopGame/{{Pathfinder}}'' has the Sacred Geometry feat, which turns spellcasting into a minigame resembling ''Series/{{Countdown}}''. A player who wants to add certain metamagic effects to their spell can roll several dice. If they can reach a specific target number by adding, subtracting, multiplying, and dividing the values of the dice, then they get to apply the metamagic "for free" (i.e. without using a higher-level spell slot).
* In ''TabletopGame/VampireTheMasquerade'', one branch of Tremere [[BloodMagic Thaumaturgy]] concerns itself with Kabbalah, Jewish mysticism heavily based in numerology derived from the Torah. In the same way other magi would seek out a person or thing's [[IKnowYourTrueName True Name]], Kabbalists use calculations to derive someone or something's [[SympatheticMagic True Number]]. Blood magic as derived through math. It's worth noting that, like basically all magic in the ''TabletopGame/OldWorldOfDarkness'' -- blood, hedge, or mortal magick -- this method only serves as a focus for the user's will. The equations need to have conscious intent in order to reshape reality. Hence why numbers scrawled on primary school blackboards don't end up melting the instructor's face.

* In VideoGame/DungeonsOfDredmor, 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!
* ''VideoGame/TheWorldEndsWithYou'': Minamimoto summons a nuke by initializing the Level ''i'' Flare, which consists of [[MouthfulOfPi reciting pi to 150 digits]]. Of course, there are a lot of people capable of reciting pi to 150 digits, but [[CrazyAwesome they aren't Minamimoto]], and they don't have a [[ItMakesSenseInContext graffiti covered dead end alleyway and eldritch tattoos]].
** Fun bit of math[=/=]''Franchise/FinalFantasy'' 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'', across all possible realities. Useful when your target can travel through dimensions.
* The ''VideoGame/FinalFantasyTactics'' 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.
* ''VideoGame/FinalFantasyVII'' has an interesting example: When [[OneWingedAngel Safer Sephiroth]] casts [[OverlyLongFightingAnimation 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. Still, 75% good scientific formulae being used in a magic spell is better than average.
** FridgeLogic (or EpilepticTrees, depending on who you talk to): the area of a circle can be used calculate the distribution of impact force over a target area, so could theoretically useful. Its also possible to use a derived equation, √(A/π)=R to calculate a radius based on a given cross sectional area- for example, exactly how big the nova's blast would have to be to stretch to reach the battlefield and stop exactly as it does.
** This is echoed in ''VideoGame/{{Dissidia|FinalFantasy}}'': When doing Supernova as his [[LimitBreak EX Burst]], Sephiroth will begin chanting the equations, which briefly appear on-screen.
* Rita's non-spell special attacks in ''VideoGame/TalesOfVesperia'' take the form of mathematical equations.
* Reinhart Manx, the playable mage character in ''VideoGame/DungeonSiege III'' employs both this and {{Magitek}}, using the power of math rather than fireballs.

[[folder:Visual Novel]]
* In ''VisualNovel/UminekoWhenTheyCry'', the PowerLevels for Leviathan and [[spoiler:Kyrie]] 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, [[spoiler:Kyrie]] is shown actually chanting her formula as she runs to give her husband (flirting with a younger girl) what for.
* ''VisualNovel/ChaosHead'': fun[[superscript:10]] × int[[superscript:40]] = [=Ir2=], [[spoiler:the equation Takumi discovered in elementary school and the basis of the Noah Project]].

[[folder:Web Comics]]
* In a game of ''[[MagicAmpersand Dungeons & Discourse]]'' in ''Webcomic/DresdenCodak'', Kim Ross plays a "Bayesian Imperimancer".
-->'''Kim''': I am 87% confident you will burst into flames. (*''fwoosh''*)
** Bayesian probability concerns itself with the likelihood 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 (because it's probably a TwoHeadedCoin). 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.
* ''Webcomic/{{Erfworld}}'' has Mathamancy, which involves "analyzing probabilities," "predicting outcomes," and "the raw calculations thereof." It should be noted, however, that Mathamancy in Erfworld (or at least [[{{Protagonist}} Parson]]'s Mathamancy Bracer) seems to be more than merely math from the real world: for example, Parson has a magical deal to give [[ChessMaster Charlie]] twelve Mathamancy calculations whenever he wants. At one point, when negotiating whether to give up the deal in exchange for information, Charlie asked Parson to calculate whether the information was worth the nine calculations remaining. The answer was that there was a probability of 4% that it was worth the exchange, something that should not be possible to calculate.
* The last panel of ''{{Webcomic/xkcd}}'' [[http://xkcd.com/804/ #804]] treats the (very counter-intuitive) [[https://en.wikipedia.org/wiki/Banach%E2%80%93Tarski_paradox Banach-Tarski paradox]] as a result you can get in real life if you take the axiom of choice.
** [[http://xkcd.com/687/ Comic #687]] abuses dimensional analysis to "prove" that certain absurd constants must be related by some fundamental law. So if they build a better Prius, either England must drift out to sea, or the pressure at the Earth's core must rise slightly.
* The Khert in ''Webcomic/{{Unsounded}}'' is a BackgroundMagicField that oversees the setting's reality and powers its magic system, [[SufficientlyAnalyzedMagic pymary]]. The [[MagicalIncantation incantations]] for spells are a very precise shorthand describing which materials and physical properties are to be manipulated and how. Logic errors, on the other hand, get messy: when someone tried to liquefy a material that turned out to be saturated with water already, the Khert glitched and melted his casting hand instead.

[[folder:Web Original]]
* ''FineStructure'' uses science, not magic. In later stories, scientists fluent in [[http://tvtropes.org/pmwiki/pmwiki.php/Main/LanguageOfMagic Eka]] can unlock the "The simple knowledge of an equation is powerful in itself" kind of formulaic magic. [[spoiler:It's also revealed that the universe, or more accurately the imprisoning god, doesn't like anyone messing around with Eka.]]
** ''Literature/{{Ra}}'', by the same author, is about actual magic, which is a poorly-understood branch of physics. Magic is accessed by reciting specific incantations while performing mental exercises stated to be not dissimilar to solving differential equations. More generally, spells also require a lot of math to design, and resemble computer programs (right down to concepts like modularity, recursion, and writing interpreters to parse gestures as incantations).
* [[http://www.scp-wiki.net/scp-033 SCP-033]] of the ''Wiki/SCPFoundation'' is an equation which adds up to a "missing number", an integer which non-paranormal mathematics has somehow missed. If it's recorded in any sort of computing device or written on machine-made paper, whatever it's recorded on starts to physically degrade.
** [[http://www.scp-wiki.net/scp-233 SCP-233]] is a 23-sided (impossible) polyhedron that magically accelerates calculations done in base-23 but reacts extremely violently to the number [REDACTED] and causes rounding errors in every calculation not done in base-23.

[[folder:Western Animation]]
* ''WesternAnimation/LooneyTunes'' has Egghead Junior, who can [[AwesomenessByAnalysis 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 ''WesternAnimation/CampLazlo'', being flipped upside down gradually changes the TooDumbToLive 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 [[FlowersForAlgernonSyndrome turn right back into idiots]].
* There's a DonaldDuck 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.

[[folder: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 that the square roots of non-square integers were irrational (square roots being very important when dealing with, y'know, the Pythagorean theorem), 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, [[TeleportersAndTransporters teleporting]] and becoming [[IntangibleMan intangible]] at will. While that's technically true (if oversimplified), today it's believed that, if higher spatial dimensions such as hyperspace exist, they're curled up far too small for human beings to move through, and/or necessitate immense amounts of energy in order to access.
* The notion to get as close as possible to Quantum Physics is quite strong in modern Chaos Magick, of which a prominent example is the Octavo: A Roundworld Edition, a spellbook consisting of eight formulae-spells, by Peter Carroll.