The question is $$\int_0^\infty \frac{1-\cos x}{x^2} \, dx$$
My approach was as follows. I converted the integral into a a complex integral.$\int_0^\infty \frac{1-\cos z}{z^2} \, dx$ $$\int_0^\infty \frac{\sin^2(z/2)}{z^2} \, dz$$
$$\implies \int_0^\infty \frac{\exp(iz)}{z^2}\,dz $$
And found out the residue of the function $\frac{\exp(iz)}{z^2}$ at $z = 0$. It comes out to be $\operatorname{res}(f(z),0) = i$
Hence Answer = $\pi i \operatorname{res}(f(z),0) $
As i have to take the imaginary part I get the final answer as 0.
Am i right in doing this ?
Matlab suggests the answer to be $\pi /2$