Dear all: this time I have the integral $$\int_0^\infty\frac{1-\cos x}{x^2(x^2+1)}\,dx$$and we must try to solve it using complex integration, residues, Cauchy's Theorem and the whole lot. (BTW, does anyone have any idea whether this integral can be solved without complex functions?)
$\underline{\text{What I did}}$: Letting $\,\gamma\,$ be the integration path containing the segments $$\begin{align}(i)&\,\,\text{the real interval} \,[-R\,,\,-\epsilon]\\(ii)&\,\,\text{the "little" half circle} \,\{z\;|\;z=\epsilon e^{i\theta}\,,\,\theta\in [0,\pi]\}\\(iii)&\,\,\text{ the real interval}\,[\epsilon\,,\,R]\\(iv)&\,\,\text{ and the "big" half circle}\,\{z\;|\;z=R e^{i\theta}\,,\,\theta\in [0,\pi]\}\end{align}$$ we take the integral $$I:=\oint_\gamma\frac{1-e^{iz}}{z^2(z^2+1)}\,dz$$
As the only pole of this function within $\,\gamma\,$ is the simple one $\,z=i\,$ (for $\,\epsilon<1
We now pass to evaluate the above integral on each segment of $\,\gamma\,$ described above:$$\text{on}\,(iv)\,\text{it is easy:}\,\left|\frac{1-e^{iz}}{z^2(z^2+1)}\right|\leq\frac{1+e^{-R\cos\theta}}{R^4}\xrightarrow[R\to\infty]{} 0$$
On $\,(i)\,,\,(iii)\,$ together and letting $\,R\to \infty\,$ we get $\,\displaystyle{\int_{-\infty}^\infty\frac{1-\cos x}{x^2(x^2+1)}\,dx}\,$ , which isn't a problem as the integrand function is even.
So here comes the problem: on $\,(ii)\,$ we have:$$z=\epsilon e^{i\theta}\Longrightarrow dz=\epsilon ie^{i\theta}d\theta\,,\,0\leq\theta\leq \pi\,\,\text{but going from left to right, so}$$$$\oint_{z=\epsilon e^{i\theta}}\frac{1-e^{iz}}{z^2(z^2+1)}\,dz=\int_\pi^0\frac{1-e^{i\epsilon e^{i\theta}}}{\epsilon^2e^{2i\theta}\left(\epsilon^2e^{2i\theta}+1\right)}\,\epsilon ie^{i\theta}\,d\theta$$
Now, the only thing I could came up with to evaluate the above integral when $\,\epsilon\to 0\,$ is to get the limit into the integral, getting $$\lim_{\epsilon\to 0}\frac{1-e^{i\epsilon e^{i\theta}}}{\epsilon e^{i\theta}\left(\epsilon^2 e^{2i\theta}+1\right)}=-i\Longrightarrow \int_\pi^0\frac{1-e^{i\epsilon e^{i\theta}}}{\epsilon^2e^{2i\theta}\left(\epsilon^2e^{2i\theta}+1\right)}\,\epsilon ie^{i\theta}\,d\theta\xrightarrow [\epsilon\to 0]{} -\pi$$applying L'Hospital, so the final result is$$\pi\left(\frac{1}{e}-1\right)=I\xrightarrow [R\to\infty\,,\,\epsilon\to 0]{} \int_{-\infty}^\infty\frac{1-\cos x}{x^2(x^2+1)}\,dx-\pi$$from which we get the value of $\,\displaystyle{\frac{\pi}{2e}}\,$ for our integral, which is correct (at least according to Wolframalpha), yet...
How can I justify the introduction of the limit into the integral?? The only way that seems to me possible (if at all) is to substitute $$\epsilon\to\frac{1}{\delta}$$ to get an indefinite integral with upper limit equal to $\,\infty\,$ inj $\,(ii)\,$ above and then use the dominated convergence theorem (or perhaps the monotone one).
My question is two fold: Is the substitution just described what can put me out of my misery in this case? , and: Is it possible to justify the passage of the limit into the integral without making the substitution and, thus, without resourcing to an indefinite integral with infinite upper limit?
Thank you to anyone investing he/his time just to read this question, and of course any ideas, corrections will be deeply appreciated.
$$\int_0^\infty\frac{1-\cos x}{x^2(x^2+1)}\,dx$$
Since
$$\frac{1}{{{x^2}({x^2} + 1)}} = \frac{1}{{{x^2}}} - \frac{1}{{{x^2} + 1}}$$
You have
$$\int_0^\infty {\frac{{1 - \cos x}}{{{x^2}}}} {\mkern 1mu} - \int_0^\infty {\frac{{1 - \cos x}}{{1 + {x^2}}}} dx$$
Now
$$\int_0^\infty {\frac{{1 - \cos x}}{{{x^2}}}} {\mkern 1mu} =- \left. {\frac{{1 - \cos x}}{x}} \right|_0^\infty + \int_0^\infty {\frac{{\sin x}}{x}} {\mkern 1mu} = \int_0^\infty {\frac{{\sin x}}{x}} = \frac{\pi }{2}$$
So maybe now it is easier to tackle $$\int_0^\infty {\frac{{1 - \cos x}}{{1 + {x^2}}}} dx$$ which gives
$$\int_0^\infty {\frac{{1 - \cos x}}{{1 + {x^2}}}} dx = \int_0^\infty {\frac{{dx}}{{1 + {x^2}}}} - \int_0^\infty {\frac{{\cos x}}{{1 + {x^2}}}dx} = \frac{\pi }{2} - \int_0^\infty {\frac{{\cos x}}{{1 + {x^2}}}dx} $$
and thus
$$\int_0^\infty {\frac{{1 - \cos x}}{{{x^2}({x^2} + 1)}}} {\mkern 1mu} dx = \int_0^\infty {\frac{{\cos x}}{{1 + {x^2}}}dx} $$
EDIT
Since the last solution is not very satisfactory, as it has been discussed, I'll supply this solution:
Define
$$F\left( \varphi \right) = \int\limits_0^{ + \infty } {\frac{{\cos \varphi x}}{{1 + {x^2}}}dx} $$
Clearly the integral is absolutely convergent.
Thus, use the Laplace Transform, to obtain:
$$L\left( s \right) = \int\limits_0^{ + \infty } {\frac{s}{{{x^2} + {s^2}}}\frac{1}{{1 + {x^2}}}dx} $$
We evaluate this integral:
$$\frac{s}{{{x^2} + {s^2}}}\frac{1}{{1 + {x^2}}} = \frac{s}{{1 - {s^2}}}\left( {\frac{1}{{1 + {x^2}}} - \frac{1}{{{s^2} + {x^2}}}} \right)$$
$$\eqalign{
& L\left( s \right) = \frac{s}{{1 - {s^2}}}\int\limits_0^{ + \infty } {\left( {\frac{1}{{1 + {x^2}}} - \frac{1}{{{s^2} + {x^2}}}} \right)dx} \cr
& L\left( s \right) = \frac{s}{{1 - {s^2}}}\left( {\frac{\pi }{2} - \int\limits_0^{ + \infty } {\frac{1}{{{s^2} + {x^2}}}dx} } \right) \cr
& L\left( s \right) = \frac{s}{{1 - {s^2}}}\left( {\frac{\pi }{2} - \frac{1}{s}\frac{\pi }{2}} \right) \cr
& L\left( s \right) = \frac{\pi }{2}\frac{s}{{1 - {s^2}}}\frac{{s - 1}}{s} = \frac{\pi }{2}\frac{1}{{1 + s}} \cr} $$
Taking the inverse transform, we arrive at
$$F\left( \varphi \right) = \frac{\pi }{2}{e^{ - \varphi }}$$
This is clearly for $\varphi >0$, thus the evenness of the function forces
$$F\left( \varphi \right) = \frac{\pi }{2}{e^{ - |\varphi| }}$$
and the result follows:
$$F\left( 1 \right) = \int\limits_0^\infty {\frac{{\cos x}}{{1 + {x^2}}}dx} = \frac{\pi }{{2e}}$$