A Gaussianesque Integral

We will be looking at another Gaussian integral, this time with a trigonometric function included:

\begin{aligned} I&=\int_{-\infty}^{\infty}e^{-ax^2}\cos bx\,dx \end{aligned}

We will use the very powerful method of differentiation under the integral sign, getting a differential equation that we can solve with initial conditions. Consider

\begin{aligned} I(b)&=\int_{\mathbb{R}}e^{-ax^2}\cos bx\,dx \end{aligned}

Differentiating both sides with respect to b,

\begin{aligned} I'(b)&=-\int_{\mathbb{R}}e^{-ax^2}x\sin bx\,dx \end{aligned}

Using integration by parts,

\begin{aligned} I'(b)&=\int_{\mathbb{R}}-e^{-ax^2}x\sin bx\,dx \\ I'(b)&=\frac{e^{-ax^2}}{2a}\sin bx \Biggr|_{-\infty}^{\infty}-\frac{b}{2a}\int_{\mathbb{R}} e^{-ax^2}\cos bx\,dx \end{aligned}

The first term vanishes, while the second term is again our original function I(b). Our differential equation is thus

\begin{aligned} I'(b)&=-\frac{b}{2a}I(b) \end{aligned}

This diff eq. can be solved by separation of variables:

\begin{aligned} \frac{dI}{db}&=-\frac{b}{2a}I \\ \frac{dI}{I}&=-\frac{b}{2a}\,db \\ \int\frac{dI}{I}&=-\int \frac{b}{2a}\,db \\ \log I&=-\frac{b^2}{4a}+C \\ I&=e^{\frac{-b^2}{4a}}e^C \\I&=Ae^{\frac{-b^2}{4a}} \end{aligned}

We can find the constant A by finding the value of I(0):

\begin{aligned} I(0)&=\int_{-\infty}^{\infty} e^{-ax^2}\,dx \end{aligned}

I showed in a previous post that

\begin{aligned} \int_{-\infty}^{\infty} e^{-t^2}\,dt=\sqrt{\pi} \end{aligned}

Subtituting t=\sqrt{a}x, we find that

\begin{aligned} \sqrt{a}\int_{-\infty}^{\infty} e^{-ax^2}\,dx=\sqrt{\pi}\\ \int_{-\infty}^{\infty} e^{-ax^2}\,dx=\sqrt{\frac{\pi}{a}} \end{aligned}

Which means that

\begin{aligned} I(0)&=\sqrt{\frac{\pi}{a}} \end{aligned}

And this lets us find our constant of integration.

\begin{aligned} I(0)&=Ae^{0}\\ I(0)&=A \\ A&=\sqrt{\frac{\pi}{a}} \end{aligned}

Finally, our integral is thus equal to

\begin{aligned} \int_{-\infty}^{\infty}e^{-ax^2}\cos bx\,dx=\sqrt{\frac{\pi}{a}}\exp\left({\frac{-b^2}{4a}}\right) \end{aligned}