Mad Mathematician
Imagination does not breed insanity. Exactly what does breed insanity is reason. Poets do not go mad; but chessplayers do. Mathematicians go mad, and cashiers; but creative artists very seldom. I am not, as will be seen, in any sense attacking logic: I only say that this danger does lie in logic, not in imagination.
Clearly, many writers (and viewers) fear and dread mathematics. On rare occasion, a character is found who possesses a defining trait of having delved deeply into the study of profound mathematical knowledge. These characters are, as a rule, insane. It is not necessarily clear whether advanced number theory is itself destructive to sanity (as with some forms of Formulaic Magic), or whether the insane are drawn to maths; nonetheless, the correlation seems to exist.
BunnyEars Lawyer mentions some Real Life examples of mathematicians who were a bit unhinged, so it's not completely unfounded in reality.
Many Mad Mathematicians will have a Room Full of Crazy with math equations.
See also Mad Scientist.
— G. K. Chesterton, Orthodoxy
Examples:
open/close all folders
Anime and Manga
 While he's not crazy in the usual sense, Daichi/Bastion Misawa of YuGiOh! GX does snap a bit more... strangely... during the White Society arc in season 2. The way he snaps out of it ain't pretty. His going insane was canonically because people weren't worshiping him as the brightest guy around anymore, but the snap back (which involved stripping, and then racing around in his birthday suit) was indeed, induced by math. As a side note, before the Freak Out he was the proud owner of a Room Full of Crazy that he regularly repainted just so he could cover the walls with formulas all over again.
 Moriakisensei from Soredemo Machi wa Mawatteiru looks like your average Stern Teacher at first, but he takes Mathematics way too seriously.
 Gamble Fish's Heavy Abandi is revealed to be one of these. In specific, he believes to discover a message from God itself within his mathematics. He tests whether or not he should share his discovery with anyone by suicidal exploits in hopes of testing whether or not God would protect him, ultimately leading to his Start To Darkness when he's electrocuted and believes he came Back from the Dead.
 The third season has Hell Girl has one of the villains of the week, Mizuragi Shogo, a mathematician who is obsessed with Hell because the Hell Girl sent his mother to Hell. Eventually, he was able to prove the existence of Hell and used the knowledge to create a device to keep Ai's minions away he could meet her on his own terms. To that end, he used hypnosis to artificially create a grudge against Tsugumi, who by that point has given up on trying to stop Ai from taking souls and is resigned to her fate. Shogo, Ai, Ai's minions and Tsugumi all get a resounding You're Insane! from Yuzuki. Eventually, Shogo's assistant banishes him to Hell so that several children who had been orphaned by Shogo's earlier inventions wouldn't make the contract at the cost of their own souls.
Comic Books
 In The DCU, the sentient Green Lantern mathematical progression Dkrtzy RRR was discovered by mad mathematician Timph Rye, who sought to prove that willpower could be derived formulaically. Dkrtzy RRR is itself of suspect mental stability; its tendency to corrode the minds of its enemies from the inside is... controversial among the ranks of the Corps.
 Fantastic Four: The Mad Thinker is a big brain mathemagician as well. He once managed to calculate how long it would take the Fantastic Four to invade an enemy fortress, take out the enemies, and escape, and had planted a bomb to go off exactly as they had left the building blowing up their mutual enemy but not the Four. How on Earth did he do that? 10 minutes to go in, factoring in the Human Torch's average temperature of 2000 celcius... carry the 2... divide by 5... leave 2 minutes for electric signals...
 *grabs black marker and crosses through entire sum* AARGH.
Film
 A Beautiful Mind. The whole movie, as well as the real person (John Nash) on whom it was based. As noted elsewhere, while the movie depicted his bout with schizophrenia, he wasn't exactly 'normal' before or after either.
 π. Max Cohen lives like a hermit, plagued by migraines and social anxiety as he dives into the mathematical heart of the universe. The closer he gets to the ultimate answer, the more insane he becomes. The only way he can achieve peace is to physically burrow out his mathematical ability by trepanning himself with a power drill.
 Proof. Entire movie (and, earlier, stage play) about a woman obsessed with the idea that she inherited both her father's mental illness and math abilities.
 John Givings from Revolutionary Road. After a mental breakdown, he's placed in the care of his parents. At first, he praises and admires the Wheelers for their desire to have something more out of life, rather than a conformist suburban existence. After they've abandoned these plans, he calls them out on their hypocrisy.
 Sherlock Holmes: A Game of Shadows conflates Professor Moriarty's legitimate mathematical research with his criminal career, especially if you read any of the articles on the actual (nonevil) mathematicians the filmmakers consulted with in order to design his personal financial code. [1]
