U2 was inspired to write 40 after attending a gospel choir performance in New York City. The choir ended their performance with a rendition of Psalm 40, which left a profound impact on lead singer Bono. He later wrote the song as a tribute to the choir and their performance.