Verify exponential integral $\int_0^\infty e^{-\frac{1}{2}(x+\frac{a}{x})^2}dx=\sqrt{\frac{\pi}{2}}e^{-a-|a|}$ I need to verify a result $$\int_0^\infty\exp\left[-\frac{1}{2}\left(x+\frac{a}{x}\right)^2\right]dx=\sqrt{\frac{\pi}{2}}e^{-a-|a|}$$ for $a\in\mathbb{R}$ . What I tried so far is to use residue calculus , but the problem is here $z=0$ would become an essential singularity and it can't be removed by using an inverse sbstitution that is usually made due to the symmetrical $\displaystyle z+\frac{1}{z}$ factor in the integrand . So I have no idea to proceed . Is there any other approach than residue calculus ? If not , what could make the residue approach a bit more easier ? Thanks in advance .
 A: For $a \ne 0$ we can substitute $x$ by $|a|/x$, that gives
$$
 F(a) = \int_0^\infty\exp\left[-\frac{1}{2}\left(x+\frac{a}{x}\right)^2\right]\, dx = |a| \int_0^\infty \exp\left[-\frac{1}{2}\left(x+\frac{a}{x}\right)^2\right]\frac{1}{x^2}\, dx \, .
$$
And differentiating with respect to $a$ gives
$$
 F'(a) = \int_0^\infty\exp\left[-\frac{1}{2}\left(x+\frac{a}{x}\right)^2\right]\, \left( -1 - \frac{a}{x^2}\right)dx 
=  (-1 - \operatorname{sign}(a))F(a) \, .
$$
We conclude that $F'(a) = 0$ for $a < 0$, so that $F$ is constant on $(-\infty, 0]$.
For $a > 0$ we get $F'(a) = -2 F(a)$, so that $F(a) = Ce^{-2a}$ for some constant $C$, which can be found by considering the limit $a \to 0$.
(I leave it to you to justify the above steps, i.e. show that $F$ is continuous on $\Bbb R$, and can be differentiated under the integral for $a \ne 0$.)
A: Rewrite the integral as
$$\int_0^\infty e^{-\frac{1}{2}\left(x+\frac{a}{x}\right)^2}dx
= \frac12 \int_{-\infty}^\infty e^{-\frac{1}{2}\left(x+\frac{a}{x}\right)^2}dx
= \frac12 e^{-a-|a|} \int_{-\infty}^\infty e^{-\frac{1}{2}\left(x-\frac{|a|}{x}\right)^2}dx\\
$$
Note that
\begin{align}
\int_{-\infty}^{\infty} f\left(x-\frac {c^2}x \right) dx
&= \int_{-\infty}^{0} 
\overset{x=-c e^{-t}} {f\left(x-\frac {c^2}x \right) dx }+ \int_{0}^{\infty} \overset{x=c e^t}{f\left(x-\frac {c^2}x \right) dx}\\
&= \int_{-\infty}^{\infty} \underset{ x=c(e^t-e^{-t})}{f[c(e^t-e^{-t})]c(e^t +e^{-t})} dt =\int_{-\infty}^{\infty} f(x) dx
\end{align}
Thus
$$\int_0^\infty e^{-\frac{1}{2}\left(x+\frac{a}{x}\right)^2}dx
=\frac12 e^{-a-|a|} \int_{-\infty}^\infty e^{-\frac{1}{2}x^2}dx=\sqrt{\frac{\pi}{2}}e^{-a-|a|}$$
A: Another solution: It follows from
$$
(x+\frac ax)^2 =  (x-\frac ax)^2 + 4a
$$
that
$$
F(a) = \int_0^\infty\exp\left[-\frac{1}{2}\left(x+\frac{a}{x}\right)^2\right]\, dx 
$$
satisfies
$$
 F(a) = e^{-2a} F(-a)
$$
for all $a \in \Bbb R$. Therefore it suffices to prove that $F(a) = F(0) = \sqrt{\pi/2}$ for $a < 0$, and that is an immediate consequence of the “Cauchy–Schlömilch transformation”, see Theorem 2.1 in T. Amdeberhnan, M. L. Glasser, M. C. Jones, V. H. Moll, R. Posey, and D. Varela, "The Cauchy–Schlömilch transformation".
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\bbox[5px,#ffd]{\left.\int_{0}^{\infty}\exp\pars{-{1 \over 2}\bracks{x + {a \over x}}^{2}}\dd x\,\right\vert_{a\ \in\ \mathbb{R}}}
\\[5mm] = &
\int_{0}^{\infty}\exp\pars{-{1 \over 2}\bracks{x + \on{sgn}\pars{a}{\verts{a} \over x}}^{2}}\dd x
\\[5mm] = &
\int_{0}^{\infty}
\exp\pars{-{1 \over 2}\verts{a}\bracks{{x \over \root{\verts{a}}} + {\on{sgn}\pars{a}\root{\verts{a}} \over x}}^{2}}\dd x
\\[5mm] = &
\left.\int_{-\infty}^{\infty}
\exp\pars{-2\verts{a}\on{f}_{\pm}^{2}\pars{\theta}}\root{a}\expo{\theta}\dd\theta
\right\vert_{\substack{\ds{\on{f}_{+}:\ \cosh} \\[0.25mm] \ds{\on{f}_{-}:\ \sinh}}}
\\[5mm] = &\
2\root{a}\int_{0}^{\infty}
\exp\pars{-2a\on{f}_{\pm}^{2}\pars{\theta}}\cosh\pars{\theta}\dd\theta
\\[5mm] = &\
2\root{a}\expo{-a - \verts{a}}\times
\\[2mm] & \int_{0}^{\infty}
\exp\pars{-2a\sinh^{2}\pars{\theta}}\cosh\pars{\theta}\dd\theta
\\[5mm] = &\
2\root{a}\expo{-a - \verts{a}}\int_{0}^{\infty}
\exp\pars{-2a t^{2}}\dd t
\\[5mm] = &
2\root{a}\expo{-a - \verts{a}}{1 \over \root{2a}}{\root{\pi} \over 2} =
\bbox[5px,#ffd]{\root{\pi \over 2}\expo{-a - \verts{a}}} 
\end{align}
