I recently saw "Proof", a wonderful play based very loosely on the life of
mathematician John Nash. Nash, who after an extremely prolific
early career (basically inventing mathematical game theory and
making major contributions to elliptic differential equations,
topology and geometry) literally went insane for most of the rest of
his life, with only brief lapses back into clarity. The play focuses on the daughter of a
deceased math professor of Nash's caliber, who seems to have inherited much
of her father's genius, as well as (she worries) his propensity toward
mental instability.
While the play is going on I am reminded of a lecture entitled "The
Madwoman in the Attic" from an undergraduate English course. The
course was taught by Elaine Showalter, but most of the ideas were
Sandra Gilbert's. Gilbert now has a book out with the same title,
subtitled "The Woman Writer and the NineteenthCentury Literary
Imagination". The madwoman reference, of course, is to Bertha in Jane Eyre,
but the book makes a larger commentary on the figure of the madwoman
in 19th C. literature, and how that image gets applied in a reflexive
way to the women writers themselves. Fascinating stuff, actually.
As I left the theater I couldn't get the figurative language of that
longago lecture out of my head. Something about that image kept
lingering in the foreground. The madwoman in the attic.
The madman in the basement.
That was it: I had seen this idea, the mathematician as madman, many
times before. And then I think: when have I not seen it? In my head I
start to run through portrayals of mathematicians in
movies, plays, the press. Hollywood likes to present characters in
stereotypes, of course, but we in turn have to view those portrayals as some sort
of telltale reflection of how we as a society imagine the targets of
the stereotype, or perhaps how we would like to imagine them. And
mathematicians, almost without exception, are portrayed as disturbed,
antisocial, and sometimes actually insane.
My first thought was that this is merely a stereotypical depiction of
high intelligence or brilliance, the "disturbed genius".
But in that case you would expect the same kind of portrayal of folks
like physicists, who instead tend to appear as eccentric,
absentminded and somewhat loveable, mostly in an
isn'titcutehehastroubledressinghimself kind of way.
Part of the problem, I imagine, is that there are plenty of Physics
"celebrities" in the popular press and imagination (Einstein, Hawking, Feynman, Penrose, GellMann, etc.) whereas the average moviegoer cannot name
even a single mathematician, much less a living one. (Quick...name two
living mathematicians. Betcha can't.) A friend of mine who teaches
math at the junior high school level asked his students to name as
many famous mathematicians as they could, living or dead. Lots of
hands apparently shot up, all of which with the intention to name
"Einstein". When he pointed out that Einstein was actually a
physicist, they were stumped in trying to name anyone further.
To make things worse, the one person associated with mathematics that
the public does know is the Unabomber. And the Unabomber has
emerged as a sort of prototypical figure that looms over the
mathematician in the same way that Einstein looms over the physicist.
The physicist is the amiable, frumpy guy in the labcoat making
incomprehensible scribbles on the chalkboard. The mathematician is
the scarylooking misanthrope building bombs in the basement.
It's difficult enough to find things with mathematicians in them at all, but
here are some examples:
(WARNING: many of these contain spoilers, and most of them are
good movies you might want to see someday. You've been warned.)

Pi (Darren Aronofsky; 1998): Perhaps the most convincing
example. A disturbed, antisocial mathematician living in a hovel of a
New York walkup filled with computers and paper stumbles upon a
numbertheoretic code that may unlock many of the secrets of
pseudorandom and random numbers. Once this is discovered everyone is
after him  faceless Wall Street corporations, cabalistic religious
organizations  as such knowledge, the film suggests, could literally
unravel the fabric of society. But by the end of the movie even he
doesn't want to know what he knows, because the more he comes to
understand the mathematics he has uncovered the more physical
pain he experiences, in the form of extreme headaches and a loud
ringing noise. In the end he chooses to literally drill into his
head to free himself and restore his sanity. Symbolically he
chooses ignorance over understandingmathematics is reduced to the
pain in our heads that drives us away from humanistic and societal
concerns. To try to comprehend its deeper secrets is to blur the
boundary between man and God, to overreach.

Good Will Hunting (Matt Damon; 1997): Damon plays a
university janitor from wrongsideofthetracks Boston who is a
natural, untrained mathematical genius. He is discovered by a
Fields medalwinning faculty member, who tries to mentor him, but
has trouble because the boy (despite being the kind of person who's
fun to go out and have a few beers with) has deeplyrooted emotional
problems. What's most disturbing about this film is the total lack of
intellectual and emotional joy that all parties seem to have with
mathematicsDamon's character seems to do it because he is cursed
with his ability and has to get it out of his system, while the MIT
mathematicians seem to all be cold and egotistical, interested more
in awards, fame and career advancement than the advancement of knowledge
and joy in acquiring it.

Proof (David Auburn, playwright, currently on Broadway
starring MaryLouise Parker): As mentioned above, about a daughter of a
world famous, recently deceased mathematician who lost his sanity for
most of the latter part of his career. Again, as in Pi, doing
mathematics, or at least really great mathematics, is associated with
insanity and mental instability. His daughter, played by Parker, lives alone and is
emotionally troubled.

Antonia's Line (1995). Examines five generations of women
and the lives they lead, beginning with a Dutch matriarch named Antonia.
Antonia's granddaughter Theresa becomes a mathematician, and is
portrayed as detached and coldhearted, at one point choosing to read
a paper on differential geometry instead of nursing her child.

Breaking the Code (Derek Jacobi, 1996): Chronicles the life
of mathematician Alan Turing, who (among other things) was
instrumental in breaking the German Enigma code in World War II, as
well as coming up with the famous Turing Machine idea that is
integral to computing and decidability. Turing was a homosexual, and
the film focuses on his feeling like a perpetual outsider in society,
both from his sexual preference in an era not at all ready to accept
such things and his mathematical abilities and interests. While the
film focuses on the social nonacceptance of being gay as the source of
Turing's instability and eventual suicide, it nonetheless creates the
association between mathematical ability and emotional instability and societal
withdrawal.

Presumed Innocent (Scott Turow (novel), also 1990 movie):
Bonnie Bedelia plays Harrison Ford's wife, who recently completed
her math Ph.D. In the end, she turns out to be the one that brutally
murdered her husband's mistress.
Compare these to the much more amiable depiction of physicists in
movies like I.Q. (Einstein) and Infinity (Feynman), as well as
plays such as Copenhagen and Tom Stoppard's works (Arcadia,
etc).
What's interesting about this sort of depiction is that it hasn't
always been this way. Science used to be scary; before
Dr. Einstein, the prototypical scientist figure was
Dr. Frankenstein. Early Hollywood is filled with blackandwhite
portrayals of the "mad scientist", surrounded by bubbling test tubes, highvoltage electrical wires and experimental
subjects strapped to tables. Science represented change and the
unknown, and people were scared of it. Movies like The Fly
telegraphed the message that some secrets of the natural world were
best left unexplored.
Then science started to make our lives so much better via the
technology it was pumping out on a regular basis that our scientists
turned into heroes. They harnessed the atom. They
unraveled the secrets of DNA. They put us on the
moon, and built the semiconductor. Mathematics played an integral
part in most of this, of course, but this is apparently lost on the
movie and theatregoing public.

References:
Internet movie database, www.imdb.com
"Math in the Movies", http://world.std.com/~reinhold/mathmovies.html