A limerick is a form of verse, often humorous and sometimes obscene, in five-line, predominantly meter with a strict rhyme scheme of AABBA, in which the first, second and fifth line rhyme, while the third and fourth lines are shorter and share a different rhyme.  The following example is a limerick of unknown origin:
The limerick packs laughs anatomical
Into space that is quite economical.
But the good ones I've seen
So seldom are clean
And the clean ones so seldom are comical.
The form appeared in England in the early years of the 18th century. It was popularized by Edward Lear in the 19th century, although he did not use the term. Gershon Legman, who compiled the largest and most scholarly anthology, held that the true limerick as a folk form is always obscene, and cites similar opinions by Arnold Bennett and George Bernard Shaw, describing the clean limerick as a "periodic fad and object of magazine contests, rarely rising above mediocrity". From a folkloric point of view, the form is essentially transgressive; violation of taboo is part of its function. Lear is unusual in his creative use of the form, satirising without overt violation.
The standard form of a limerick is a stanza of five lines, with the first, second and fifth rhyming with one another and having three feet of three syllables each; and the shorter third and fourth lines also rhyming with each other, but having only two feet of three syllables. The defining "foot" of a limerick's meter is usually the anapaest, (ta-ta-TUM), but catalexis (missing a weak syllable at the beginning of a line) and extra-syllable rhyme (which adds an extra unstressed syllable) can make limericks appear amphibrachic (ta-TUM-ta).
The first line traditionally introduces a person and a place, with the place appearing at the end of the first line and establishing the rhyme scheme for the second and fifth lines. In early limericks, the last line was often essentially a repeat of the first line, although this is no longer customary.
Within the genre, ordinary speech stress is often distorted in the first line, and may be regarded as a feature of the form: "There was a young man from the coast;" "There once was a girl from Detroit..." Legman takes this as a convention whereby prosody is violated simultaneously with propriety. Exploitation of geographical names, especially exotic ones, is also common, and has been seen as invoking memories of geography lessons in order to subvert the decorum taught in the schoolroom; Legman finds that the exchange of limericks is almost exclusive to comparatively well-educated males, women figuring in limericks almost exclusively as "villains or victims". The most prized limericks incorporate a kind of twist, which may be revealed in the final line or lie in the way the rhymes are often intentionally tortured, or both. Many limericks show some form of internal rhyme, alliteration or assonance, or some element of word play. Verses in limerick form are sometimes combined with a refrain to form a limerick song, a traditional humorous drinking song often with obscene verses.
David Abercrombie, a phonetician, takes a different view of the limerick, and one which seems to accord better with the form. It is this: Lines one, two, and five have three feet, that is to say three stressed syllables, while lines three and four have two stressed syllables. The number and placement of the unstressed syllables is rather flexible. There is at least one unstressed syllable between the stresses but there may be more - as long as there are not so many as to make it impossible to keep the equal spacing of the stresses.
The origin of the name limerick for this type of poem is debated. The name is generally taken to be a reference to the City or County of Limerick in Ireland sometimes particularly to the Maigue Poets, and may derive from an earlier form of nonsense verse parlour game that traditionally included a refrain that included "Will [or won't] you come (up) to Limerick?"
Until recently,[when?] the first known usage in England was from 1898 (New English Dictionary) and in the United States from 1902, but in recent years several earlier examples have been documented, the earliest being an 1880 reference, in a Saint John, New Brunswick newspaper, to an apparently well-known tune,
There was a young rustic named Mallory,
who drew but a very small salary.
When he went to the show,
his purse made him go
to a seat in the uppermost gallery.
Tune: Won't you come to Limerick.
The limerick form was popularized by Edward Lear in his first Book of Nonsense (1846) and a later work, More Nonsense, Pictures, Rhymes, Botany, etc. (1872). Lear wrote 212 limericks, mostly considered nonsense literature. It was customary at the time for limericks to accompany an absurd illustration of the same subject, and for the final line of the limerick to be a variant of the first line ending in the same word, but with slight differences that create a nonsensical, circular effect. The humor is not in the "punch line" ending but rather in the tension between meaning and its lack.
The following is an example of one of Edward Lear's limericks.
There was a Young Person of Smyrna
Whose grandmother threatened to burn her.
But she seized on the cat,
and said 'Granny, burn that!
You incongruous old woman of Smyrna!'
Lear's limericks were often typeset in three or four lines, according to the space available under the accompanying picture.
The limerick form is so well known that it has been parodied in many ways. The following example is of unknown origin:
There was a young man from Japan
Whose limericks never would scan.
And when they asked why,
He said "I do try!
But when I get to the last line I try to fit in as many words as I can."
Other parodies deliberately break the rhyme scheme, like the following example, attributed to W.S. Gilbert:
Comedian John Clarke has also parodied Lear's style:
There was an old man with a beard,
A funny old man with a beard
He had a big beard
A great big old beard
That amusing old man with a beard.
The British wordplay and recreational mathematics expert Leigh Mercer (1893-1977) devised the following mathematical limerick:
This is read as follows: