A mathematical joke is a form of humor which relies on aspects of mathematics or a stereotype of mathematicians to derive humor. The humor may come from a pun, or from a double meaning of a mathematical term, or from a lay person's misunderstanding of a mathematical concept. Mathematician and author John Allen Paulos in his book Mathematics and Humor described several ways that mathematics, generally considered a dry, formal activity, overlaps with humor, a loose, irreverent activity: both are forms of "intellectual play"; both have "logic, pattern, rules, structure"; and both are "economical and explicit".
Some performers combine mathematics and jokes to entertain and/or teach math.
Humor of mathematicians may be classified into the esoteric and exoteric categories. Esoteric jokes rely on the intrinsic knowledge of mathematics and its terminology. Exoteric jokes are intelligible to the outsiders, and most of them compare mathematicians with representatives of other disciplines or with common folk.
Some jokes use a mathematical term with a second non-technical meaning as the punchline of a joke.
Q. What's purple and commutes?
A. An abelian grape. (A pun on abelian group.)
The joke has numerous variants, such as
Q: What’s sour, yellow, and equivalent to the Axiom of Choice?
A: Zorn’s Lemon.
Occasionally multiple mathematical puns appear in the same jest:
When Noah sends his animals to go forth and multiply, a pair of snakes replies "We can't multiply, we're adders" — so Noah builds them a log table.
This invokes five double meanings: adder (snake) vs. addition (algebraic operation); multiplication (biological reproduction) vs. multiplication (algebraic operation); log (cut tree trunk) vs. log (logarithm); multiplication is done by adding logs (mathematical logarithm); finally, table (set of facts) vs. table (piece of furniture).