How to use a contour integral to evaluate $\frac{2}{\pi }\int\limits_0^\infty {x{e^{ - {x^2}t}}\sin ax} {\rm{ }}dx$? So I faced this question in our textbook: Using a contour integral, evaluate the improper integral
$$\frac{2}{\pi }\int\limits_0^\infty  {x{e^{ - {x^2}t}}\sin ax} {\rm{ }}dx$$
I don't need the answer, in fact, the answer is given at the end of the textbook 
$$\frac{2}{\pi }\int\limits_0^\infty  {x{e^{ - {x^2}t}}\sin ax} {\rm{ }}dx = \frac{a}{{\sqrt {4\pi {t^3}} }}{e^{ - \frac{{{a^2}}}{{4t}}}}$$
However, I just need hints on how to start. 


*

*Shall I use exponentials instead of sines/cosines? 

*How about attacking the improper integral using the residue theorem - no?

 A: Note that your integral is the imaginary part of 
$$f(a,t) := \frac{1}{\pi} \int_{-\infty}^\infty xe^{-x^2t + iax}\, dx.$$
Using the transformation $x \mapsto \frac{x}{t}$ and completing the square in the exponential argument, we find
$$f(a,t)=\frac{e^{-\frac{a^2}{4t}}}{\pi t} \int_{-\infty}^\infty xe^{-(x - i\frac{a}{2\sqrt{t}})^2}\, dx.$$
By contour shifting,
$$\int_{-\infty}^\infty xe^{-(x - i\frac{a}{2\sqrt{t}})^2}\, dx = \int_{-\infty}^\infty \left(x + i\frac{a}{2\sqrt{t}}\right)e^{-x^2}\, dx,$$
but this needs justification. To proceed, consider the contour integral
$$\oint_{\Gamma(R)} \left(z + i\frac{a}{2\sqrt{t}}\right)e^{-z^2}\, dz,$$
where $\Gamma(R)$ is the positively oriented rectangle with vertices at $-R,-R - i\frac{a}{2\sqrt{t}}, R - i\frac{a}{2\sqrt{t}}$, and $R$. The integrals along the vertical edges of $\Gamma(R)$ are $O(Re^{-R^2})$ as $R\to \infty$. Furthermore, by Cauchy's integral theorem, $\int_{\Gamma(R)} (z + i\frac{a}{\sqrt{t}})e^{-z^2}\, dz = 0$. Hence, the contour shifting is valid.
Now
$$\int_{-\infty}^\infty \left(x + i\frac{a}{2\sqrt{t}}\right) e^{-x^2}\, dx = i\frac{a}{2\sqrt{t}}\int_{-\infty}^\infty e^{-x^2}\, dx = i a\sqrt{\frac{\pi}{4t}},$$
and thus
$$f(a,t) = i\frac{a}{\sqrt{4\pi t^3}}e^{-\frac{a^2}{4t}}.$$
Taking the imaginary part of $f(a,t)$ gives the answer you've written above.
