TITLE: How to integrate $\displaystyle 1-e^{-1/x^2}$?
QUESTION [8 upvotes]: How to integrate $\displaystyle 1-e^{-1/x^2}$ ?
as hint is given: $\displaystyle\int_{\mathbb R}e^{-x^2/2}=\sqrt{2\pi}$

If i substitute $u=\dfrac{1}{x}$, it doesn't bring anything:
$\,\displaystyle\int\limits_{-\infty}^{\infty}\left(1-e^{-1/x^2}\right)dx=\int\limits_{-\infty}^{0}\left(1-e^{-1/x^2}\right)dx+\int\limits_{0}^{\infty}\left(1-e^{-1/x^2}\right)dx\overset{?}=2\int\limits_{0}^{\infty}\left(1-\frac{e^{-u^2}}{-u^2}\right)du$
$2\displaystyle\int\limits_{0}^{\infty}\left(1-\frac{e^{-u^2}}{-u^2}\right)du=?$
How to continue ?
$\textbf{The original exercise was}$:
If a probability has a density $f(x)=C(1-e^{-1/x^2})$ then determine the value of constant $C$
Since $\displaystyle\int f\overset{!}=1$, i thought first to calculate the expression above.
($\textbf{ATTENTION:}$ Question edited from integrating $e^{-1/x^2}$ to integrating
$1-e^{-1/x^2}$)

REPLY [11 votes]: First integrate by part and then substitute $x$ by $1/y$.
$$\begin{align}
\int_0^\infty (1-e^{-1/x^2})dx &= 
\left[(1-e^{-1/x^2})x\right]_0^\infty - \int_0^\infty x \left(-\frac{2}{x^3}\right) e^{-1/x^2} dx\\
&= 2\int_0^\infty e^{-y^2} dy = \sqrt{\pi}
\end{align}
$$

REPLY [6 votes]: Here is another technique of introducing a parameter. Indeed, let us consider the integral
$$ I(s) = \int_{-\infty}^{\infty} (1 - e^{-s/x^{2}}) \, dx $$
instead. We then want to find the value if $I(1)$. To this end, we calculate $I'(s)$ and appeal to the Fundamental Theorem of Calculus.
We first simplify $I(s)$ by using change of variable. Let $u = 1/x$. Then by symmetry,
$$ I(s) = 2\int_{0}^{\infty} (1 - e^{-s/x^{2}}) \, dx = 2\int_{0}^{\infty} \frac{1 - e^{-su^{2}}}{u^{2}} \, du. $$
Then we differentiate both sides with respect to $s$. Exploiting Leibniz's integral rule yields
$$ I'(s) = 2\int_{0}^{\infty} \frac{\partial}{\partial s} \frac{1 - e^{-su^{2}}}{u^{2}} \, du = 2\int_{0}^{\infty} e^{-su^{2}} \, du. $$
Now with the additional substitution $v = \sqrt{2s}u$ (where $s > 0$), we have
$$ I'(s) = \sqrt{\frac{2}{s}} \int_{0}^{\infty} e^{-v^{2}/2} \, dv = \frac{1}{\sqrt{2s}} \int_{-\infty}^{\infty} e^{-v^{2}/2} \, dv = \sqrt{\frac{\pi}{s}}. $$
But it is trivial that $I(0) = 0$ (since the integrand vanishes identically). Therefore by the Fundamental Theorem of Calculus,
$$ I(1) = I(0) + \int_{0}^{1} I'(s) \, ds = \int_{0}^{1} \sqrt{\frac{\pi}{s}} \, ds = \left. 2\sqrt{\pi s} \vphantom{\int} \right|_{0}^{1} = 2\sqrt{\pi}. $$