Integrating $\int_{0}^{\infty}\frac{\cos(x)}{(1+x^2)^2}dx$ without the residue theorem? Consider the integral
$$\int_{0}^{\infty}\frac{\cos(x)}{(1+x^2)^2}dx$$
Are there any other ways to compute this integral besides using the residue theorem?
Edit: Thank you all, kind people, for the answers. I had this on an exam and solved it with the residue theorem and was just wondering what other ways are possible and which of those do not involve complex integration.
 A: Let us define integral with parameter:
\begin{align}
I(t) = \int_0 ^\infty \frac{\cos(xt)}{(1+x^2)^2}dt.
\end{align}
Taking the derivative of I:
\begin{align}
\frac{dI}{dt} = \frac{d}{dt}  \int_0 ^\infty \frac{\cos(xt)}{(1+x^2)^2}dt
=\int_0 ^\infty \frac{\partial}{\partial t} \frac{\cos(xt)}{(1+x^2)^2}dt= - \int_0^\infty \frac{x\sin(xt)}{(1+x^2)^2}dt.
\end{align}
Taking the second derivative:
\begin{align}
\frac{d^2I}{dt^2} = -\int_0^\infty \frac{x^2\cos(xt)}{(1+x^2)^2}dt =
 -\int_0^\infty \frac{(1+x^2-1)\cos(xt)}{(1+x^2)^2}dt = 
 -\int_0^\infty \frac{\cos(xt)}{(1+x^2)}dt + \int_0^\infty \frac{\cos(xt)}{(1+x^2)^2}dt
\end{align}
From here we get:
\begin{align}
I’’(t) = -\int_0^\infty \frac{\cos(tx)}{1+x^2} dt + I(t)
\end{align}
It is well known that(you can derive it similar to this metdod):
\begin{equation}
\int_0^\infty \frac{\cos(tx)}{1+x^2} dt = \frac{\pi}{2} e^{-t}
\end{equation}
So we get differential equation:
\begin{align}
I’’(t) - I(t) = -\frac{\pi}{2} e^{-t}
\end{align}
Th general solution is of the form is:
\begin{equation}
I(t) = Ae^{-t} + Be^{t}
\end{equation}
And paticular solution will be of the form $I(t) = Cte^{-t}$ and the we calculate $I’’(t) - I(t)$ to get $C = \frac{\pi}{4}$.
So final form is :
\begin{align}
I(t) = Ae^{-t} + Be^t + \frac{\pi}{4}e^{-t} t
\end{align}
To get $A$ and $B$ we calculate $I(0)$ and $I’(0)$:
\begin{align}
I(0) = \int_0^\infty \frac{1}{(1+x^2)^2} dt
\end{align}
U-sub: $u=\tan{\theta}, du = \frac{1}{\cos^2{\theta}} d\theta$
We get:
\begin{equation}
\int_0^{\frac{\pi}{2}} \frac{1}{(1+\tan^2{\theta})^2} \frac{1}{\cos^2(\theta)} dt = \int_0^{\frac{\pi}{2}} \cos^2(\theta) d\theta = \frac{\pi}{4}
\end{equation}
It is obvious that $I’(0) = 0$. After pluging in $I(t)$ and calculating $A$ and $B$ we get:
\begin{equation}
I(t) = \frac{\pi}{4}(xe^{-x} + e^{-x}).
\end{equation}
Our answer is : $I(1) = \frac{\pi}{4}(2e^{-1}) = \frac{\pi}{2e}.$
A: Let $\displaystyle f(\lambda) = \int_{0}^{\infty}\frac{\cos(\lambda x)}{(1+x^2)^2}\;{ \mathrm dx}$. Consider the Laplace transform of $f(\lambda)$.
$$\begin{aligned}\mathcal{L}(f(\lambda)) & = \int_{0}^{\infty}\int_{0}^{\infty}\frac{\cos(\lambda x)}{(1+x^2)^2}e^{-\lambda s}\;{\mathrm d\lambda }\;{\mathrm dx} \\&= \int_{0}^{\infty}\frac{s}{(1+x^2)^2(s^2+x^2)}\;{\mathrm dx} \\& = \frac{\pi(2+s)}{4(1+s)^2}.\end{aligned} $$
Thus $ \displaystyle f(\lambda ) =\mathcal{L}^{-1}\left(\frac{\pi(2+s)}{4(1+s)^2}\right) =\frac{\pi}{4}e^{-\lambda}(1+\lambda)$.
The value of the integral is $\displaystyle I = f(1) = \frac{\pi}{2e}. $



Let $\displaystyle I(\lambda) = \int_0^{\infty} \frac{\cos( x)}{\lambda^2+x^2}$. Let $x \mapsto \lambda x$ then
$\displaystyle I(\lambda) = \int_0^{\infty} \frac{\cos( \lambda x)}{\lambda^2+\lambda^2x^2} \, \mathrm d \lambda x = \frac{1}{\lambda}\int_0^{\infty} \frac{\cos( \lambda x)}{1+x^2} \, \mathrm d x = \frac{\pi}{2\lambda e^{-\lambda}}  $.
Differentiating both sides
$\displaystyle I'(\lambda) = -\int_0^{\infty} \frac{2 \lambda \cos( x)}{(\lambda^2+x^2)^2} \, \mathrm d \lambda =  -\frac{(\lambda +1) \pi}{2 \lambda e ^{\lambda}}.  $
This gives
$\displaystyle \int_0^{\infty} \frac{\cos( x)}{(\lambda^2+x^2)^2} \, \mathrm d \lambda =  \frac{ \pi (\lambda+1)}{4\lambda^3 e ^{\lambda}} $
With $\lambda = 1$ this gives $\displaystyle I = \frac{\pi}{2 e}.$
A: Writing
$$\frac 1{(x^2+1)^2}=\frac{2}{(i+1)^3 (x+i)}+\frac{1}{(i+1)^2 (x+i)^2}-\frac{2}{(i+1)^3
   (x-i)}+\frac{1}{(i+1)^2 (x-i)^2}$$ you face two types and integral
$$I_k=\int \frac {\cos(x)}{x+ik}\,dx \qquad \text{and} \qquad J_k=\int \frac {\cos(x)}{(x+ik)^2}\,dx $$ where $k=\pm 1$.
Make $x+ik=y$ and expand the cosine
$$\cos(y-ik)=\cosh (k) \cos (y)-i \sinh (k) \sin (y)$$ So, now, we have four kinds of integrals
$$\int \frac {\sin(y)}y \,dy \qquad \int \frac {\cos(y)}y \,dy \qquad \int \frac {\sin(y)}{y^2} \,dy \qquad \int \frac {\cos(y)}{y^2} \,dy$$ The first and second leads to the sine and cosine integrals; for the the third and the fourth use one integration by parts.
Go back to $x$, use the bounds and simplify all complex numbers.
