How to evaluate this integral ($\int_{0}^{\infty}\exp(-\alpha x^2)\cos(\beta x)dx$)? 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
 A: $$
\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}
$$
A: 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$.
A: \begin{equation}
I = \int\limits_{0}^{\infty} \mathrm{e}^{-ax^{2}} \cos(bx) \mathrm{d}x
\tag{1}
\label{eq:1}
\end{equation}
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
\begin{equation}
\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}
\end{equation}
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
\begin{equation}
\lim_{x \to \infty} \mathrm{erf}\left(x\sqrt{a} - \frac{ib}{2\sqrt{a}}\right) = 1
\tag{5}
\label{eq:5}
\end{equation}
Using equations \eqref{eq:4} and \eqref{eq:5} in equation \eqref{eq:3} we obtain
\begin{equation}
\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}
\end{equation}
Combining equations \eqref{eq:6} and \eqref{eq:2} yields our final result
\begin{equation}
\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}
\end{equation}
A: 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}}$$
