How solve $\int_{0}^{\infty} \dfrac{1-\cos x}{x^{2}} dx$ What is the value of the following integral? $$\int_{0}^{\infty} \dfrac{1-\cos x}{x^{2}} dx$$ 
 A: If you are aware of the rather well-known identity:
$$ \forall \alpha>0,\qquad I(\alpha)=\lim_{N\to +\infty}\int_{0}^{N}\frac{\sin(\alpha x)}{x}\,dx = \frac{\pi}{2} \tag{1}$$
it is straightforward to check that:
$$ J=\int_{0}^{+\infty}\frac{1-\cos(x)}{x^2}\,dx = \int_{0}^{1}I(\alpha)\,d\alpha = \color{red}{\frac{\pi}{2}}.\tag{2} $$
You may also use integration by parts to check that $J=I(1)$.
A: With the usual contour $\;C_{\epsilon,R}\;$ with a little "bump" around zero (canonical semicircle of radius $\;\epsilon\;$ and around the upper canonical semicircle of radius $\;R,\,\, R>>\epsilon\;$, and with the function
$$f(z)=\frac{1-e^{iz}}{z^2}\implies \text{Res}_{z=0}\,(f)= \lim_{z\to0} z\,f(z)=-ie^{i\cdot0}=-i$$implies
$$0=\lim_{\epsilon\to0,\,R\to\infty}\oint_{C_{\epsilon,R}}\,f(z)dz=\int_{-\infty}^\infty f(x)\,dx-\pi i(-i)\implies\int_0^\infty\frac{1-\cos x}{x^2}=\frac\pi2$$
by comparing real parts and noticing our function is even (and thus dividing by two)
A: Solution for lazy people. A special case of Ramanujan's master theorem was obtained by Glaisher in the late 19th century using non-rigorous methods. It says that if
$$f(x) = \sum_{k=0}^\infty (-1)^ka_k x^{2k}$$
then:
$$\int_0^\infty f(x) \, dx = \frac{\pi}{2} a_{-\frac{1}{2}}$$
if the integral here converges. Here one assumes a natural extrapolation of the series expansion coefficients that in the rigorous proof is made unambiguous. When this involves factorials, the prescription is to use the analytic continuation given by gamma functions. In this case, we have:
$$\frac{1-\cos(x)}{x^2} = \sum_{k=0}^\infty (-1)^k \frac{x^{2k}}{(2k+2)!}$$
therefore $a_{-\frac{1}{2}} = 1$ and the integral is thus equal to $\frac{\pi}{2}$.
A: You could get the answer via integration by parts for:
$$\int_0^\infty\frac{\cos(x)}{x^2} \, dx$$
via the below for suitably chosen $u(x)$ and $v(x)$;
$$\int_0^\infty v \, du = uv - \int_0^\infty u \, dv$$
Hence;
$$\int_0^\infty \frac{\cos(x)}{x^2} \,dx= -\left[\cos(x) \left(\frac{-1}{x} \right) \right]_0^\infty - \int_0^\infty \frac{\sin(x)}{x}dx$$
Following Michael Hardy's comment;
$$\int_0^\infty \frac{-\sin(x)}{x} \, dx= -\left[\cos(x) \left( \frac{-1}{x} \right) \right]_0^\infty - \int_0^\infty \frac{-\cos(x)}{x^2}dx$$
We can now substitute this into the previous equation to find $\int_0^\infty \frac{\cos(x)}{x^2} \, dx$ in terms of $\cos(x)$ and $x$
For $\int_0^\infty \frac{1}{x^2} \, dx$, this is $\left[\dfrac{-1}{x}\right]_0^\infty$.
