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

complex-analysiscontour-integration

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.

enter image description here

enter image description here

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

Best Answer

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^+$.