Literature
 Sigismund Arbuthnot the mad maths master, in the molesworth stories.
 Sir Austin Cardynge in the Lensman books, who in this respect can outthink even the superman Second Stage Lensmen (but not Arisians). We are told that he can actually think in the symbology of higher mathematics.
 In the Sherlock Holmes canon, Professor Moriarty is described as having a background in mathematics, although that doesn't really figure into his criminal career. (Some of the many adaptations place more emphasis on it, though.)
 John Givings from Revolutionary Road (see above).
 Mavolio Bent from the Discworld book Making Money. A man who could see the answer to an equation just by looking at it. Considers making a mistake to be the worst of sins one could ever do. Absolutely abhors all things he considers silly, which includes most things. Once strangled a professional assassin to death with a humorous pink elephant made of balloons when his tenuous hold on reality went byebye and he embraced his clown heritage.
 A more harmless example is the Talkative Loon Bursar of Unseen University. Mad as a spoon (in recent years, he's gotten better, mostly because the university staff hit upon the idea of using medication to have him hallucinate he was sane, the same way most people do), but can be calmed by asking him a complicated mathematical question, which he can figure out in about a second.
 Or rather, asking him the mathematical question can be used as an effective gauge of his health; it won't necessarily calm him down, but, if you consider that he's a bursar as well as being The Bursar, making sure he can actually do his job is pretty much the only thing you can really ask of him. Unfortunately, in The Science of Discworld he discovered advanced mathematics, and as of Unseen Academicals it's up to Ponder Stibbons to make sure things add up because the Bursar now "regards the decimal point as a nuisance".
 A more harmless example is the Talkative Loon Bursar of Unseen University. Mad as a spoon (in recent years, he's gotten better, mostly because the university staff hit upon the idea of using medication to have him hallucinate he was sane, the same way most people do), but can be calmed by asking him a complicated mathematical question, which he can figure out in about a second.
 In Dragaera, the Dragaerans of the House of the Athyra who study pure logic and philosophy tend to become cold and evil, driven to pursue their studies at the expense of anything and anyone.
 The math monks of Anathem probably aren't mad, but their very sequestered lifestyle gets them pretty close. Of course, many in the outside world believe they actually are Mad Mathematicians. In the past, several Centenarian "math monks" actually did go mad, resulting in the coining of the slang term "to go Hundred", meaning "to go mad".
 HP Lovecraft was never outright against mathematics, but it did seem to have some unfortunate consequences for his characters. For what is probably the most obvious example, in "Dreams in the WitchHouse" a brilliant young mathematician moves into said house precisely because of hints that its most infamous former inhabitant of over two hundred years ago might have possessed certain mathematical knowledge — notably about the geometry of space and time — not yet actually (re)discovered by modern science. It does not end well, partly because it turns out that said witch is actually still alive and still as nasty as ever.
Live Action TV
 The client in the Burn Notice episode "Signals and Codes" is a cryptanalytic genius who's uncovered a conspiracy to sell government secrets, but he believes it's a conspiracy by evil aliens against good aliens who send him messages on beams of light. He's a schizophrenic who's been in and out of psych wards for years. He eventually gets a job and meds.
 Winifred Burkle in Angel was a gifted young physicist who got trapped in Another Dimension (more specifically, a demonruled, medievallevel Crapsack World where humans are treated like cattle) for five years. She quickly recovered and became one of the main characters after returning with the heroes to Los Angeles, but when they first met her she'd taken to scribbling equations on cave walls...
Angel: Fred here might be able to help us with that. She knows a lot about portals.Fred: Not a lot. The trionic speechcraft formulation/modification has to alter the dynamicreality sphere. Lutzbalm predicted it at Zurich in '89. Laughed him off the stage, although this slavery and degradation's no laughing matter. (suddenly laughs insanely for a minute and then abruptly stops) It's no Cruggrain and Kalla berry breakfast alright.Angel: ...she's been here a while.
 In the sitcom Committed, this is a Defied Trope for Nate, who comes from a family of geniuses who tend to eventually go insane. Though he studied physics at Yale, he works in a used record store in an effort to avoid his relatives' fate. It's only partially successful.
 The Doctor from Doctor Who, to some extent. According to The DW Wiki, the Time Lords used rather scary mathematics to grow TARDISes, among other things. The Doctor is no exception to this.
"Any number that reduces to one when you take the sum of the square of its digits and continue iterating it until it yields 1 is a happy number, any number that doesn't, isn't. A happy prime is both happy and prime. Now type it in! I dunno, talk about dumbing down. Don't they teach recreational mathematics anymore?"
 Excess math would certainly account for The Doctor's eccentric nature, not that he needs another excuse.
 The unsub in the Criminal Minds episode "Derailed" had to take a few years off from his groundbreaking work on Mtheory to be involuntarily committed due to his violent schizophrenia.
 Cassie in The Librarians 2014 has extreme mathematical abilities (she can calculate in seven dimensions in her head) and synesthesia which in combination can make her constantly repeat certain phrases or pass out under the load of too much information.
Music
 Doctor Steel is a mad scientist who sings about the Fibonacci Sequence.
 Jonathan Coulton is apparently of the opinion that now and again, a great mathematician will come along and actually decrease the madness of the field by solving or figuring out something that had been flummoxing his compatriots, if the first verse of the song Mandlebrot Set is anything to go by.
"Pathological monsters!" cried the terrified mathematician
Every one of them is a splinter in my eye
I hate the Peano Space and the Koch Curve, I fear the Cantor Ternary Set
And the Sierpinski Gasket makes me want to cry
And a million miles away, a butterfly flapped its wings
On a cold November day, a man named Benoit Mandelbrot was born
Video Games
 The World Ends with You has Sho Minamimoto, who shouts trigonometric functions when attacking, gives out missions like "Beat the bosses of 2.2360679's 0 + 5. t = 60 min."^{note } , is the trope image for Mouthful of Pi and is also a complete psychopath. To get an idea, see the quote page. (You zetta sons of digits.)
 The game Pi R Squared has the Excuse Plot that you're a mathematician who's gone inside his own mind to try and collect various mathematical formulas and avoid going insane.
 The BioShock DLC Minerva's Den has Reed Wahl, the coinventor of the supercomputer known as The Thinker whose splicing induced madness manifested in a delusion of the existence of a 'predictive equation' that would allow him to see the future, the "discovery" of which depended on The Thinker. The titular Minerva's Den is covered in numbers and algebraic symbols in paint, chalk and blood from dozens of corpses, all presumably Wahl's work. Wahl also has the habit of stating that pretty much all of Sigma's actions (including dying) have either been foreseen by the Thinker or that they're "slightly behind schedule".
 N from Pokémon Black and White shows tendencies towards this. He adores functions and formulas, carries a Menger Sponge accessory, and he's trying to "solve the equation to change the world". His OneLetter Name even fits, since "n" is frequently used as a variable in math equations. However, he's not so much insane as he is... horribly misguided, a sheltered and abused Man Child Tyke Bomb designed to destroy Unova's political system so his Treacherous Advisor can take over, and convinced that Humans Are Bastards.
 OFF has Theme Naming in the attacks of all characters and most enemies. Guess what the attacks of the most powerful nonboss enemies, the Secretaries, are named after. The Zone 3 Secretaries Vertical Limit is easily the hardesthitting attack in the game. The same Zone 3 Secretaries can also Divide By Zero, which doesn't cause a RealityBreaking Paradox (maybe because reality is already broken) but can inflict some nasty status conditions.
 Kazuaki from Hatoful Boyfriend is a narcoleptic mathematician. And his calm exterior is a complete front  he's been mad with grief and desire for revenge ever since the death of his brother.
Western Animation
 Kim Possible: The Mathster
 Dexter's Laboratory: The Evil MathMagician
Real Life
 As mentioned above, there seems to be a tendency for mathematicians to go mad.
 Although, in the same vein as a Psychic making 50 correct predictions and 7,000 incorrect ones, the exceptional examples tend to be remembered. It should also be noticed Human Calculators are not mathematicians, merely very good at one task through repetition, so any of those who go mad don't count. We do tend to die young though, as G.H. Hardy notes:
Galois died at 21, Abel at 27, Ramanujan at 33, Riemann at 40...
 Worth nothing, perhaps, that Galois was shot in a politics related duel, while Abel and Riemann died of tuberculosis and Ramanujan of misdiagnosed Amoebiasis. So perhaps the real lesson is Try not to get sick while you reinvent mathematics.
 It's a common opinion that math and physics are fields for young people since they require an ability to learn very quickly and see things creatively, implications that weren't even dreamed of before. As one ages, these abilities dull. This same creativity is also often held to be responsible for the eccentricity in many great mathematicians. This being said, truly great practitioners of anything are inherently exceptions.
 Although, in the same vein as a Psychic making 50 correct predictions and 7,000 incorrect ones, the exceptional examples tend to be remembered. It should also be noticed Human Calculators are not mathematicians, merely very good at one task through repetition, so any of those who go mad don't count. We do tend to die young though, as G.H. Hardy notes:
 Ted Kaczynski (aka the Unabomber) was a mathematical prodigy who earned his doctorate in one year before he sent 16 bombs to targets including universities and airlines, killing three people and injuring 23.
 Paul Erdős lived as a virtual vagrant and yet was so influential and prolific that he's the Kevin Bacon of mathematics. (That is to say, mathematically inclined people have an Erdős number, as opposed to the film industry's Bacon number. Some people in show business who have also seen certain forms of higher education even have an ErdősBacon number. They are deeply envied.) Not to mention he had an interesting Personal Dictionary. He said that all the great equations were written in The Book. Which book? God's (or as he put it the "Supreme Fascist's") book, which was selfishly guarded  most likely in the same place He hid socks, passports, and other small items.
 More precisely, Kevin Bacon is the Paul Erdős of show business. Erdős came first.
 It was really a thing he was playing around with  even calling it a joke several times when asked about it in the biographical film N Is A Number. It's a bit easier to understand when you realize English was not nearly his first language. Though he sometimes had difficulty expressing himself, he used English like an ordinary person the vast majority of the time he used it.
 Erdős, like many great mathematicians, was a phenomenal amphetamine addict. As any longtime user (mathematician or otherwise) will tell you, speed tweaks your brain.

Um, no, noooo he wasn't. He had ADHD. And amphetamine is a medicine for ADHD.There is some speculation as to whether or not this is true. Additionally this article suggests that his use of amphetamine began shortly after his mother's death, beginning after he had tried antidepressants for a time.
 According to The Other Wiki, Erdős was bet a sum of money by a fellow mathematician that he couldn't give up the amphetamines for a month. He did, won the bet, and went right back to taking amphetamines, claiming that while he was abstaining, it destroyed his ability to do math ("Before, when I looked at a piece of blank paper my mind was filled with ideas. Now all I see is a blank piece of paper.").
 Georg Cantor, a little bizarre to begin with, ended up spending much of his last years in sanatoriums  still trying to correlate the various orders of infinity.
 Lewis Carroll was a mathematician. Coincidentally, he also allegedly suffered from epilepsy and a rare condition that causes a person to perceive the size of objects incorrectly which is actually named after Alice in Wonderland. His background as a mathematician and logician, as well as his experiences with mental illness, were the inspiration to some of the more cerebral elements of his writing. Drugs on the other hand, not so much.
 In fact, the Wonderland series was an attack on the "new mathematics" coming into vogue in Carroll's time. This included such things as imaginary numbers, abstract algebras, nondecimal bases, and limits. As usual, TOW has something to say on the subject.
 The mathematicians of Dangerous Knowledge (including the aforementioned Georg Cantor) went mad trying to figure out infinity.
 In his later years, Kurt Gödel began to suffer mental instability, to the point where he started to think someone was trying to poison him and only ate food that his wife, Adele, made for him. When Adele was hospitalized, Gödel refused to eat anything, and eventually starved to death.
 The introductory historyofthefield segment of Advanced Logic classes seem to go: Brilliant Theorist > Spectacular Achievement/Contribution > Insanity > Bizarre Death > Rinse and Repeat. It instills some serious trepidations about entering the discipline.
 John Nash.
 Nikola Tesla was brilliant at math. He was also nuts. Luckily, he wasn't evil or violent.
 Though he did claim to have designed a Death Ray capable of obliterating any target on Earth at the drop of a hat. Presumably the only reason he didn't take over the world was that investors weren't sure what place they would have in Tesla's New Order.
 He also claimed that his resonator could cause earthquakes, and at one point calculated that if he ran it for long enough, it would shake the earth into pieces. He commented "I considered this an undesirable outcome and switched it off." See? Not crazy at all.
 In the text the first page quote came from, Chesterton attributed Poe's madness to his obsession with math puzzles instead of poetry.
 Andrew Wiles (the man who finally proved Fermat's Last Theorem) claims that he'd probably have gone mad from the effort of doing so, if he hadn't made time to play with his children every day.
 He once noted that he almost did go insane out of frustration in 1993, when he found a fault in his almost complete proof. Luckily he was able to patch it up in just one year, though he still took some time to polish it, finally publishing in 1995.
 He has no known mental illness, but Juergen Schmidhuber's webpage makes him look strongly suspicious. Being a logic and AI theorist does not help.
Attention, you factoring Hectopascals! (It's x 2)DIE!!