# How to evaluate this integral ($\int_{0}^{\infty}\exp(-\alpha x^2)\cos(\beta x)dx$)? [closed]

I am facing issue to evaluate this particular type of definite integral,

$$I=\int_{0}^{\infty}\exp(-\alpha x^2)\cos(\beta x)dx$$

Please suggest a way to this.

Thanks

## closed as off-topic by Carl Mummert, Ethan Bolker, Silvia Ghinassi, Pragabhava, WatsonOct 24 '16 at 16:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Carl Mummert, Ethan Bolker, Silvia Ghinassi, Pragabhava, Watson
If this question can be reworded to fit the rules in the help center, please edit the question.

• This is just a Fourier transform of $e^{-\alpha x^2}$ – Boby Oct 22 '16 at 15:22
• This is similar to Fourier transform. For a gaussian, the F.T. is also a gaussian. – Srini Oct 22 '16 at 15:24
• Why has this question been put on hold? It has sparked a number of good solutions which will undoubtedly help many viewers. A question like this is what makes MSE interesting, informative, and enjoyable. – poweierstrass Oct 26 '16 at 15:24

Let $I(\alpha,\beta)$ be given by the integral

$$I(\alpha,\beta)=\int_0^\infty e^{-\alpha x^2}\cos(\beta x)\,dx$$

Using Euler's Formula, $\cos(\beta x)=\text{Re}(e^{i\beta x})$. Then, we can write

\begin{align} I(\alpha,\beta)&=\text{Re}\left(\int_0^\infty e^{-\alpha x^2}e^{i\beta x}\,dx\right)\\\\ &=\text{Re}\left(\int_0^\infty e^{-\alpha (x^2-i(\beta/\alpha) x)}\,dx\right)\tag 1 \\\\ &=e^{-\beta^2/4\alpha}\text{Re}\left(\int_0^\infty e^{-\alpha (x-i(\beta/2\alpha) )^2}\,dx\right)\tag 2\\\\ &=e^{-\beta^2/4\alpha}\text{Re}\left(\int_{-i(\beta/2\alpha)}^{\infty-i(\beta/2\alpha)} e^{-\alpha x^2}\,dx\right) \tag 3\\\\ &=e^{-\beta^2/4\alpha}\text{Re}\left(\int_0^\infty e^{-\alpha x^2}\,dx\right) \tag 4\\\\ &=\sqrt{\frac{\pi}{4\alpha}}e^{-\beta^2/4\alpha} \end{align}

NOTES:

In going from $(1)$ to $(2)$, we completed the square in the exponent.

In going from $(2)$ to $(3)$, we enforced the substitution $x\to x+i\beta/2\alpha$.

In going from $(3)$ to $(4)$, we exploited Cauchy's Integral Theorem to deform the contour back to the real line. The real part operation nullifies the contribution from the integral from $-i\beta/2\alpha$ to $0$.

• But the Euler's formula, I know is $\cos(\beta x) = \frac{\exp(i\beta x)+\exp(-i\beta x)}{2}$. How come $\cos(\beta x)=\text{Re}(e^{i\beta x})$? – zhk Oct 22 '16 at 15:48
• @mmm Yes, you are correct. And $e^{i\beta x}=\cos(\beta x)+i\sin(\beta x)$ from which we find $\cos(\beta x)=\text{Re}(e^{i\beta x})$. – Mark Viola Oct 22 '16 at 15:52
• If I am correct the (3) to (4) is to use $\oint\limits_{C}f(z)\,\mathrm{d}z=\int_{R}f(z)dz$? – zhk Oct 22 '16 at 16:15
• The integrand is entire, so $\oint_C e^{-\alpha z^2}\,dz=0$. Thus, with $C$ the "rectangular" contour with vertices $0$, $\infty$, $\infty-i\beta/2\alpha$, and $-i\beta/2\alpha$, we have $$\int_{0}^\infty e^{-\alpha x^2}\,dx+\int_{\infty}^{\infty -i\beta/2\alpha}e^{-\alpha z^2}\,dz+\int_{\infty -i\beta/2\alpha}^{-i\beta/2\alpha}e^{-\alpha z^2}\,dz+\int_{-i\beta/2\alpha}^0 e^{-\alpha z^2}\,dz=0$$The second integral is zero since $e^{-t^2}\to 0$ as $t\to \infty$. The fourth integral is purely imaginary since $dz=idy$ and vanishes upon taking the real part. – Mark Viola Oct 22 '16 at 16:20
• You're welcome. My pleasure. -Mark – Mark Viola Oct 22 '16 at 16:33

