As the question suggests, I came across the following integral in a calculation: $$\int_0^1 (1 - x) \sqrt{2\over\pi} e^{x^2/2}dx.$$ According to Wolfram Alpha, this equals$$\text{erfi}\left({1\over{\sqrt{2}}}\right) - (\sqrt{e} - 1)\sqrt{2\over\pi} \approx 0.435834.$$However, I'm wondering if anyone can give a reasonable numerical estimate for this integral from first principles (pencil and paper) without using a calculator or Wolfram Alpha.

I've tried but made little to no progress, and two PhD students I consulted didn't know either, so I'm asking here.

  • 1
    $\begingroup$ Have you tried to approximate this using the Taylor expansion of $\exp$? Once you have that, it's just a matter of integrating polynomials and estimating the fractions you get out of them. There are results that deal with the errors. $\endgroup$ Sep 21, 2022 at 8:35
  • 2
    $\begingroup$ The $\sqrt{2/\pi}$ factor unnecessarily complicates pencil-based solutions. $\endgroup$
    – J.G.
    Sep 21, 2022 at 8:58
  • $\begingroup$ You have solid answers below. And if it's worth anything $I(x) := \int_0^x\,(x - \xi)\,e^{\xi^2/2}\,d\xi = \tfrac{1}{2} x^2f(x^2)$ where \begin{equation} f(w) = 1 + \tfrac{1}{12} w + \tfrac{1}{120}w^2 + \tfrac{1}{1344}w^3 + \tfrac{1}{17280}w^4 + \cdots \end{equation} $\endgroup$ May 18, 2023 at 21:15

3 Answers 3


Write $$(1-x)\, e^{\frac {x^2}2}=\sum_{n=0}^\infty \frac {x^{2n}}{2^n\,n!}-\sum_{n=0}^\infty \frac {x^{2n+1}}{2^n\,n!}$$ $$\int_0^1 (1-x)\, e^{\frac {x^2}2}\,dx=\sum_{n=0}^\infty \frac 1{2^{n+1}\,(2n+1)\, (n+1)!}$$ COmputing the partial sums $$S_p=\sum_{n=0}^p \frac 1{2^{n+1}\,(2n+1)\, (n+1)!}$$ this generates the sequence $$\left\{\frac{1}{2},\frac{13}{24},\frac{131}{240},\frac{2447}{4480},\frac{26429}{48384 },\frac{5814401}{10644480},\frac{151174459}{276756480},\cdots\right\}$$

  • $\begingroup$ Looks like we gain about an extra digit of accuracy each time we pass to the next term, although I assume that eventually improves due to the factorial growth. $\endgroup$ Sep 21, 2022 at 8:58
  • $\begingroup$ @QiaochuYuan. Yes, almost since $\frac{a_{n+1}}{a_n}\sim \frac 1{2n}$ $\endgroup$ Sep 21, 2022 at 9:03

$e^{\frac{x^2}{2}} \ge 1 + \frac{x^2}{2}$ gives us a lower bound of

$$\sqrt{\frac{2}{\pi}} \int_0^1 (1 - x) \left( 1 + \frac{x^2}{2} \right) \, dx = \sqrt{\frac{2}{\pi}} \left( \frac{13}{24} \right) > 0.43.$$

To get a similar upper bound, by convexity we have $e^x \le 1 + (e - 1) x$ for $x \in [0, 1]$ which gives $e^{\frac{x^2}{2}} \le 1 + (e - 1) \frac{x^2}{2}$, hence an upper bound of

$$\sqrt{\frac{2}{\pi}} \int_0^1 (1 - x) \left( 1 + (e - 1) \frac{x^2}{2} \right) \, dx = \sqrt{ \frac{2}{\pi} } \left( \frac{11 + e}{24} \right) < 0.46.$$

If you want more accuracy than this or a way to bound $\sqrt{\frac{2}{\pi}}$ we could keep going but I assume dealing with the integral was the part you wanted to focus on. We can use the next term in the Taylor series expansion which gives bounds $1 + x + \frac{x^2}{2} \le e^x \le 1 + x + (e - 2) x^2$. Using this term the graphs of the functions are already nearly visually indistinguishable.


$$\int_0^1 (1 - x) \sqrt{2\over\pi} e^{x^2/2}dx=\int_0^1 \sqrt{2\over\pi} e^{x^2/2}dx-\int_0^1 x \sqrt{2\over\pi} e^{x^2/2}dx$$

The first term is imaginary error function. The second term is easier.

Since, $erfi(x)=\frac{2}{\sqrt{\pi}}\int_0^x e^{t^2}dt$

First term: $erfi(\frac{1}{\sqrt{2}})=\int_0^1 \sqrt{2\over\pi} e^{x^2/2}dx$

Second term: $\int_0^1 x \sqrt{2\over\pi} e^{x^2/2}dx=\int_0^1 \sqrt{2\over\pi} e^{x^2/2}d\frac{x^2}{2}=[\sqrt{2\over\pi} e^{x^2/2}]^1_0=\sqrt{2\over\pi}(\sqrt{e}-1)$

Then the problem is how to estimate $erfi(\frac{1}{\sqrt{2}})$ use calculator.

By trapezoidal rule

$erfi(\frac{1}{\sqrt{2}})\approx \sqrt{2\over\pi}(\frac{1+\sqrt{e}}{2}) \approx 1.0567$

By mid-point rule

$erfi(\frac{1}{\sqrt{2}})\approx \sqrt{2\over\pi}(e^\frac{1}{8}) \approx 0.9041$

Use Maclaurin series

$erfi(\frac{1}{z})\approx \frac{2}{\sqrt{\pi}}(z+\frac{z^3}{3}+\frac{z^5}{10}+\frac{z^7}{42}+\frac{z^9}{216}+...)$

$erfi(\frac{1}{\sqrt{2}})\approx \sqrt{2\over\pi}(1+\frac{1}{6}+\frac{1}{40}+\frac{1}{336}+\frac{1}{3456}+...) \approx 0.9534$

This series can be as accurate as you want and workable by a calculator.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .