# Calculate $\int_{-\infty}^\infty{x^2\,dx\over (1+x^2)^2}$

The question:\,

Calculate $$\int_{-\infty}^\infty{x^2\,dx\over (1+x^2)^2}.$$

Book's final solution: $$\dfrac\pi 2$$.

My mistaken solution: I don't see where is my mistake because my final solution is $$-\dfrac{\pi i}2$$:

\begin{align} \text{A}:\int_{-\infty}^\infty {x^2\over (1+x^2)^2}dx &= 2\int_{0}^\infty {x^2\over (1+x^2)^2}dx \quad\text{as the function is even}\\&= -2\left(\text{Res}\left({z^2\over (1+z^2)^2}\cdot \ln(z) ,i\right)+\text{Res}\left({z^2\over (1+z^2)^2}\cdot \ln(z) ,-i\right)\right)\end{align} Calculate the residues: Since $$\pm i$$ are poles of order $$2$$, then \begin{align}\text{B}:\text{Res}\left({z^2\ln z\over (1+z^2)^2} ,i\right)&={(2z\ln z+z^2\cdot z^{-1})(z+i)^2-z^2\ln z\cdot 2(z+i)\over (z+i)^4} \\&= \frac{(2i\ln i+i)(-4)+\ln i\cdot 4i }{16} \\ &= {1\over 16} (-8i\ln i -4i+4i\ln i)={-1\over 4}i(\ln i+1)\end{align} whereas \begin{align}\text{C}:\text{Res}\left({z^2\ln z\over (1+z^2)^2} ,-i\right)&={(2z\ln z+z^2\cdot z^{-1})(z-i)^2-z^2\ln z\cdot 2(z-i)\over (z-i)^4} \\ &=\frac{(-2i\ln(- i)-i)(-4)+\ln (-i)\cdot (-4i)}{16} \\ &= {1\over 16} (8i\ln (-i) +4i-4i\ln(- i))={1\over 4}i(\ln (-i)+1)\end{align} Combining $$\text A$$, $$\text B$$ and $$\text C$$, we get $$\int_{-\infty}^\infty {x^2\over (1+x^2)^2}\,dx=-2\left({i\over 4}(\ln(-i)+1)-{i\over 4}(\ln i+1)\right)={-i\over 2}\left({3\pi\over 2}-{\pi\over 2}\right)={-\pi i \over 2}$$ Where is my mistake? Thanks in advance!

• First of all it should be obvious that your final answer is wrong because a real integral equals to a real number, you can't have $i$ in the answer. Also, I don't understand why do you need logarithms here. Just define $f(z)=\frac{z^2}{(1+z^2)^2}$ and try to integrate it over half a circle. (that way you will have only one residue instead of two). – Mark May 25 at 10:18
• When computing a definite integral by residues, the contour to be used must be explicitly stated. – GEdgar May 25 at 10:27

That $$\ln z$$ makes no sense. That integral is equal to $$2\pi i$$ times the sum of the residues at the singularities of $$\frac{z^2}{(1+z^2)^2}$$ in the upper half-plane. There is actually only one such singularity: at $$i$$. So\begin{align}\int_{-\infty}^\infty\frac{x^2}{(1+x^2)^2}\,\mathrm dx&=2\pi i\operatorname{res}_{z=i}\left(\frac{z^2}{(1+z^2)^2}\right)\\&=2\pi i\times\left(-\frac i4\right)\\&=\frac\pi2.\end{align}

• I see you used in Cauchy's residue theorem, but the residue theorem holds for some closed curve $\gamma$ whereas you used the theorem with the curve $L_R:=[-R,R]$ where $R\to\infty$. How does it settle down? – J. Doe May 25 at 11:51
• I didn't add all the details. I used it on a closed curve, which goes from $-R$ to $R$ along the reals, and then goes from $R$ to $-R$ along a semi-circle centered at $0$ in the upper half-plane. I can add that to my answer, if you want it. – José Carlos Santos May 25 at 11:55
• So, if we set $\Gamma_R$ to be the upper half circle centered at $0$ with radii $R$ and $C_R:=\Gamma_R+[-R,R]$, then we have: $\int_{\Gamma_R}+\int_{-R}^R=\int_{C_R}=2\pi i\cdot \text{Res}$ by your answer, but don't we need to show $\int_{\Gamma_R}=0$? – J. Doe May 25 at 12:09
• Sure you do. That follows from the fact that the length of $\Gamma_R$ is $\pi R$, together with the fact that, as $z$ goes to $\infty$, $\left\lvert\frac{z^2}{(1+z^2)^2}\right\rvert$ behaves as $\frac1{\lvert z\rvert^2}$. – José Carlos Santos May 25 at 12:30

