Nietzsche stated, after communicating the main idea of Zarathustra along with an aspect of his gaya scienza, in Ecce Homo: "...that Hymn to Life...—a scarcely trivial symptom of my condition during that year when the Yes-saying pathos par excellence, which I call the tragic pathos, was alive in me to the highest degree. The time will come when it will be sung in my memory" (trans. Walter Kaufmann). The composition Hymn to Life was partly done by Nietzsche in August and September 1882, supported by the second stanza of the poem Lebensgebet by Lou Andreas-Salome.
In 1884, Nietzsche wrote to Gast: "This time, 'music' will reach you. I want to have a song made that could also be performed in public in order to seduce people to my philosophy." With this request, Gast reworked Lebensgebet into Friendship, and it was orchestrated by Pietro Gasti, who modestly denied any reference in publication to his alterations to what Nietzsche had done previously. (Some, including Benjamin Moritz, feel these changes are significant enough to consider Life not an work by Nietzsche, but by Köselitz.) In the summer of 1887, E. W. Fritzsch in Leipzig published the work under Nietzsche's name as the first edition, which is Friendship simply put to Andreas-Salome's Lied and with orchestral alterations, entitled Hymnus an das Leben.
In October of the same year, Nietzsche wrote a letter to the German conductor Felix Mottl, saying about Life: "I wish that this piece of music may stand as a complement to the word of the philosopher which, in the manner of words, must remain by necessity unclear. The affect of my philosophy finds its expression in this hymn." The following December, he wrote to Georg Brandes a letter in which he commented: "A choral and orchestral work of mine is just being published, a Hymn to Life. It is the one composition of mine that is meant to survive and to be sung one day 'in my memory'...."