# How to evaluate the integral $\int_0^{\infty} e^{-\frac{1}{2}\left(x^2+ \frac{c}{x^2}\right)}dx$? [duplicate]

I am wondering how one would calculate the integral:

$$\int_0^{\infty} e^{-\frac{1}{2}\left(x^2+ \frac{c}{x^2}\right)}dx$$

where $c$ is a constant. I have tried to reparametrize by letting $u = x^2$ to get:

$$\int_0^{\infty} \frac{1}{2\sqrt{u}} e^{-\frac{1}{2}\left(u+\frac{c}{u}\right)}du$$

and then trying to use integration by parts. However, I am getting nowhere with that approach.

## marked as duplicate by Felix Marin calculus StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Oct 1 '16 at 1:18

• A thought I've not fully developed, so may be useless. What about the substitution $u=\dfrac{\sqrt{c}}{x}$? I make no guarantee of its effectiveness though. – Daryl Sep 30 '16 at 7:25

Consider $$F(c)=\int_0^{\infty} e^{-\frac{1}{2}\left(x^2+ \frac{c}{x^2}\right)}dx.$$ Notice that for convergence we need that $c\geq 0$. Then, for $c>0$, $$F'(c)=-\frac{1}{2}\int_0^{\infty} e^{-\frac{1}{2}\left(x^2+ \frac{c}{x^2}\right)}\frac{dx}{x^2}.$$ On the other hand, by Daryl's comment, by letting $t=\sqrt{c}/x$ we get $dx=-\sqrt{c}dt/t^2$ and $$F(c)=\sqrt{c}\int_0^{\infty} e^{-\frac{1}{2}\left(t^2+ \frac{c}{t^2}\right)}\frac{dt}{t^2}=-2\sqrt{c}F'(c).$$ Hence, by solving the differential equation in $(0,+\infty)$, we find $$F(c)=F(0^+)\cdot e^{-\sqrt{c}}=\sqrt{\pi/2}\cdot e^{-\sqrt{c}}.$$

• I also tried this approach, but couldn't justify my work. As you said, if you let $x \mapsto \sqrt{c}/x$ the integral becomes $$\int_{0}^{\infty} e^{-1/2(x^{2} + c/x^{2})} \frac{\sqrt{c}}{x^{2}} dx$$ Hence, $$\int_{0}^{\infty} e^{-1/2(x^{2} + c/x^{2})} \cdot \left( 1 - \frac{\sqrt{c}}{x^{2}} \right) dx = 0$$ The integrand is only zero when $x^* = c^{1/4}$, so evaluating our original problem at $x^*$ $$\int_{0}^{\infty} e^{-1/2(x^{2} + \sqrt{c})} dx = \sqrt{\frac{\pi}{2}}e^{-\sqrt{c}}$$ I'm not actually sure why evaluating at $x^{*}$ gave the correct result? Do you know? – Mattos Sep 30 '16 at 7:59
• @RobertZ Where did the minus sign from the substitution go? – snulty Sep 30 '16 at 15:04
• @snulty I used it to reverse the integral. – Robert Z Sep 30 '16 at 15:10
• @RobertZ Ah yes thanks! – snulty Sep 30 '16 at 15:12

