TITLE: Determine the Integral $\int_{-\infty}^{\infty} e^{-x^2} \cos(2bx)dx$
QUESTION [7 upvotes]: Please do not mark this question as a duplicate. I have to solve this with a different method that I don't believe has been discussed about this particular question (at least to my  knowledge).
I am confronted with computing the integral below:
$$\int_{-\infty}^{\infty} e^{-x^2} \cos(2bx)dx, b \in \mathbb R, b \gt0$$
I understand that this is a question in which Complex Analysis has applications to Real Analysis. Specifically, Cauchy's Theorem will be used. That being said, the hint I was given (and the method I am attempting to use) is the following: 
Integrate $e^{-z^2}$ over this curve:

The curve is a rectangle such that its length is $2R$ and its width is $b$. Also, the length on the lower side of the rectangle lies on the x-axis. Lastly, the direction of curvature is counter-clockwise. 

My question is this: why integrate $e^{-z^2}$, and not $e^{-z^2}\cos(2bz)$? That is, the actual integral we're computing? I know that the former would be easier to integrate, but where did the $\cos(2bz)$ term go, and where will it come into play again?
Also, it's important to say that $\int_{-\infty}^{\infty} e^{-t^2}dt = \sqrt\pi$ will be useful here as well. 
Lastly, I know that from the hint suggested, there will be four curves to evaluate: the two lengths and the two widths of the rectangle.

REPLY [12 votes]: If we set:
$$ f(b) = \int_{\mathbb{R}} e^{-x^2}\cos(2bx)\,dx \tag{1}$$
we have:
$$ f'(b) = -\int_{\mathbb{R}} 2x\,e^{-x^2} \sin(2bx)\,dx \stackrel{\text{IBP}}{=}-2b\int_{\mathbb{R}}e^{-x^2}\cos(2bx)\,dx=-2b\,f(b).\tag{2}$$
So we have that $f$ is a solution of a separable differential equation and
$$ f(b) = f(0)\, e^{-b^2}.\tag{3}$$
Since $f(0)=\sqrt{\pi}$,

$$ \int_{\mathbb{R}} e^{-x^2}\cos(2bx)\,dx = \color{red}{\sqrt{\pi}\, e^{-b^2}}\tag{4}$$

follows.