Evaluate $\int_{-\infty}^\infty \frac{1}{(x^2 + D^2)^2}dx$. $$\int_{-\infty}^\infty \frac{1}{(x^2 + D^2)^2}dx$$
Edit : $D> 0$.
My work:
Let $x = D\tan \theta$
$$\int_{-\infty}^\infty \frac{1}{(x^2 + D^2)^2}dx=\int_{-\infty}^\infty \frac{1}{(D^2\sec^2 \theta)^2}dx$$
$$=\int_{-\infty}^\infty \frac{1}{(D^2\sec^2 \theta)^2}D\sec^2\theta d\theta
= \frac{1}{D^3}\int_{-\infty}^\infty \cos^2 \theta d\theta$$
$$=\frac{1}{D^3}[\frac{\theta}{2} + \frac{\sin {2\theta}}{4} + C]_{-\infty}^\infty$$
Put $\theta = \arctan{\frac{x}{D}}$;
$$=\frac{1}{D^3}[\frac{\arctan{\frac{x}{D}}}{2} + \frac{\sin {(2\arctan{\frac{x}{D})}}}{4} + C]_{-\infty}^\infty$$
We get the integral as $\frac{\pi}{2D^3}$. Since $\lim_{x \to +\infty} \arctan(x) = \frac{\pi}{2}$ and $\lim_{x \to -\infty} \arctan(x) = \frac{-\pi}{2}$
I feel something isn't right here. Can anyone point the mistake please. Thank you very much.
 A: Do you know about complex analysis? Integrals like this became trivial:
We consider the contour integral
$$\oint_C  \frac{1}{(z^2+D^2)^2}dz=\int_{\Gamma_R}\frac{1}{(z^2+D^2)^2}dz +\int_{[-R,R]}\frac{1}{(z^2+D^2)^2}dz  $$
where $C$ is a semicircle in the upper half plane.  By the residue theorem, we need only consider the pole at $z=Di$.  As the radius of the semicircle goes to infinity, we find that
$$\lim_{R\to\infty}\int_{\Gamma_R}\frac{1}{(z^2+D^2)^2}dz=0$$
so
$$\lim_{R\to\infty}\int_{[-R,R]}\frac{1}{(z^2+D^2)^2}dz=\int_{-\infty}^{\infty}\frac{1}{(z^2+D^2)^2}dz=\oint_C  \frac{1}{(z^2+D^2)^2}dz=2\pi i Res(f,Di)=2\pi i\lim_{z\to Di}\frac{d}{dz}((z-Di)^2f(z))=\frac{\pi}{2D^3}$$
A: Here is another method to solve. Let
\begin{eqnarray}
I&=&\int_{-\infty}^\infty \frac{1}{(x^2 + D^2)^2}dx=\frac{2}{D^3}\int_{0}^\infty \frac{1}{\bigg[\big(\frac{x}{D}\big)^2 + 1)\bigg]^2}d(\frac xD)\\
&\stackrel{x/D\to x}{=}&\frac{2}{D^3}\int_{0}^\infty \frac{1}{(x^2 + 1)^2}dx\tag1\\
&\stackrel{1/x\to x}{=}&\frac{2}{D^3}\int_{0}^\infty \frac{x^2}{(x^2 + 1)^2}dx\\\tag2.
\end{eqnarray}
Adding (1) to (2) gives
\begin{eqnarray}
2I&=&\frac{2}{D^3}\int_{0}^\infty \frac{x^2+1}{(x^2 + 1)^2}dx\\
&=&\frac{2}{D^3}\int_{0}^\infty \frac{1}{x^2+1}dx\\
&=&\frac{2}{D^3}\cdot\frac{\pi}{2}
\end{eqnarray}
and hence $I=\frac{\pi}{2D^3}$.
A: As said in the comments, your answer looks good. If you wanted to generalize to the case $D\in\mathbb{R}$, which would be natural since your integral is invariant under $D\to -D$, your answer would then be $\frac{\pi}{2|D|^3}$.
A: I’ll suggest another method, involving Integration By Parts. Let the integral to be found be denoted by J.   We start by performing an integration by parts of the function $\frac{1}{x^2+D^2}$:
$$I= \int \frac{1}{x^2+D^2} dx=  \frac{x}{x^2+D^2}-\int \left(-\frac{x(2x)}{(x^2+D^2)^2}\right)dx$$ $$=  \frac{x}{x^2+D^2}+2 \int\frac{x^2+D^2-D^2}{(x^2+D^2)^2}dx$$$$=  \frac{x}{x^2+D^2}+2(I-D^2J)$$ so that we have finally, $$J=\frac{1}{2D^2}\left( \frac{x}{x^2+D^2}+I\right)$$ $$J=\frac{1}{2D^2}\left( \frac{x}{x^2+D^2}+\frac 1D \arctan\left(\frac xD\right)\right)$$ which, on putting the limits, gives $\displaystyle \frac{\pi}{2D^3}$.
A: Keep it easy: for any $A>0$
$$ f(A) = \int_{0}^{+\infty}\frac{dx}{x^2+A}\stackrel{x\mapsto z\sqrt{A}}{=} \frac{1}{\sqrt{A}}\int_{0}^{+\infty}\frac{dz}{z^2+1}=\frac{\pi}{2\sqrt{A}}.\tag{1}$$
By differentiating with respect to $A$ we get:
$$ -\frac{\pi}{4 A\sqrt{A}} = -\int_{0}^{+\infty}\frac{dx}{(x^2+A)^2} \tag{2}$$
and by replacing $A$ with $D^2$ we have:
$$ \int_{0}^{+\infty}\frac{dx}{(x^2+D^2)^2} = \color{red}{\frac{\pi}{4 D^3}}.\tag{3}$$
