The nondenominational service at the Frauenkirche, or Church of Our Lady, was the first of two memorial events today. Gauck was speaking later at an event in Bavaria's state parliament.
An 18-year-old German-Iranian man killed nine people and wounded over 30 others at a McDonald's restaurant and shopping mall in the city. He then killed himself.
Officials have said the gunman was a withdrawn loner obsessed with playing "killer" video games who had been treated for depression and psychiatric problems.