How to integrate $\int_{-\infty}^{+\infty}\frac{1}{\sqrt{2\pi}}e^{iaz-z^{2}/2}dz$? I have tried to evaluate this integral, but failed to get a result. Wolfram alpha gives me $e^{-\frac{a^2}{2}}$ but I don't know how to get this result.
Note that after completing the square and enforcing the substitution $z\to z+ia$ yields 

$$\begin{align}\frac1{\sqrt{2\pi}} \int_{-\infty}^\infty e^{iaz-z^2/2}\,dz&amp;=\frac1{\sqrt{2\pi}} e^{-a^2/2}\int_{-\infty}^\infty e^{-\frac12(z-ia)^2}\,dz\\\\
&amp;=\frac1{\sqrt{2\pi}} e^{-a^2/2}\int_{-\infty-ia}^{\infty-ia} e^{-\frac12 z^2}\,dz \tag 1\\\\
\end{align}$$

Now, from Cauchy's Integral Theorem , since $e^{-\frac12z^2}$ is analytic then 

$$\oint_{C}e^{-\frac12 z^2}\,dz=0 \tag 2$$

for any rectifiable path $C$.  

Let $R_1&gt;0$ and $R_2&gt;0$ and let $C$ in $(2)$ to be the closed path comprised of (i) the real segment from $-R_1-ia$ to $R_2-ia$; (ii) the line segment from $R_2-ia$ to $R_2$; (iii) the line segment from $R_2$ to $-R_1$; and (iv) the line segment from $-R_1$ to $-R_1-ia$.

Then, we have from $(2)$

$$\begin{align}
\int_{C}e^{-\frac12 z^2}\,dz&amp;=\int_{-R_1-ia}^{R_2-ia}e^{-\frac12 z^2}\,dz+\int_{R_2-ia}^{R_2}e^{-\frac12 z^2}\,dz+\int_{R_2}^{-R1}e^{-\frac12 z^2}\,dz+\int_{-R_1}^{-R_1-ia}e^{-\frac12 z^2}\,dz \tag 3\\\\&amp;=0
\end{align}$$

As $R_1\to \infty$ and $R_2\to \infty$, the second and fourth integrals on the right-hand side of $(3)$ tend to $0$, the first integral approaches the integral on the right-hand side of $(1)$, and the third integral approaches $\sqrt{2\pi}$.

Putting it all together, we obtain the coveted result

$$\frac1{\sqrt{2\pi}} \int_{-\infty}^\infty e^{iaz-z^2/2}\,dz=e^{-\frac12 a^2}$$
$\dfrac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty}e^{-\frac{1}{2}(z^2-2iaz+i^2a^2-i^2a^2)}dz=\dfrac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty}e^{-\frac{1}{2}(z-ia)^2-\frac{a^2}{2}}dz$

$=\dfrac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty}e^{-\frac{1}{2}(z-ia)^2}e^{-\dfrac{a^2}{2}}dz=\dfrac{e^{-\frac{a^2}{2}}}{\sqrt{2\pi}}\int_{-\infty}^{\infty}e^{-\frac{1}{2}(z-ia)^2}=\dfrac{e^{-\frac{a^2}{2}}}{\sqrt{2\pi}}\cdot\sqrt{2\pi}=e^{-\dfrac{a^2}{2}}$