* "Elegy to" is used when referring to the recipient of the elegy, the person or thing being mourned.
* Example: "She wrote an elegy to her late husband."
* "Elegy for" is used when referring to the subject of the elegy, the person or thing that has died or passed away.
* Example: "The poet penned an elegy for the fallen soldiers."
In essence, "to" points towards the mourner, while "for" points towards the deceased.