Free phonon propagator in imaginary time The free phonon propagator in Matsubara space is given by
$$D^0(i\omega_n)=\frac{1}{M}\frac{1}{(i\omega_n)^2-\Omega^2}.$$
I want to derive its representation in imaginary time. I know the result should be
$$D^0(\tau) = -\frac{1}{2M\Omega}\frac{\cosh[\Omega(\beta/2-|\tau|)]}{\sinh(\Omega\beta/2)}.$$
This is what I've got:
$$D^0(\tau)=\frac{1}{\beta}\sum_{i\omega_n}e^{-i\omega_n\tau}D^0(i\omega_n) = \frac{1}{2M\beta\Omega}\sum_{i\omega_n}e^{-i\omega_n\tau}\left[\frac{1}{i\omega_n-\Omega}-\frac{1}{i\omega_n+\Omega}\right]$$
Now, I use the usual tricks involved in Matsubara summation: I interpret the sum to be over the poles of $n_B(z)=1/(e^{\beta z}-1)$ which have residue $1/\beta$, flip the integration contour (getting a negative sign), and carry out the integral by summing over the poles at $z=\pm\Omega$. This gives:
$$=-\frac{1}{2M\Omega}\left[e^{-\Omega\tau}\frac{1}{e^{\beta\Omega}-1} - e^{\Omega\tau}\frac{1}{e^{-\beta\Omega}-1}\right] = -\frac{1}{2M\Omega}\frac{\cosh[\Omega(\beta/2+\tau)]}{\sinh(\Omega\beta/2)}$$
which is correct for $-\beta<\tau<0$. How does the absolute value arise? What am I missing?
 A: I figured it out myself. The complex function used in the summation is
$$g(z) = e^{-z\tau}\left[\frac{1}{z-\Omega}-\frac{1}{z+\Omega}\right]$$
One can then write
$$\sum_{i\omega_n}g(i\omega_n) = \sum_{i\omega_n}\text{Res}[g(z)n_B(z)]_{z=i\omega_n} = \oint\mathrm dz\ g(z)n_B(z)$$
Then, one flips the contour and evaluates it as a sum over the poles of $g$. This can be done by the use of Jordan's lemma if $g(z)n_B(z)$ decays fast enough. And this is where things went wrong in my question:
$$g(z)n_B(z)\sim \frac{e^{-z\tau}}{e^{\beta z}-1}\sim \begin{cases}
\mathrm{Re}(z)>0: & e^{-(\beta+\tau)z}\to 0\\
\mathrm{Re}(z)<0: & e^{-z\tau}\to\begin{cases}
0, & \tau<0\\
\infty, & \tau>0
\end{cases}
\end{cases}$$
So if $\tau<0$, the integrand is exponentially small away from the origin of the complex plane and that's why the result matched in that case. However, for $\tau>0$, things fall apart. Then, instead of using the Bose function $n_B(z)$, one has to use a modified function,
$$\tilde n_B(z)=\frac{1}{e^{-\beta z}-1}$$
which will ensure that $g(z)\tilde n_B(z)$ decays for positive imaginary times. Indeed, this gives the desired result and the solutions for both $\tau<0$ and $\tau>0$ can be combined into one formula using $|\tau|$, as stated in the question.
I hope this helps someone avoid spending as much time on this triviality as I have.
