Cauchy's Theorem and Contour Integrals Using Cauchy's Theorem and the function  
$f(z)=ze^{-ikz}e^{-z^2/{2a^2}}$  
to evaluate
$$\int_{0}^{\infty} x\sin(x)e^{-x^2/{2a^2}} $$
Thoughts: I am having trouble understanding the relationship between the complex function given, and the integrand. I have tried writing $sin(x)$ as $(e^{iz}-e^{-iz})/2$, but the function I get doesn't match. Also why is there a $k$ in the function they gave me?
 A: Let $x = a\sqrt{2}y$ then 
$$\int_{0}^{\infty} x \sin(x)e^{-x^2/{2a^2}}\,dx = 2a^2\int_{0}^{\infty}y\sin(a\sqrt{2} y)e^{-y^2} \,dy $$
Let us solve the following 
$$f(a) = \int^{\infty}_{0}\cos(ax)e^{-x^2}\,dx$$
Then take the derivative. 

Integrate the following function
$$f(z) = e^{-z^2}$$
Use the following contour

Note that the function is entire, hence
$$\int^{L}_{-L} e^{-t^2}\,dt+\int^{L+ai}_{L} e^{-t^2}\,dt+\int^{-L}_{-L+ai} e^{-t^2}\,dt+\int^{-L+ai}_{L+ai}e^{-t^2}\,dt=0$$
For the forth integral use the substitution $x= t-ai$
$$\int^{-L+ai}_{L+ai}e^{-t^2}\,dt=\int^{-L}_{L}e^{-(x+ai)^2}\,dx=-e^{a^2}\int^{L}_{-L}e^{-x^2}\,e^{-2iax}dx$$
Take $L \to \infty $
$$\left|\int^{L+ai}_{L} e^{-z^2}\,dz \right|=\left|\int^{ai}_{0} e^{-(x-L)^2}\,dt \right|\leq a e^{-L^2}\sim_{\infty} 0$$
Similarly
$$\left|\int^{-L}_{-L+ai} e^{-z^2}\,dz \right|=\left|\int^{ai}_{0} e^{-(x+L)^2}\,dt \right|\leq a e^{-L^2}\sim_{\infty} 0$$
Hence we dedeuce that
$$e^{a^2}\int^{\infty}_{-\infty}e^{-x^2}\,e^{-2iax}dx=\int^{\infty}_{-\infty} e^{-t^2}\,dt =\Gamma\left( \frac{1}{2}\right)=\sqrt{\pi}$$
By taking the real part and imaginary part
$$\int^{\infty}_{-\infty}e^{-x^2}\,\cos(2ax)dx=e^{-a^2}\sqrt{\pi}$$
Let $a \to \frac{a}{\sqrt{2}}$
$$\int^{\infty}_{-\infty}e^{-x^2}\,\cos(a\sqrt{2}x)dx=e^{-\frac{a^2}{2}}\sqrt{\pi}$$
By differentiation 
$$\sqrt{2}\int^{\infty}_{-\infty}xe^{-x^2}\,\sin(a\sqrt{2}x)dx=ae^{-\frac{a^2}{2}}\sqrt{\pi}$$
Hence 
$$\int^{\infty}_{0}xe^{-x^2}\,\sin(a\sqrt{2}x)dx=\frac{a}{2}\sqrt{\frac{\pi}{2}}e^{-\frac{a^2}{2}}$$
We conclude that 

$$\int_{0}^{\infty} x \sin(x)e^{-x^2/{2a^2}}\,dx = 
 a^3\sqrt{\frac{\pi}{2}}e^{-\frac{a^2}{2}}$$

