how to evaluate $ \int_0^\infty e^{- \left ( x - \frac a x \right )^2} dx $ How do I evaluate the following definite integral$$ \int_0^\infty e^{- \left ( x - \frac a x \right )^2} dx $$
 A: another solution from me :
$$I=\int_{0}^{\infty }e^{-(x-\frac{a}{x})^2}dx\\
\\
=\frac{1}{2}\int_{0}^{\infty }(1+\frac{a}{x^2}+(1-\frac{a}{x^2})) .e^{-(x-\frac{a}{x})^2}dx\\$$
\
$$=\frac{1}{2}\int_{0}^{\infty }e^{-(x-\frac{a}{x})^2}d(x-\frac{a}{x})+\frac{1}{2}\int_{0}^{\infty }e^{-(x-\frac{a}{x})^2}d(x+\frac{a}{x})\\
\\$$
$$=\frac{1}{2}\int_{0}^{\infty }e^{-(x-\frac{a}{x})^2}d(x-\frac{a}{x})+\frac{e^{4a}}{2}\int_{0}^{\infty }e^{-(x+\frac{a}{x})^2}d(x+\frac{a}{x})\\
\\$$
$$=\frac{1}{2}\int_{-\infty }^{\infty }e^{-y^2}dy+\frac{e^{4a}}{2}\int_{\infty }^{\infty }e^{-y^2}dy\\
\\
\\$$
$$=\int_{0}^{\infty }e^{-y^2}dy+0=\sqrt{\pi }\\
\\
\therefore \ \ \ \ \ I=\int_{0}^{\infty }e^{-(x-\frac{a}{x})^2}dx=\sqrt{\pi }$$
A: I will assume that $a > 0$. Let $y = \frac{a}{x}$. Then
$$I := \int_{0}^{\infty}e^{-\left(x-\frac{a}{x}\right)^2}\;dx = \int_{0}^{\infty}\frac{a}{y^2} \, e^{-\left(y-\frac{a}{y}\right)^2}\;dy.$$
Thus we have
$$2I = \int_{0}^{\infty}\left(1 + \frac{a}{x^2}\right) e^{-\left(x-\frac{a}{x}\right)^2}\;dx. $$
Now by the substitution $t = x - \frac{a}{x}$,
$$2I = \int_{-\infty}^{\infty} e^{-t^2} \; dt = \sqrt{\pi}.$$
Therefore $I = \frac{\sqrt{\pi}}{2}$.
(You can see that this generalizes to any integrable even function on $\Bbb{R}$)
