I am interested in finding the Green's function (GF) for the undamped forced harmonic oscillator equation: $$\Big(\frac{d^2}{dx^2}+\omega_0^2\Big)x(t)=f(t).$$ In order to find the GF, start by define it: $$\Big(\frac{d^2}{dx^2}+\omega_0^2\Big)G(t-t')=\delta(t-t').$$ First denoted $\tau\equiv t-t'$ and consider the Fourier transform $$G(\tau)=\frac{1}{\sqrt{2\pi}}\int\limits_{-\infty}^{+\infty}\tilde{G}(\omega)e^{i\omega \tau}d\omega,~ \delta(\tau)=\frac{1}{2\pi}\int\limits_{-\infty}^{+\infty}e^{i\omega\tau}d\omega$$ which redialy gives $$\tilde{G}(\omega)=\frac{\sqrt{2\pi}}{\omega^2-\omega_0^2}\Rightarrow G(\tau)=\int\limits_{-\infty}^{\infty}\frac{e^{i\omega\tau}}{(\omega+\omega_0)(\omega-\omega_0)}d\omega$$ i.e., the integral has simple poles at $\omega=\pm\omega_0$
For $\tau>0$, there are three ways in which a closed semicircular contour can be chosen to enclose the poles.
$1.$ Both the poles $-\omega_0$ and $+\omega_0$ can be included in the contour, by choosing two small semicircular indentations in the lower half-plane around $-\omega_0$ and $+\omega_0$. In this case, the result is $G(\tau)=\frac{1}{\omega_0}\sin(\omega_0\tau)$.
$2.$ Both the poles $-\omega_0$ and $+\omega_0$ can be excluded from the contour, by choosing two small semicircular indentations in the upper half-plane around $-\omega_0$ and $+\omega_0$. In this case, the result is $G(\tau)=0$.
$3.$ The pole $-\omega_0$ is included from the contour while $+\omega_0$ is excluded. In this case, the result is $G(\tau)=\frac{i\pi}{\omega_0}e^{-i\omega_0\tau}$.
$4.$ The pole $+\omega_0$ is included from the contour while $-\omega_0$ is excluded. In this case, the result is $G(\tau)=\frac{i\pi}{\omega_0}e^{+i\omega_0\tau}$.
- Which one is the correct choice of contour to find $G(\tau)$ and why?