# How to calculate the following integral?

I am trying to calculate the following integral

$$\int_{-\infty}^{\infty}\frac{\lambda_{1}}{2}e^{-\lambda_{1}|x|-\frac{\lambda_{2}}{2}x^{2}}dx$$

After some simplification I got

$$2\int_{0}^{\infty}\frac{\lambda_{1}}{2}e^{-\lambda_{1} x-\frac{\lambda_{2}}{2}x^{2}}dx$$

Does anyone know how to continue?

Also, can this be solved using the gamma function?

Thanks.

• Look into the so-called "error function" instead (erf(x)=$\int_0^x \exp(-t^2)dt$). I think it has a better name, but this is a common one. Aug 26 '16 at 14:08
• Since OP needs the definite integral, it's easier than that. Aug 26 '16 at 14:08

Note that we can write

\begin{align} I(\lambda_1,\lambda_2)&=\frac{\lambda_1}{2}\int_{-\infty}^\infty e^{-\lambda_1 |x|-\frac12 \lambda_2 x^2}\,dx\\\\ &=\frac{\lambda_1}{2}\int_{-\infty}^\infty e^{-\frac12 \lambda_2 \left(x^2+2\frac{\lambda_1}{\lambda_2}|x|\right)}\,dx\\\\ &=\frac{\lambda_1}{2}e^{ \lambda_1^2/2\lambda_2}\int_{-\infty}^\infty e^{-\frac12 \lambda_2 \left(|x|+\frac{\lambda_1}{\lambda_2}\right)^2}\,dx\\\\ &=\lambda_1 e^{ \lambda_1^2/2\lambda_2}\int_0^\infty e^{-\frac12 \lambda_2 \left(x+\frac{\lambda_1}{\lambda_2}\right)^2}\,dx\\\\ &=\lambda_1 e^{ \lambda_1^2/2\lambda_2}\int_{\lambda_1/\lambda_2}^\infty e^{-\frac12 \lambda_2 x^2}\,dx\\\\ &=\lambda_1 \sqrt{\frac{2}{\lambda_2}}e^{ \lambda_1^2/2\lambda_2}\int_{\lambda_1/\sqrt{2\lambda_2}}^\infty e^{-x^2}\,dx\\\\ &= \sqrt{\frac{\pi \lambda_1^2}{2\lambda_2}}e^{ \lambda_1^2/2\lambda_2}\text{erfc}\left(\sqrt{\frac{\lambda_1^2}{2\lambda_2}}\right) \end{align}

where $\text{erfc}(x)$ is the complementary error function.

• You have found the right way (+1) ! I am in the process of writing another answer using Fourier Transform. Aug 26 '16 at 14:34
• In the second-to-last equation you changed the integration limits but not the function to integrate. By the way, I had employed the simmetry of the integrand before completing the square: it is not straightforward that you can complete the square with an absolute value inside.
– N74
Aug 26 '16 at 14:38
• @N74 No, Dr. MV is right, if you shift variable by $\lambda_1/\lambda_2$, you have an integral with $|x|^2$ which is equal to $x^2$. Aug 26 '16 at 14:47
• A different point (from 2nd-to-last equation into last one) I find $\int_{\lambda_1/\sqrt{2\lambda_2}}^\infty e^{-\frac12 \lambda_2 x^2}\,dx= K \text{erfc}\frac{\lambda_1}{2\lambda_2}$ (for a certain constant $K$) in particular without square root. Aug 26 '16 at 14:52
• @JeanMarie the error is in the second-to-last equation. There's no error in the absolute value handling, but it is harder to follow.
– N74
Aug 26 '16 at 14:52

Using Dr. MV solution, as the OP asked for it, this is a solution with the incomplete gamma function. $$I(\lambda_1,\lambda_2)= \sqrt{\frac{ \pi \lambda_1^2}{2\lambda_2}}e^{ \lambda_1^2/2\lambda_2} -\sqrt{\frac{ \lambda_1^2}{2\lambda_2}}e^{ \lambda_1^2/2\lambda_2}\gamma\left({1\over 2},\frac{\lambda_1^2}{2\lambda_2}\right)$$

Defining Fourier Transform (FT) by the following formula:

$$\tag{1}\hat f(u):=\int_{-\infty}^{\infty}e^{2i\pi t u}f(t)dt$$

one has the isometry formula:

$$\tag{2}\int_{-\infty}^{\infty}f(t) g(t) dt \ = \ \int_{-\infty}^{\infty}\hat f(u) \hat g(u) du$$

Let us calculate separately (or adapt from tables because they are "avatars" of classical transform pairs) the FT of

• $f(t):=\frac{\lambda_{1}}{2}e^{-\lambda_{1} |t|}$ is $\hat f(u)=\dfrac{\lambda_1^2}{\lambda_1^2+4 \pi^2 u^2}$ ("a symmetric exponential (Laplace dist.) is exchanged with a Cauchy function").

• $g(t):=e^{-\frac{\lambda_2}{2}t^2}$ is $\hat g(u)=\sqrt{\dfrac{2\pi}{\lambda_2}}e^{-\frac{2 \pi^2}{\lambda_2}u^{2}}$ ("a peaky Gaussian function is tranformed into a flat Gaussian function")

It suffices now to apply (2) to obtain:

$$\int_{-\infty}^{+\infty}\dfrac{\lambda_1^2}{\lambda_1^2+4 \pi^2 u^2}\sqrt{\dfrac{2\pi}{\lambda_2}}e^{-\frac{2 \pi^2}{\lambda_2}u^{2}}du=\sqrt{\dfrac{2\pi}{\lambda_2}}\int_{-\infty}^{+\infty}\dfrac{1}{1+(K u)^2}e^{-\frac{1}{2 \sigma^2}u^{2}}du$$

where $K:=\dfrac{2 \pi}{\lambda_1} \ \ \text{and} \ \ \sigma:=\dfrac{\lambda_2}{2 \pi}.$

Expanding into series $\dfrac{1}{1+(K u)^2}=\sum_{n=0}^{\infty}(-1)^n(Ku)^{2n}$, integrating term by term by using the classical moments of the normal distribution ($\hat{m}_{2n} = \sigma^{2n} (2n-1)!!$), one recognizes the development of the complementary error function:

$$\sqrt{\pi}\lambda_3 \text{erfc}(\lambda_3) \ \ \text{where} \ \ \lambda_3:=\dfrac{\lambda_1}{\sqrt{2 \lambda_2}}$$

Remark: I have done at first this computation with Mathematica...