complex analysis/ integral: $\int_0^\infty \frac{1-\cos x }{x^2}dx$

I have a question about an example in Stein/Shakarchi. Actually there is another thread here on SE Integrating $\int_0^\infty \frac{1-\cos x }{x^2}dx$ via contour integral.

Regarding the integral $$\int_0^\infty \frac{1-\cos x }{x^2}dx$$, I understand the indented semicircle contour, the division into 4 integrals, I also understand it until letting $$R \rightarrow \infty$$ and then applying ML estimation. However afterwards, I can not follow it anymore, where did the integrals of the two horizontal lines go? Do they cancel each other out (if yes, how can I see it?) and why do they write $$f(z)$$ as $$f(z)=\frac{-i z}{z^2} + E(z)$$ ? It would be really kind if someone could explain these last steps to me

• The integral of the two horizontal lines is just $\int_{-\infty}^\infty$, in the limit Oct 4, 2022 at 20:22
• @FShrike: so for those I can use the same estimation as for $\gamma_R$? Oct 4, 2022 at 20:52
• No. You don't want to estimate them. Indeed you want to find their exact limiting value ($\pi$). We make estimates to show that the integral of interest can be found as approximately equal to a closed contour integral, and show that this approximation is 'perfect' in the limit. Oct 4, 2022 at 20:54

Remember the equation $$\int_{-R}^{-\epsilon}+\int_{\gamma_\epsilon^+}+\int_{\epsilon}^R+\int_{\gamma_R^+}=0.$$ The argument shows that the limit of the second term is $$-\pi$$ and the limit of the last term is $$0$$. So, by this equation, the limit of the first and third terms must be $$\pi$$. But the limit of the first and third terms as $$R\to\infty$$ and $$\epsilon\to 0$$ is just an integral over the entire real line. So this shows exactly that the integral $$\int_{-\infty}^\infty$$ is equal to $$\pi$$, as claimed.
The point of writing $$f(z)=\frac{-iz}{z^2}+E(z)$$ is that the length of the contour $$\gamma_\epsilon^+$$ goes to $$0$$ as $$\epsilon\to 0$$. So, as long as $$E(z)$$ is a bounded function near $$0$$, its integral over $$\gamma_\epsilon^+$$ will go to $$0$$ as $$\epsilon\to 0$$. This means that to compute the limit you can replace the complicated function $$f(z)$$ by the much simpler function $$\frac{-iz}{z^2}$$ which you can then just explicitly integrate over $$\gamma_\epsilon^+$$.