How to integrate $e^{-\pi x^2} \cos(2\pi x w)$ How to evaluate the following integral? The answer is $e^{-\pi w^2}$ but I don't know how do we get it.

$$\int_{-\infty}^\infty e^{-\pi x^2} \cos(2\pi xw)dx, w\in\mathbb{R} $$

I encountered this integral when trying to show the Fourier transform of a Gaussian is still a Gaussian. More specifically,
$$\int_{-\infty}^\infty e^{-\pi x^2} e^{-2\pi i xw} dx = \int_{-\infty}^\infty e^{-\pi x^2} \cos(2\pi x w) dx - i \int_{-\infty}^\infty e^{-\pi x^2}\sin(2\pi xw) dx$$
Perhaps I should evaluate this integral using complex analysis? I recognize that $e^{-\pi x^2} e^{-2\pi i xw}$ is a holomorphic function, so its contour integral over some good contour should be zero.
 A: HINT:
$$\int_{-\infty}^\infty e^{-\pi x^2} \cos(2\pi xw)\,dx=\text{Re}\left(\int_{-\infty}^\infty e^{-\pi x^2} e^{i2\pi xw}\,dx\right)$$
Complete the square and evaluate a Gaussian integral.
To ensure rigor, deform the contour back to the real line using Cauchy's Integral Theorem.
SPOLIER ALERT  Scroll over the highlighted area to reveal the solution

$$\begin{align}\int_{-\infty}^\infty e^{-\pi x^2} e^{i2\pi xw}\,dx&=e^{-\pi \omega^2} \int_{-\infty}^\infty e^{-\pi (x-i\omega )^2} \,dx\\\\&=e^{-\pi \omega^2}\int_{-\infty -i\omega }^{\infty -i\omega }e^{-\pi x^2}\,dx \tag 1\\\\&=e^{-\pi \omega^2}\int_{-\infty }^{\infty  }e^{-\pi x^2}\,dx \tag 2\\\\&=e^{-\pi \omega^2}\end{align}$$In going from $(1)$ to $(2)$ we invoked Cauchy's Integral Theorem to deform the contour back to the real line.  This is justifiable since (i) the rectangular closed contour with vertices $-R$, $R$, $-R-i\omega$, and $R-i\omega$ encloses no singularity and (ii) in the limit as $R\to \infty$, the integrals over the segments from $-R$ to $-R-i\omega$ and from $R-i\omega$ to $R$ approach $0$. 

A: Here is a way to go that does not use contour integration techniques:
Let $f(x)=e^{-\pi x^2}$. Then
$$
\hat f(w)=\int_{-\infty}^{+\infty}f(x)e^{-2\pi i w x}\,dx
$$
so
$$
{\hat f}'(w)=\int_{-\infty}^{+\infty}-2\pi ixf(x)e^{-2\pi i w x}\,dx.
$$
But $f$ satisfies $f'(x)=-2\pi xf(x)$, so
$$
{\hat f}'(w)=\int_{-\infty}^{+\infty}i f'(x)e^{-2\pi i w x}\,dx.
$$
Integrating the right-hand side by parts (or using a rule about the Fourier transform of a derivative),
$$
\int_{-\infty}^{+\infty}i f'(x)e^{-2\pi i w x}\,dx
=-\int_{-\infty}^{+\infty}if(x)(-2\pi i w)e^{-2\pi i w x}\,dx=-2\pi w\hat f(w).
$$
Here, we have used the fact that the boundary terms are killed by the decay of the Gaussian. Thus
$$
\hat f'(w)=-2\pi w\hat f(w).
$$
This is a simple linear first order differential equation and the solution (also, see above) is given by
$$
\hat f(w)=Ce^{-\pi w^2}.
$$
Finally, we determine, $C$,
$$
C=\hat f(0)=\int_{-\infty}^{+\infty}f(x)\,dx=1.
$$

We conclude that
  $$
\int_{-\infty}^{+\infty}e^{-\pi x^2}e^{-2\pi i w x}\,dx=e^{-\pi w^2}.
$$

