Green function for simple harmonic oscillator I'm interested in examples on how to use Green function (GF)for simple harmonic oscillator (SHO)? I am from  undergrad physics, so I need a fundamental math and quantum mechanical application of GF for SHO. If a frequency is given, then how can I use Green function to get all deformation poles of the function and the boundary condition?
 A: Let me continue on from BeastRaban's exposition: In 1866, Mehler figured out how to carry out the sum for the $u_n(x)$ eigenfunctions of the quantum harmonic oscillator, Hermite polynomials, adding them all to an elegant and compact  eponymous Mehler kernel, 
or equivalently.
The Green's function (propagator) for the quantum harmonic oscillator is then:
$$
K(x,x';t)=\left(\frac{m\omega}{2\pi i\hbar \sin \omega t}\right)^{\frac{1}{2}}\exp\left(-\frac{m\omega((x^2+x'^2)\cos\omega t-2xx')}{2i\hbar \sin\omega t}\right) ~.
$$ 
Consequently, given a configuration at t=0, in general a superposition of lots of components with characteristic frequency each and every one of them, you now know how the quantum oscillator hamiltonian will propagate it to arbitrary time t:
$$
\psi(x,t) = \int_{-\infty}^\infty  K(x,x';t) \psi(x',0)  ~ dx'.$$
So the takeaway lesson of all such elaborate eigenfunction expansions is the Mehler kernel and one integral to perform, which accounts for everything.
A: Basically the Green Function can be put in terms of eigenfunctions (or eigenmodes) like so:
$$
G(x,x')=\sum_{\text{relevant modes}}u^{*}(x')u(x)
$$
in some cases the sum turns to integral.
One of the basic premises of Sturm-Liouville theorem (I hope I spelled it correctly),
is that given a Linear operator $\hat{L}$, and an equation:
$$
\hat{L}y(x)=f(x)
$$
one can find the correct $y(x)$ by using the green function like so:
$$
y(x)=\int_{\text{relevant interval}}u^{*}(x')u(x)y(x')dx'
$$
So now all you have to do is find the correct green function, which I've already stated is, naively:
$$
G(x',x)=u^{*}(x')u(x)
$$
Where $u(x)$ is a generic eigenstate of the $\hat{L}$ operator.
That's in a nutshell...
There's a whole procedure to find $G(x',x)$, and I'll send you to Sakurai's great QM textbook - I believe it's chapter 2.
Also in Jackson's textbook you can find the EM green's function for waves in chapter 6...
EDIT (discrete representation of Green's function):
Consider the problem:
$$\hat{L}u-\lambda u=f(x)$$
we can represent $f(x)$ as a weighted sum of $\hat{L}'s$ eigenfunctions like so:
$$f(x)=\sum_n\int\left[u^{\ast}_n(x')f(x')dx'\right]u_n(x) $$
And the solution to this problem (i.e. the $u(x)$ that satisfies the equation) we will denote as: $$u(x)=\sum_n c_n u_n(x) $$.
Substituting, we get:
$$
\left[\hat{L}\sum_n c_n u_n(x) -\lambda \sum_n c_n u_n(x) -\sum_n d_n u_n(x)\right]=0
$$
Where $d_n$ is all the stuff inside the integral over $dx'$ in f(x)'s decomposition. 
rearranging stuff we get:
$$\sum_n \left[  \lambda_n c_n u_n(x)-\lambda c_n u_n(x) - d_n u_n(x)\right]=0$$
Since these are eigenfuctions they are orthogonal by construction (or by definition, depends whom you're asking :p ). 
Thus we left with an equation for $c_n$:
$$c_n = \frac{d_n}{\lambda_n -\lambda} \hspace{20pt} \lambda\neq\lambda_n$$
Thus we have:
$$
u(x)=\sum_n \frac{d_n}{\lambda_n -\lambda} u_n(x)
$$
with explicit expression for $d_n$:
$$
u(x)=\sum_n \frac{\int u^{\ast}_n(x')u_n(x)}{\lambda_n -\lambda} f(x') dx'=\int\sum_n \frac{ u^{\ast}_n(x')u_n(x)}{\lambda_n -\lambda} f(x') dx'
$$
And so we see that for the problem $\hat{L}u-\lambda u=f(x)$ the Green function is actually: $$G(x,x')= \sum_n \frac{ u^{\ast}_n(x')u_n(x)}{\lambda_n -\lambda} $$
In QM these eigenvalues are often interpreted as eigenenergies or frequencies, and that is the more common representation you will encounter $E_n -E$ or $\omega_n-\omega$ in the denominator.
Also I should mention the connection to Feynmann propagators - these are just a fancy name for  Green's function over time and space:
$K=K(x,t;x',t')$
