Evaluatig: $\int_{0}^{\infty}{e^{ax^2}\cos(bx)dx}$

Evaluatig: $$\int_{0}^{\infty}{e^{ax^2}\cos(bx)dx}$$ Where $a, b\in \mathbb R^+$

What i have done:

Because $\cos(bx)=\Re(e^{ibx})$, we can note that: $$I=\Re{\int_{0}^{\infty}{e^{ax^2+ibx}}}dx=\Re{\int_{0}^{\infty}{e^{(ax+ib)x}}}dx$$

But i cant go furthermore, how can i continue or is there another way?

• For $a\not= 0,$ $$ax^2+ibx=a\left(x+\frac{ib}{2a}\right)^2+\dfrac{b^2}{4a}.$$ And see this. – Bumblebee Jul 16 '15 at 7:38
• If $a\in\mathbb{R}^+$, the integral diverges. – robjohn Jul 16 '15 at 8:10

Assume that $a\lt0$ (otherwise, the integral diverges).

Real Variables

Letting $c=\frac{b}{\sqrt{-a}}$ and $u=\sqrt{-a}\,x$, we get $$\int_0^\infty e^{ax^2}\cos(bx)\,\mathrm{d}x =\frac1{\sqrt{-a}}\int_0^\infty e^{-u^2}\cos\left(cu\right)\,\mathrm{d}u\tag{1}$$ Now take the derivative with respect to $c$ (which is fine since the integral converges absolutely): \begin{align} \frac{\mathrm{d}}{\mathrm{d}c}\int_0^\infty e^{-u^2}\cos\left(cu\right)\,\mathrm{d}u &=-\int_0^\infty e^{-u^2}u\sin\left(cu\right)\,\mathrm{d}u\\ &=\frac12\int_0^\infty\sin\left(cu\right)\,\mathrm{d}e^{-u^2}\\ &=\left.\frac12\sin\left(cu\right)e^{-u^2}\right]_0^\infty-\frac c2\int_0^\infty e^{-u^2}\cos(cu)\,\mathrm{d}u\\ &=-\frac c2\int_0^\infty e^{-u^2}\cos(cu)\,\mathrm{d}u\tag{2} \end{align} That is, $I'(c)=-\frac c2I(c)$. Therefore, $I(c)=\frac{\sqrt\pi}2e^{-\frac{c^2}4}$. Thus, $$\int_0^\infty e^{ax^2}\cos(bx)\,\mathrm{d}x =\frac{\sqrt\pi}{2\sqrt{-a}}e^{\frac{b^2}{4a}}\tag{3}$$

Contour Integration \begin{align} \int_0^\infty e^{ax^2}\cos(bx)\,\mathrm{d}x &=\frac12\int_{-\infty}^\infty e^{ax^2}\cos(bx)\,\mathrm{d}x\\ &=\frac12\mathrm{Re}\left(e^{\frac{b^2}{4a}}\int_{-\infty}^\infty e^{a\left(x+i\frac{b}{2a}\right)^2}\,\mathrm{d}x\right)\tag{4} \end{align} Use the contour $$\gamma+R=[-R,R]\cup\color{#C00000}{[R,R+i\frac{b}{2a}]}\cup[R+i\frac{b}{2a},-R+i\frac{b}{2a}]\cup\color{#C00000}{[-R+i\frac{b}{2a},-R]}$$ and Cauchy's Integral Theorem to compute $$\int_{\gamma_R}e^{az^2}\,\mathrm{d}z=0\tag{5}$$ The integral over the vertical segments (in red) vanishes as $R\to\infty$ and the integral over the horizontal segments (in black) tends to $$\int_{-\infty}^\infty e^{ax^2}\,\mathrm{d}x-\int_{-\infty}^\infty e^{a\left(x+i\frac{b}{2a}\right)^2}\,\mathrm{d}x\tag{6}$$ Therefore, $(5)$ and $(6)$ imply \begin{align} \int_{-\infty}^\infty e^{a\left(x+i\frac{b}{2a}\right)^2}\,\mathrm{d}x &=\int_{-\infty}^\infty e^{ax^2}\,\mathrm{d}x\\ &=\frac{\sqrt\pi}{\sqrt{-a}}\tag{7} \end{align} Combining $(4)$ and $(7)$ yields $$\int_0^\infty e^{ax^2}\cos(bx)\,\mathrm{d}x =\frac{\sqrt\pi}{2\sqrt{-a}}e^{\frac{b^2}{4a}}\tag{8}$$

• Your method to solve this problem and your comments are really appreciable : people change variables in the complex plane to evaluate some real intgrals without taking care of the domain of integration (and the Cauchy's Integral Theorem you've mentioned). Really nice job! +1 – Nicolas Jul 16 '15 at 9:28
• For a nice alternative rearrange the integral so that it is of the form $\int_{-\infty}^{\infty} e^{-x^2} \cos(Bx)dx$ and have a look at the solution here: math.stackexchange.com/questions/1685889/… – jim Mar 6 '16 at 21:08
• @jim: the answer there looks a lot like the real variable method above. – robjohn Mar 7 '16 at 2:15

$$\int_{0}^{\infty}{e^{ax^2}\cos(bx)dx} = \frac{1}{2}\int_{-\infty}^{\infty}{e^{ax^2}\cos(bx)dx}$$ Then you can use $$\cos(bx)=\Re(e^{ibx})$$ To obtain: $$\frac{1}{2}\int_{-\infty}^{\infty}{e^{ax^2}\cos(bx)dx}=\frac{1}{2}\Re\int_{-\infty}^{\infty}{e^{ax^2+ibx}dx}$$ From here you can solve this like a regular Gaussian integral, completing the square and moving the integration variable.

Note: Saying $b>0$ doesn't change anything, as $\cos(bx)$ is an even function.
Also, the integral diverges (obviously, as the function doesn't tend to zero) for $a>0$.

• We can be less careful with substitutions in $\mathbb{R}$ because the path of integration usually doesn't change. However, here the path of integration changes from the real axis and we need to use Cauchy's Integral Theorem to justify the equation. – robjohn Jul 16 '15 at 8:15
• @robjohn A delicate point indeed, I was hoping not to go into that. If you insist, it's been asked here before: math.stackexchange.com/questions/865287/… and math.stackexchange.com/questions/1297096/… and probably several more. – Omry Jul 16 '15 at 8:22
• @robjohn You will notice, however, that everything I've done still holds. – Omry Jul 16 '15 at 8:23
• If you assume $a\lt0$ (but the question specifies $a\gt0$), then of course, what you say is true. However, leaving out even a mention of the justification for the change in path can lead to misconceptions in similar problems. – robjohn Jul 16 '15 at 8:41
• For a>0, it is obvious the integral diverges. And the assumption b>0 changes nothing. I'll add a note on this. – Omry Jul 16 '15 at 9:17

You can complete the square, $ax^2 + ibx = a\left(x + {ib \over 2a}\right)^2 + {b^2 \over 4a^2}$, then perform a change of variables such as $u = \sqrt{|a|}(x + {ib\over 2a})$ to get

$$\int_{-\infty}^{\infty} e^{\pm u^2} du$$

up to some constant coefficient. If $a$ is positive, you get the plus sign in the exponent, and the integral diverges. If $a$ is negative, however, you get the minus sign and the integral can be taken as on the wikipedia page.

• see my comment to Omry's answer. – robjohn Jul 16 '15 at 8:16