$t={1\over x}$, then $$I=\int\limits_0^\infty e^{-\left(x^2+ \frac1{x^2}\right)}dx=\int\limits_0^\infty e^{-\left({1\over t^2}+t^2\right)}{dt\over t^2}$$ Now rewrite the second integral by renaming its variable to $x$ (we can name our variables whatever we like, can't we?), and add them together: $$2I=\int\limits_0^\infty e^{-\left(x^2+ \frac1{x^2}\right)}\left(1+{1\over x^2}\right)dx$$ Now comes another ingenious substitution: $t=x-{1\over x}$, so $dt=\left(1+{1\over x^2}\right)dx$, and

$$2I=\int\limits_{x=0}^{x=\infty} e^{-\left(x^2+ \frac1{x^2}\right)}dt=\int\limits_{t=-\infty}^{t=\infty} e^{-\left(x-\frac1x\right)^2-2}dt={1\over e^2}\int\limits_{-\infty}^\infty e^{-t^2}dt$$ which you supposedly know how to finish.

The minor details concerning introduction of some coefficients ($c$, etc.) I leave to you. Apparently, the first step should be modified according to Daryl's comment.

• your notation for the change of variable at the end are awful – reuns Sep 30 '16 at 8:51
• I was aiming at being understood, rather than beauty. – Ivan Neretin Sep 30 '16 at 9:42
• for being understood : $t = x - 1/x,\ dt = (1+1/x^2)dx, \ x^2+1/x^2 = (x - 1/x)^2-2 = t^2-2$ and $\int_{0}^\infty e^{-(x^2+1/x^2)} (1+1/x^2) dx = \int_{-\infty}^\infty e^{-(t^2-2)} dt$ – reuns Sep 30 '16 at 9:44
• It's $t^2+2$, not $t^2-2$. Other than that, thank you for your contribution, but I prefer to leave my answer the way it is now. – Ivan Neretin Sep 30 '16 at 9:55

Assuming $c>0$, we may just apply Glasser's master theorem.

$$\int_{\mathbb{R}}\exp\left[-\frac{1}{2}\left(x^2+\frac{c}{x^2}\right)\right]\,dx = e^{-\sqrt{c}}\int_{\mathbb{R}}\exp\left[-\frac{1}{2}\left(x-\frac{\sqrt{c}}{x}\right)^2\right]\,dx$$ and the last integral equals $$e^{-\sqrt{c}}\int_{\mathbb{R}}\exp\left(-\frac{x^2}{2}\right)\,dx = \color{red}{\sqrt{2\pi}e^{-\sqrt{c}}}.$$

• And then we divide by $2$ to get the op's integral? – snulty Sep 30 '16 at 15:16
• @snulty: sure, by parity of the first integrand function. – Jack D'Aurizio Sep 30 '16 at 15:17

\begin{align} \int_0^\infty e^{-\frac12\left(x^2+\frac{c}{x^2}\right)}\,\mathrm{d}x &=c^{1/4}e^{-\sqrt{c}}\int_0^\infty e^{-\frac{\sqrt{c}}2\left(x^2+\frac1{x^2}-2\right)}\,\mathrm{d}x\tag{1}\\ &=\frac12c^{1/4}e^{-\sqrt{c}}\int_{-\infty}^\infty e^{-\frac{\sqrt{c}}2y^2}\left(1+\frac{y}{\sqrt{y^2+4}}\right)\mathrm{d}y\tag{2}\\ &=\sqrt{\frac\pi2}\,e^{-\sqrt{c}}\tag{3} \end{align} Explanation:
$(1)$: substitute $x\mapsto c^{1/4}x$
$(2)$: substitute $y=x-\frac1x\implies x=\frac{y+\sqrt{y^2+4}}2$
$(3)$: $\int_{-\infty}^\infty e^{-ay^2}\,\mathrm{d}y=\sqrt{\frac\pi a}$ and the integral of an odd function over $(-\infty,\infty)$ is $0$

We can also use the Cauchy-Schlomilch transformation. For $a,b \gt 0$ $$\int\limits_{0}^{\infty} f\Big[\left(ax - \frac{b}{x} \right)^{2} \Big] \mathrm{d} x = \frac{1}{a} \int\limits_{0}^{\infty} f(y^{2}) \mathrm{d}y \tag{1} \label{eq:1}$$

Expanding the term inside of the integrand, we have $$\left(ax - \frac{b}{x} \right)^{2} = a^{2} x^{2} - 2ab + \frac{b^{2}}{x^{2}}$$

$$-a^{2} x^{2} - \frac{b^{2}}{x^{2}} = -2ab - \left(ax - \frac{b}{x} \right)^{2}$$

Matching variables with our problem, we have $a^{2} = 1/2$ and $b^{2} = c/2$ and the term in the exponential of our problem becomes $$-\frac{1}{2}x^{2} - \frac{c}{2}\frac{1}{x^{2}} = -\sqrt{c} - \left(\frac{x}{\sqrt{2}} - \frac{1}{x}\sqrt{\frac{c}{2}} \right)^{2}$$

Substituting this into our integral, yields \begin{align} \int\limits_{0}^{\infty} \mathrm{exp}\left( -\frac{1}{2}x^{2} - \frac{c}{2}\frac{1}{x^{2}} \right) \mathrm{d} x &= \mathrm{e}^{-\sqrt{c}} \int\limits_{0}^{\infty} \mathrm{exp}\Big[-\left( \frac{x}{\sqrt{2}} - \frac{1}{x}\sqrt{\frac{c}{2}} \right)^{2} \Big] \mathrm{d} x \\ \tag{a} &= \sqrt{2}\,\mathrm{e}^{-\sqrt{c}} \int\limits_{0}^{\infty} \mathrm{e}^{-y^{2}} \mathrm{d} y \\ \tag{b} &= \sqrt{2}\,\mathrm{e}^{-\sqrt{c}} \,\frac{\sqrt{\pi}}{2} \mathrm{erf}(y) \Big|_{0}^{\infty} \\ &= \sqrt{\frac{\pi}{2}}\mathrm{e}^{-\sqrt{c}} \end{align}

Notes:

a. Use the Cauchy-Schlomilch transformation, equation $\eqref{eq:1}$.

b. $\mathrm{erf}(z)$ is the error function.