If we take the contour $$\sf C$$ to be the upper half-plane (with $$\sf{\Im z>0}$$), then we can write the integrand as $$\sf{\frac{z^2}{(z^2+1)^2}=\frac{\left(\frac{z}{z+i}\right)^2}{(z-i)^2}}$$ since the singularity in $$\sf C$$ is at $$\sf{z=i}$$ (of order two). Thus, using Cauchy's Integral Formula, we obtain $$\sf{\int_{-\infty}^\infty{x^2\over (1+x^2)^2}\,dx=\oint_C\frac{\left(\frac{z}{z+i}\right)^2}{(z-i)^2}\,dz=2\pi i\frac d{dz}\left[\left(\frac{z}{z+i}\right)^2\right]_{z=i}}=2\pi i\cdot\frac{2i\cdot i}{(i+i)^3}=\frac\pi2$$ as required. In your solution, there is no reason to introduce the natural logarithm, as it is not even part of the integrand!

• No offense, but what is your reason for your (frankly bad) choice of font? Nice solution BTW (+1). – clathratus May 25 at 21:32

Do not complicate this simple problem. Just make the substitution $$x= \tan(\theta)$$

$$I=\int_{-\pi/2}^{\pi/2}\frac{\tan^2(\theta)\sec^2(\theta)d\theta}{\sec^4(\theta)}$$

$$I=\int_{-\pi/2}^{\pi/2}\sin^2(\theta)d\theta=2\int_{0}^{\pi/2}\sin^2(\theta)d\theta$$

which is equal to $$I=2\times\frac{\pi}{4}=\frac{\pi}{2}$$

Hope this helps!

Anyway, this integral doesn't require complex analysis: it is well-known that the antiderivatives of $$\:\dfrac 1{(1+x^2)^n}\:$$ can be calculated recursively. In this case, it is particularly simple:

Use integration parts to calculate the integral of $$\frac1{1+x^2}$$, setting $$\begin{gather} u=\frac1{1+x^2},\quad \mathrm d v=\mathrm dx,\quad\text{whence }\quad\mathrm du=\frac{-2x\,\mathrm dx}{(1+x^2)^2},\quad v=x \\[1ex] \text{so }\qquad \frac\pi 2=\int_{0}^\infty {\mathrm dx \over 1+x^2}=\frac x{1+x^2}\biggm|_0^\infty +2 \int_{0}^\infty {x^2\over (1+x^2)^2}\,\mathrm dx =2 \int_{0}^\infty {x^2\over (1+x^2)^2}\,\mathrm dx. \end{gather}$$

Not an answer, strictly speaking, but an alternate method.

$$J=\int_{-\infty}^{\infty}\frac{x^2 dx}{(1+x^2)^2}=2\int_{0}^{\infty}\frac{x^2 dx}{(1+x^2)^2}$$ We may rewrite this as \begin{align} J&=2\int_0^\infty \frac{dx}{1+x^2}-2\int_0^\infty \frac{dx}{(1+x^2)^2}\\ &=\pi-2\int_0^\infty \frac{dx}{(1+x^2)^2}\ . \end{align} From here, we have that if $$I_n=\int\frac{dx}{(ax^2+b)^n}\qquad a,b>0, n\in\Bbb N$$ then $$I_{n}=\frac{x}{2b(n-1)(ax^2+b)^{n-1}}+\frac{2n-3}{2b(n-1)}I_{n-1}\qquad n>1\ ,$$ with the base case $$I_1=\frac1{\sqrt{ab}}\arctan\sqrt{\frac{a}{b}}x+C\ .$$ Hence we have (with $$a=b=n-1=1$$) \begin{align} \int_0^\infty\frac{dx}{(x^2+1)^2}&=\frac{x}{2(x^2+1)}\bigg|_0^\infty+\frac{1}{2}\int_0^\infty\frac{dx}{x^2+1}\\ &=0+\frac12\cdot\frac\pi2\\ &=\frac\pi4 \end{align} So \begin{align} J&=\pi-2\cdot\frac\pi4\\ &=\frac\pi2 \end{align}