How to evaluate $\int_{0}^{+\infty}\exp(-ax^2-\frac b{x^2})\,dx$ for $a,b>0$ How can I evaluate
$$I=\int_{0}^{+\infty}\!e^{-ax^2-\frac b{x^2}}\,dx$$
for $a,b>0$?
My methods:
Let $a,b > 0$ and let
$$I(b)=\int_{0}^{+\infty}e^{-ax^2-\frac b{x^2}}\,dx.$$
Then
$$I'(b)=\int_{0}^{\infty}-\frac{1}{x^2}e^{-ax^2-\frac b{x^2}}\,dx.$$
What the other methods that can I use to evaluate it? Thank you.
 A: The integral is $$\frac{1}{2}e^{-2ab}\int_{-\infty}^{\infty}e^{-a^2(x-b/ax)^2}dx=\frac{1}{2}e^{-2ab}\int_{-\infty}^{\infty}e^{-a^2x^2}dx=\frac{\sqrt{\pi}}{2a}e^{-2ab}.$$ (See M.L. Glasser,  A Remarkable Property of Definite Integrals,
Math.Comp.Vol 40, p.561 (1983).
A: The integral can be evaluated as follows
$$
\begin{align}
\int_{x=0}^\infty \exp\left(-a\left(x^2+\frac{b}{ax^2}\right)\right)\,dx&=2\int_{x=0}^\infty \exp\left(-a\left(x^2-2\sqrt{\frac{b}{a}}+\frac{b}{ax^2}+2\sqrt{\frac{b}{a}}\right)\right)\,dx\\
&=\int_{x=0}^\infty \exp\left(-a\left(x-\frac{1}{x}\sqrt{\frac{b}{a}}\right)^2-2\sqrt{ab}\right)\,dx\\
&=e^{\large-2\sqrt{ab}}\int_{x=0}^\infty \exp\left(-a\left(x-\frac{1}{x}\sqrt{\frac{b}{a}}\right)^2\right)\,dx.
\end{align}
$$
The trick to solve the last integral is by setting
$$
I=\int_{x=0}^\infty \exp\left(-a\left(x-\frac{1}{x}\sqrt{\frac{b}{a}}\right)^2\right)\,dx.
$$
Let $t=-\frac{1}{x}\sqrt{\frac{b}{a}}\;\rightarrow\;x=-\frac{1}{t}\sqrt{\frac{b}{a}}\;\rightarrow\;dx=\frac{1}{t^2}\sqrt{\frac{b}{a}}\,dt$, then
$$
I_t=\sqrt{\frac{b}{a}}\int_{t=0}^\infty \frac{\exp\left(-a\left(-\frac{1}{t}\sqrt{\frac{b}{a}}+t\right)^2\right)}{t^2}\,dt.
$$
Let $t=x\;\rightarrow\;dt=dx$, then
$$
I_t=\int_{t=0}^\infty \exp\left(-a\left(t-\frac{1}{t}\sqrt{\frac{b}{a}}\right)^2\right)\,dt.
$$
Adding the two $I_t$s yields
$$
2I=I_t+I_t=\int_{t=0}^\infty\left(1+\frac{1}{t^2}\sqrt{\frac{b}{a}}\right)\exp\left(-a\left(t-\frac{1}{t}\sqrt{\frac{b}{a}}\right)^2\right)\,dt.
$$
Let $s=t-\frac{1}{t}\sqrt{\frac{b}{a}}\;\rightarrow\;ds=\left(1+\frac{1}{t^2}\sqrt{\frac{b}{a}}\right)dt$ and for $0<t<\infty$ is corresponding to $-\infty<s<\infty$, then
$$
I=\frac{1}{2}\int_{s=-\infty}^\infty e^{-as^2}\,ds=\frac{1}{2}\sqrt{\frac{\pi}{a}}.
$$
Thus
$$
\begin{align}
\int_{x=0}^\infty \exp\left(-a\left(x^2+\frac{b}{ax^2}\right)\right)\,dx&=e^{\large-2\sqrt{ab}}\int_{x=0}^\infty \exp\left(-a\left(x-\frac{1}{x}\sqrt{\frac{b}{a}}\right)^2\right)\,dx\\
&=\frac{1}{2}\sqrt{\frac{\pi}{a}}e^{\large-2\sqrt{ab}}.
\end{align}
$$
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{I\equiv\int_{0}^{\infty}\exp\pars{-ax^{2} - {b \over x^{2}}}\,\dd x:\
     {\large ?}.\qquad a, b > 0}$

Lets $\ds{x \equiv A\expo{\theta}}$ such that
  $\ds{-ax^{2} - {b \over x^{2}} = -aA^{2}\expo{2\theta} - {b \over A^{2}}\,
\expo{-2\theta}}$.
  
  We choose
  $$
A\ \mbox{such that}\quad
aA^{2} = {b \over A^{2}}\quad\imp\quad A = \pars{b \over a}^{1/4}. \mbox{Then,}\
-ax^{2} - {b \over x^{2}} = -2\root{ab}\cosh\pars{2\theta}
$$

\begin{align}
I&=\int_{-\infty}^{\infty}\!\!\expo{-2\root{ab}\cosh\pars{2\theta}}\pars{b \over a}^{1/4}
\expo{\theta}\,\dd\theta
=2\pars{b \over a}^{1/4}\int_{0}^{\infty}\expo{-2\root{ab}\cosh\pars{2\theta}}
\cosh\pars{\theta}\,\dd\theta
\\[5mm]&=2\pars{b \over a}^{1/4}\
\overbrace{\int_{0}^{\infty}\expo{-2\root{ab}\bracks{2\sinh^{2}\pars{\theta} + 1}}
\cosh\pars{\theta}\,\dd\theta}^{\ds{\mbox{Set}\quad t \equiv \sinh\pars{\theta}}}
\\[5mm]&=2\pars{b \over a}^{1/4}\expo{-2\root{ab}}
\int_{0}^{\infty}\expo{-4\root{ab}t^{2}}\,\dd t
\\[5mm]&=2\pars{b \over a}^{1/4}\expo{-2\root{ab}}
\bracks{{1 \over 2\pars{ab}^{1/4}}}\
\overbrace{\int_{0}^{\infty}\expo{-t^{2}}\,\dd t}^{\ds{=\ {\root{\pi} \over 2}}}\
=\ \color{#00f}{\large \half\,\root{\pi \over a}\expo{-2\root{ab}}}
\end{align}
A: A proof by Fourier transform
This won't be the shortest nor the most elementary proof here, but it has a nice background which I'll explain later. The main drawback is that it assumes that we know the Fourier transform of the Gaussian, which is about as hard to compute rigorously than the initial integral.
Fix $a > 0$. Then, for any $\xi \in \mathbb{R}$,
$$\begin{align}
\int_{\mathbb{R}} e^{i \xi b} I(a,b^2) \ db 
& = \int_{\mathbb{R}} e^{i \xi b} \int_0^{+ \infty} e^{-ax^2-\frac{b^2}{x^2}} \ dx \ db\\
& = \int_0^{+ \infty} e^{-ax^2} \int_{\mathbb{R}} e^{i \xi b}  e^{-\frac{b^2}{x^2}} \ db \ dx \hspace{2em} \color{#00f}{\text{Fubini-Tonelli}} \\
& = \sqrt{\pi} \int_0^{+ \infty} x e^{-\left( a+ \frac{\xi^2}{4}\right) x^2} \ dx \hspace{2em} \color{#00f}{\text{Fourier transform of the Gaussian}} \\
& = \frac{\sqrt{\pi}}{2} \int_0^{+ \infty} e^{-\left( a+ \frac{\xi^2}{4}\right) u} \ du \hspace{2em} \color{#00f}{\text{Change of variables }u=x^2} \\
& = \frac{\sqrt{\pi}}{2 \left( a+ \frac{\xi^2}{4}\right)} \hspace{2em} \color{#00f}{\text{Evaluation of the integral}} \\
& = \frac{\sqrt{\pi}}{2\sqrt{a}} \left( \frac{1}{2\sqrt{a}+i\xi} + \frac{1}{2\sqrt{a}-i\xi} \right) \hspace{2em} \color{#00f}{\text{Partial fraction decomposition}} \\
& = \frac{\sqrt{\pi}}{2\sqrt{a}} \left( \int_0^{+ \infty} e^{-(i \xi + 2 \sqrt{a})b} \ db + \int_0^{+ \infty} e^{-(-i \xi + 2 \sqrt{a})b} \ db \right) \\
& = \frac{\sqrt{\pi}}{2\sqrt{a}} \int_{\mathbb{R}} e^{i \xi b} e^{-2 \sqrt{a}|b|} \ db.
\end{align}$$
Hence, $I(a, b^2)$ and $\frac{\sqrt{\pi}}{2\sqrt{a}} e^{-2 \sqrt{a}|b|}$ have the same Fourier transform. Then you can check that both are continuous and decay exponentially fast at infinity, so they are pointwise the inverse Fourier transform of their Fourier transform, and thus coincide for all $b$. Finally, we get:
$$I(a, b) = \frac{\sqrt{\pi}}{2\sqrt{a}} e^{-2 \sqrt{ab}}.$$
Motivation: a probabilistic proof
I stumbled upon this integral during my research (or rather, a family of such integrals). Let $X$ and $Y$ be two independent random variables, with $Y$ being  exponential $\mathcal{E} (\lambda)$ and $Z$ being standard normal $\mathcal{N} (0, 1)$. Let $X := Z \sqrt{Y}$.
A first computation yields the density of the distribution of $X$. Let $f$ be continuous and bounded on $\mathbb{R}$. Then:
$$\begin{align}
\mathbb{E} (f(X))
& = \frac{\lambda}{\sigma \sqrt{2 \pi}} \int_0^{+ \infty} \int_\mathbb{R} f(z \sqrt{y}) e^{-\frac{z^2}{2}} e^{- \lambda y} \ dz \ dy \\
& = \frac{\lambda}{\sqrt{2 \pi}} \int_0^{+ \infty} e^{- \lambda y} \int_\mathbb{R} \frac{1}{\sqrt{y}} f(b) e^{-\frac{b^2}{2 y}} \ db \ dy  \hspace{2em} \color{#00f}{\text{Change of variables }b=z\sqrt{y}} \\
& = \frac{\lambda}{\sqrt{2 \pi}} \int_\mathbb{R} f(b) \int_0^{+ \infty} \frac{e^{- \lambda y}}{\sqrt{y}} e^{-\frac{b^2}{2 y}} \ dy \ db  \hspace{2em} \color{#00f}{\text{Fubini-Tonelli}} \\
& = \frac{\lambda \sqrt{2}}{\sqrt{\pi}} \int_\mathbb{R} f(b) \int_0^{+ \infty} e^{- \lambda x^2} e^{-\frac{b^2}{2 x^2}} \ dx \ db  \hspace{2em} \color{#00f}{\text{Change of variables }x=\sqrt{y}} \\
\end{align}$$
The density of $X$ is thus given by the function:
$$b \mapsto \frac{\lambda \sqrt{2}}{\sqrt{\pi}} \int_0^{+ \infty} e^{- \lambda x^2-\frac{b^2}{2 x^2}} \ dx.$$
And then, if we compute this integral, we can get a simpler expression for the density. However, it turns out that there is an easier way to compute the distribution of $X$, with the Fourier transform. Indeed, for all real $\xi$,
$$\begin{align}
\mathbb{E} \left( e^{i \xi X} \right) 
& = \mathbb{E} \left( e^{i \xi Z \sqrt{Y}} \right)  \\
& = \mathbb{E} \left( \mathbb{E} \left( e^{i (\xi \sqrt{Y}) Z} |Y \right) \right) \\
& = \mathbb{E} \left( e^{- \frac{\xi^2 Y}{2}} \right) \\
& = \frac{1}{1+\frac{\xi^2}{2\lambda}}, \\
\end{align}$$
which is the Fourier transform of a Laplace distribution of parameter $1/ \sqrt{2 \lambda}$. With the argument of continuity given in the first paragraph, we get:
$$\frac{\lambda\sqrt{2}}{\sqrt{\pi}} \int_0^{+ \infty} e^{- \lambda x^2-\frac{b^2}{2 x^2}} \ dx = \frac{\sqrt{\lambda}}{\sqrt{2}} e^{-\sqrt{2\lambda}|b|},$$
so that:
$$\int_0^{+ \infty} e^{- \lambda x^2-\frac{b^2}{2 x^2}} \ dx = \frac{\sqrt{\pi}}{2 \sqrt{\lambda}} e^{-\sqrt{2\lambda}|b|}.$$
The proof in the first paragraph is the streamlined version of this reasoning. All in all, an interpretation of this integral is that the product of a centered Gaussian and of the square root of an independent exponential random variable is a Laplace random variable.
A: $$\begin{align}
I 
= & \int_0^{\infty} e^{-ax^2 - bx^{-2}} dx\\ 
\stackrel{\color{blue}{[1]}}{=} & 
\left(\frac{b}{a}\right)^{1/4}\int_0^{\infty} e^{-\sqrt{ab}(y^2 + y^{-2})} dy\\
= & 
\left(\frac{b}{a}\right)^{1/4}\left[ \int_0^{1} + \int_1^{\infty} \right] e^{-\sqrt{ab}(y^2 + y^{-2})} dy\\
\stackrel{\color{blue}{[2]}}{=} & 
\left(\frac{b}{a}\right)^{1/4} \int_1^{\infty} e^{-\sqrt{ab}(y^2 + y^{-2})} 
\left(\frac{1}{y^2} + 1\right) dy\\
= & 
\left(\frac{b}{a}\right)^{1/4} \int_1^{\infty} e^{-\sqrt{ab}((y-y^{-1})^2+2)} 
d\left( y - \frac{1}{y}\right)\\
\stackrel{\color{blue}{[3]}}{=} & 
\left(\frac{b}{a}\right)^{1/4} e^{-2\sqrt{ab}} \int_0^{\infty} e^{-\sqrt{ab}\,z^2} dz\\
= &
\left(\frac{b}{a}\right)^{1/4} e^{-2\sqrt{ab}} \frac{\sqrt{\pi}}{2(ab)^{1/4}}\\
= & 
\sqrt{\frac{\pi}{4a}} e^{-2\sqrt{ab}} 
\end{align}
$$
Notes


*

*$\color{blue}{[1]}$ substitute $x$ by $y = \sqrt{\frac{a}{b}} x$.

*$\color{blue}{[2]}$ substitute $y$ by $\frac{1}{y}$ over the interval $[0,1]$.

*$\color{blue}{[3]}$ substitute $y$ by $z = y - \frac{1}{y}$.

A: Let’s do the general integral
$\displaystyle I(a,b)=\int_{0}^{\infty}e^{-(ax^{-2}+bx^{2})}dx$
Differentiate with respect to a
$\displaystyle \frac{\partial I}{\partial a}=\int_{0}^{\infty}x^{-2}e^{-(ax^{-2}+bx^{2})}dx$
Now differentiate with respect to b
$\displaystyle \frac{\partial^2 I}{\partial a \partial b}=\int_{0}^{\infty}x^{-2}x^{2}e^{-(ax^{-2}+bx^{2})}dx$
$\displaystyle \frac{\partial^2 I}{\partial a \partial b}=\int_{0}^{\infty}e^{-(ax^{-2}+bx^{2})}dx$
$\displaystyle \frac{\partial^2 I}{\partial a \partial b}=I$
Thus our integral satisfies this PDE.This is a hyperbolic homogenous PDE. It is a second order PDE but it is first order with respect to each of the variables so we’ll need two boundary conditions to determine a unique solution.(In this case two asympotic BCs and one Drichlet boundary condition will be used).Keep this in mind we’ll need it later.
Let’s complete the square of expression in the exponential.
$\displaystyle I(a,b)=\int_{0}^{\infty}e^{-(ax^{-2}+bx^{2}-2\sqrt{ab}+2\sqrt{ab})}dx$
$\displaystyle I(a,b)=\int_{0}^{\infty}e^{-(\sqrt{a}x^{-1}-\sqrt{b}x)^{2}-2\sqrt{ab}}dx$
$\displaystyle I(a,b)=e^{-2\sqrt{ab}}\int_{0}^{\infty}e^{-(\sqrt{a}x^{-1}-\sqrt{b}x)^{2}}dx$
Now let’s explore more of it’s properties.One thing to note is that this integral diverges(blows up) at b=0 but at a=0 it has a well known value. It is the Gaussian integral so
$\displaystyle I(0,b)=\int_{0}^{\infty}e^{-(bx^{2})}dx=\frac{1}{2}\sqrt{\frac{\pi}{b}}$
The negative exponential was extracted from the integral rather than the positive one beacause
$\displaystyle \lim_{a\to\infty}\int_{0}^{\infty}e^{-(ax^{-2}+bx^{2})}dx=0$
and
$\displaystyle \lim_{a\to\infty}e^{-2\sqrt{ab}}=0$
So let’s assume that we assume that the solution to our PDE is of the form
$\displaystyle I(a,b)=e^{-2\sqrt{ab}}K(b)$
where K is a function of b(and diverges at b=0)
Let’s put this in the PDE
$\displaystyle \frac{\partial I}{\partial a}=-\sqrt{\frac{b}{a}}e^{-2\sqrt{ab}}K(b)$
$\displaystyle \frac{\partial^2 I}{\partial a \partial b}=-\sqrt{\frac{b}{a}}e^{-2\sqrt{ab}}K^{'}(b)-\frac{1}{2\sqrt{ab}}e^{-2\sqrt{ab}}K(b)+\sqrt{\frac{b}{a}}\sqrt{\frac{a}{b}}e^{-2\sqrt{ab}}K(b)$
$\displaystyle \frac{\partial^2 I}{\partial a \partial b}=e^{-2\sqrt{ab}}(-\sqrt{\frac{b}{a}}K^{'}(b)-\frac{K(b)}{2\sqrt{ab}}+K(b))$
As
$\displaystyle \frac{\partial^2 I}{\partial a \partial b}=I$
So
$\displaystyle e^{-2\sqrt{ab}}(-\sqrt{\frac{b}{a}}K^{'}(b)-\frac{K(b)}{2\sqrt{ab}}+K(b))=e^{-2\sqrt{ab}}K(b)$
$\displaystyle -\sqrt{\frac{b}{a}}K^{'}(b)-\frac{K(b)}{2\sqrt{ab}}+K(b)=K(b)$
$\displaystyle -\sqrt{\frac{b}{a}}K^{'}(a)=\frac{K(b)}{2\sqrt{ab}}$
$\displaystyle K^{'}(b)=-\frac{K(b)}{2b}$
This is a separable ODE.Let’s solve it
$\displaystyle \frac{1}{K}dK=-\frac{1}{2}\frac{1}{b}db$
Let’s integrate
$\displaystyle \int \frac{1}{K}dK=-\frac{1}{2}\int \frac{1}{b}db$
$\displaystyle \ln(K)=-\frac{1}{2}\ln(b)+C$
$\displaystyle \ln(K)=\ln(b^{-\frac{1}{2}})+C$
$\displaystyle K=e^{C}b^{-\frac{1}{2}}$
Let
$\displaystyle v=e^{C}$
So
$\displaystyle K(b)=vb^{-\frac{1}{2}}$
Thus the solution is
$\displaystyle I(a,b)=ve^{-2\sqrt{ab}}b^{-\frac{1}{2}}$
This expression diverges at b=0 which is exactly what we wanted. Now let’s determine the constant v. As
$\displaystyle I(0,b)=\frac{1}{2}\sqrt{\frac{\pi}{b}}$
So
$\displaystyle \frac{1}{2}\sqrt{\frac{\pi}{b}}=vb^{-\frac{1}{2}}e^{0}$
$v=\frac{\sqrt{\pi}}{2}$
Thus the integral is
$\displaystyle \boxed{I(a,b)=\frac{1}{2}\sqrt{\frac{\pi}{b}}e^{-2\sqrt{ab}}}  (0\leqslant a,b)$
The given integral is I(b,a) so
$\displaystyle \boxed{I(b,a)=\frac{1}{2}\sqrt{\frac{\pi}{a}}e^{-2\sqrt{ab}}}  (0\leqslant a,b)$
A: Before you use a differentiation under the integral sign it is suitable to do the following variable exchange: $x=\frac{t}{\sqrt{a}}$  
$$I=\frac{1}{\sqrt{a}}\int_{0}^{+\infty}\!e^{(-t^2-\frac{s^2}{t^2})}\,dt;s^2=ab$$ Now, consider it as a function of $s$ and differentiate it with respect to $s$:  
$$\frac{dI}{ds}=\frac{-2}{\sqrt{a}}\int_{0}^{+\infty}\frac{e^{(-t^2-\frac{s^2}{t^2})}}{t^2}sdt=\frac{-2}{\sqrt{a}}\int_{0}^{+\infty}e^{(-t^2-\frac{s^2}{t^2})}dt=-2I$$  
So, to get an answer we need to solve the differential equation
$$\frac{dI}{ds}=-2I$$ and use the fact that  
$$I(0)=\frac{1}{\sqrt{a}}\int_{0}^{+\infty}\!e^{-t^2}\,dt=\frac{1}{\sqrt{a}}\frac{\sqrt{\pi}}{2}$$