\begin{align} \int_0^\infty e^{-\alpha x^2}e^{i\beta x}\,\mathrm{d}x &=\int_0^\infty e^{-\alpha\left(x-i\frac\beta{2\alpha}\right)^2-\frac{\beta^2}{4\alpha}}\mathrm{d}x\tag{1}\\ &=e^{-\frac{\beta^2}{4\alpha}}\int_{-i\frac\beta{2\alpha}}^{\infty-i\frac\beta{2\alpha}}e^{-\alpha x^2}\mathrm{d}x\tag{2}\\ &=e^{-\frac{\beta^2}{4\alpha}}\left[\int_{-i\frac\beta{2\alpha}}^0e^{-\alpha x^2}\mathrm{d}x+\int_0^\infty e^{-\alpha x^2}\mathrm{d}x+\color{#A0A0A0}{\int_\infty^{\infty-i\frac\beta{2\alpha}} e^{-\alpha x^2}\mathrm{d}x}\right]\tag{3}\\ &=e^{-\frac{\beta^2}{4\alpha}}\left[\,\color{#D080F8}{i\int_0^{\frac\beta{2\alpha}}e^{\alpha x^2}\mathrm{d}x}+\frac12\sqrt{\frac\pi\alpha}\,\right]\tag{4} \end{align} Explanation:
$(1)$: complete the square
$(2)$: substituted $x\mapsto x+i\frac\beta{2\alpha}$
$(3)$: the integrand is entire; apply Cauchy's Integral Theorem
$(4)$: the integral over $\left[R,R-i\frac\beta{2\alpha}\right]$ vanishes

The integral in purple is pure imaginary, so taking the real parts of $(4)$ gives $$\int_0^\infty e^{-\alpha x^2}\cos(\beta x)\,\mathrm{d}x =\frac12e^{-\frac{\beta^2}{4\alpha}}\sqrt{\frac\pi\alpha}\tag{5}$$

• See the answer I wrote, in my opinion the identity theorem is easier to understand than the Cauchy integral theorem when you don't know so much of complex analysis – reuns Oct 22 '16 at 22:59

$$I = \int\limits_{0}^{\infty} \mathrm{e}^{-ax^{2}} \cos(bx) \mathrm{d}x \tag{1} \label{eq:1}$$

Let \begin{align} I_{1} &= \int\limits_{0}^{\infty} \mathrm{e}^{-ax^{2}} \mathrm{e}^{ibx} \mathrm{d}x = \int\limits_{0}^{\infty} \mathrm{e}^{-ax^{2}+ibx} \mathrm{d}x \\ &= \mathrm{e}^{-b^{2}/4a} \int\limits_{0}^{\infty} \mathrm{e}^{-a(x-ib/2a)^{2}} \mathrm{d}x \\ \tag{2} \label{eq:2} \end{align} Here we completed the square and note that $\mathrm{Re}\,I_{1} = I$.

Consider the indefinite integral \begin{align} \int \mathrm{e}^{-a(x-ib/2a)^{2}} \mathrm{d}x &= \int \mathrm{e}^{-ay^{2}} \mathrm{d}y \\ &= \frac{1}{\sqrt{a}} \int \mathrm{e}^{-z^{2}} \mathrm{d}z = \frac{1}{2} \sqrt{\frac{\pi}{a}} \mathrm{erf}(z) \\ &= \frac{1}{2} \sqrt{\frac{\pi}{a}} \mathrm{erf}\left(x\sqrt{a} - \frac{ib}{2\sqrt{a}}\right) \tag{3} \label{eq:3} \end{align} we used the substitutions, $y=x- \frac{ib}{2a}$ and $z^{2} = ay^{2}$.

Examining the error function expression, we have $$\lim_{x \to 0} \mathrm{erf}\left(x\sqrt{a} - \frac{ib}{2\sqrt{a}}\right) = \mathrm{erf}\left(- \frac{ib}{2\sqrt{a}}\right) = -i\,\mathrm{erfi}\left(\frac{b}{2\sqrt{a}}\right) \tag{4} \label{eq:4}$$ which is a pure imaginary quantity with the assumption that all of the variables in the argument of the imaginary error function are real and $a \gt 0$. We also have $$\lim_{x \to \infty} \mathrm{erf}\left(x\sqrt{a} - \frac{ib}{2\sqrt{a}}\right) = 1 \tag{5} \label{eq:5}$$

Using equations \eqref{eq:4} and \eqref{eq:5} in equation \eqref{eq:3} we obtain $$\mathrm{Re}\left(\int\limits_{0}^{\infty} \mathrm{e}^{-a(x-ib/2a)^{2}} \mathrm{d}x \right) = \frac{1}{2} \sqrt{\frac{\pi}{a}} \tag{6} \label{eq:6}$$

Combining equations \eqref{eq:6} and \eqref{eq:2} yields our final result $$\int\limits_{0}^{\infty} \mathrm{e}^{-ax^{2}} \cos(bx) \mathrm{d}x = \frac{1}{2} \sqrt{\frac{\pi}{a}} \,\mathrm{e}^{-b^{2}/4a}$$

The least amount of complex analysis is as follow :

• For $z > 0$, let $$f(z) = \int_{-\infty}^\infty e^{-x^2} e^{2zx}dx$$ Complete the square $x^2-2zx= (x-z)^2 - z^2$ so that $$f(z) = e^{-z^2} \int_{-\infty}^\infty e^{-(x-z)^2}dx \underset{y = x-z}= e^{-z^2} \int_{-\infty}^\infty e^{-y^2}dy = Ce^{-z^2}$$ (where $C = \sqrt{\pi}$)

Then note that for every $z \in \mathbb{C}$ : $\int_{-\infty}^\infty e^{-x^2} e^{2zx}dx$ is analytic in $z$, as well as $Ce^{-z^2}$, thus by the identity theorem for analytic functions $$\forall z \in \mathbb{C}, \qquad f(z) = Ce^{-z^2}$$

• Apply the same trick to $$g_z(s) = \int_{-\infty}^\infty e^{-sx^2} e^{2zx}dx$$ where $s > 0$. With $y = s^{1/2}x$ we get $$g_z(s) = s^{-1/2}\int_{-\infty}^\infty e^{-y^2} e^{2zs^{-1/2}y}dy = s^{-1/2}f(zs^{-1/2}) = \frac{C}{s^{1/2}}e^{-z^2/s}$$ Finally note that $\int_{-\infty}^\infty e^{-sx^2} e^{2zx}dx$ is analytic in $s$ for every $s \in \mathbb{C},Re(s) > 0$, as well as $\frac{C}{s^{1/2}}e^{-z^2/s}$, thus by the identity theorem $$\forall s \in \mathbb{C},Re(s) > 0, \qquad g_z(s) = \frac{C}{s^{1/2}}e^{-z^2/s}$$

• Hence for any $Re(a) > 0$ : $$I = \frac{1}{2}\int_{-\infty}^\infty e^{-a x^2} \cos( \beta x)dx = \frac{g_{i \beta/2}(a)+g_{-i \beta/2}(a)}{4} = \frac{C}{2a^{1/2}}e^{\textstyle- \frac{\beta^2}{4a}}$$

• How do you justify $$e^{-z^2} \int_{-\infty}^\infty e^{-(x-z)^2}dx \underset{y = x-z}= e^{-z^2} \int_{-\infty}^\infty e^{-y^2}dy$$ I believe you need Cauchy's Integral Theorem for this. – robjohn Oct 23 '16 at 0:27
• @robjohn no read again, I proved it for $z > 0$ (I meant $z \in \mathbb{R}$ a typo) – reuns Oct 23 '16 at 0:32
• You've shown that $f(z)=Ce^{-z^2}$ for $z\in\mathbb{R}$. How do you apply the identity theorem without showing it for $z$ in a non-empty, open subset of $\mathbb{C}$? – robjohn Oct 23 '16 at 1:29
• – reuns Oct 23 '16 at 1:34
• @robjohn the idea is that $f(z) = g(z)$ for $z \in [a,b]$ means $f^{(k)}(a) = g^{(k)}(a)$ for every $k \in \mathbb{N}$, so they agree on an open around $a$. Otherwise, use that non-constant analytic functions have isolated zeros. – reuns Oct 23 '16 at 1:36