The term elegy has a long history. It originally, in ancient Greece, had two meanings. The first was a sorrowful or mournful poem sung to the accompaniment of aulos (an instrument sounding like a modern oboe). The second meaning referred to the meter in which such songs were often written, elegiac couplets, which consist of a hexameter followed by a pentameter line. One of the best imitations of this form in English is Coleridge's:
In the hexameter rises the fountain's silvery column;
In the pentameter aye falling in melody back.
As the form originated in songs of lament, and funerals are a common occasion for lamentation, the elegy evolved to become closely associated with funerals or laments over someone's death.
"Elegy Written in a Country Churchyard" by Thomas Gray is not written in elegiac couplets, but it is set in a graveyard and expresses mourning for death. It may have been written on the death of Gray's friend Richard West in 1742, but is itself a more general lament concerning human mortality.
The poem has a sustained melancholic tone. It begins with the line:
The curfew tolls the knell of parting day
This draws a parallel between the end of day and the end of human life in the graveyard. The elegiac tone is created by a series of terms suggesting absence, fading, sadness, weariness, darkness, and departure in the initial stanzas as well as images of solitude, twilight, and abandonment.