# On $\int_0^\infty \frac{\exp(-x^2)}{1+x^2}dx=\frac{\pi e}2\text{erfc}(1)$

I was attempting to answer this question, but then I came across a question of my own involving my attempt.

Task: Prove $$\int_0^\infty\frac{\exp(-x^2)}{1+x^2}\mathrm dx=\frac{\pi e}2\text{erfc}(1)$$ Attempt: $$I=\int_0^{\infty}\frac{\exp(-x^2)}{1+x^2}\mathrm dx$$ We then use the Taylor series for the exponential function to find that $$I=\sum_{n\geq0}\frac{(-1)^n}{n!}\int_0^\infty\frac{x^{2n}}{1+x^2}\mathrm dx$$ Setting $$x=\tan u$$, $$I=\sum_{n\geq0}\frac{(-1)^n}{n!}\int_0^{\pi/2}\tan(u)^{2n}\mathrm{d}u$$ $$I=\sum_{n\geq0}\frac{(-1)^n}{n!}\int_0^{\pi/2}\sin(u)^{2n}\cos(u)^{-2n}\mathrm{d}u$$ And using $$\int_0^{\pi/2}\sin(t)^a\cos(t)^b\mathrm{d}t=\frac{\Gamma(\frac{a+1}{2})\Gamma(\frac{b+1}{2})}{2\Gamma(\frac{a+b}{2}+1)}$$ We have $$I=\frac12\sum_{n\geq0}\frac{(-1)^n}{n!}\Gamma\bigg(\frac{1+2n}{2}\bigg)\Gamma\bigg(\frac{1-2n}{2}\bigg)$$ $$I=\frac12\sum_{n\geq0}\frac{(-1)^n}{n!}\Gamma\bigg(\frac12+n\bigg)\Gamma\bigg(\frac12-n\bigg)$$ Recall the Gamma reflection formula: $$\Gamma(s)\Gamma(1-s)=\pi\csc\pi s\ ,\qquad s\not\in\Bbb Z$$ Since $$n\in\Bbb N_0$$, we have $$\frac12+n\not\in\Bbb Z$$, which means we may plug in $$s=\frac12+n$$: $$I=\frac12\sum_{n\geq0}\frac{(-1)^n}{n!}\pi\csc\bigg(\frac\pi2+\pi n\bigg)$$ $$I=\frac\pi2\sum_{n\geq0}\frac{(-1)^n}{n!}\csc\bigg(\frac\pi2(2n+1)\bigg)$$ Then we recall that $$\sin\bigg(\frac\pi2(2n+1)\bigg)=(-1)^n,\qquad n\in\Bbb Z$$ So we have $$I=\frac\pi2\sum_{n\geq0}\frac{(-1)^n}{n!}\frac1{(-1)^n}$$ $$I=\frac\pi2\sum_{n\geq0}\frac1{n!}$$ $$I=\frac{\pi e}2$$

But $$\frac{\pi e}2\neq \frac{\pi e}2\text{erfc}(1)$$ What did I do wrong? Thanks.

Edit:

I see that $$\int_{\Bbb R^+}\frac{x^{2n}}{1+x^2}\mathrm dx$$ diverges, and as was pointed out in the comments, I can't interchange the $$\sum$$ and $$\int$$, but why? The Taylor series converges for all $$x\in\Bbb R_0^+$$, so what's wrong with the swappage?

• you can't interchange the sum for the Taylor series with the integral. you secretly know that such an interchange cannot be justified, since $\int_0^\infty \frac{x^{2n}}{1+x^2}dx$ diverges – mathworker21 Dec 16 '18 at 22:29
• @mathworker21 see the edit I just made – clathratus Dec 16 '18 at 22:31
• so the technical reason as to why you cannot interchange the taylor series and the integral even though the taylor series converges pointwise, is that the taylor series does not converge uniformly. There are various conditions that say when you can make such "swappages", but conceptually, the reason is that the Taylor series oscillates so much that we need to let it cancel itself out before we integrate it (btw, the swappage is valid if everything involved is non-negative). Admittedly, I find it pretty hard to think about conceptually – mathworker21 Dec 16 '18 at 22:36
• it's fine. but I am curious what goes wrong when you calculate the integral, since you do end up with a finite number – mathworker21 Dec 16 '18 at 22:44
• @mathworker21 $$B(x,y):=2\int_0^{\pi/2}\sin^{2x-1}t\cos^{2y-1}t~\mathrm dt=\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}$$ is true only if $\Re x>0$ and $\Re y >0$. – Tianlalu Dec 16 '18 at 22:51

the integral $$\int_{R_+}dx x^{2n}/(1+x^2)$$heavily diverges, so your first step is already completly wrong (Taylor of $$\exp$$ is useless here, you can't interchange Summation and Integration as pointed out in the comments)!