I'm going through Stein's Complex Analysis, and I'm a bit confused at one of the classical examples of using Cauchy's theorem to evaluate an integral. The example is:
$$\int_0^{\infty}\frac{1-\cos{x}}{x^2}dx = \frac{\pi}{2}$$
The book says (and I'll add my thoughts & questions in bold as they come up):
Here we consider the function $f(z) = (1 - e^{iz})/z^2$, and we integrate over the indented semicircle in the upper half-plane positioned on the $x$-axis, as shown in the figure below:

Why precisely do we consider the function $f(z) = (1-e^{iz})/z^2$? I get that $e^{ix} = \cos{x} + i\sin{x}$ and $\cos{z} = (e^{iz}-e^{iz})/2$, but how precisely do we get $f(z) = (1 - e^{iz})/z^2$ from this?
Why precisely are we integrating over the indented semicircle in the upper half-plane positioned on the $x$-axis? As a follow-up, are we creating a hole around 0 because the integral cannot be evaluated at x = 0?
[back to book]
If we denote $\gamma_{\epsilon}^+$ and $\gamma_R^+$ the semicircles of radii $\epsilon$ and $R$ with negative and positive orientations respectively, Cauchy's theorem gives:
$$\int_{-R}^{-\epsilon}\frac{1-e^{ix}}{x^2}dx + \int_{\gamma_{\epsilon}^+}\frac{1-e^{iz}}{z^2}dz + \int_{\epsilon}^R\frac{1-e^{ix}}{x^2}dx + \int_{\gamma_R^+}\frac{1-e^{iz}}{z^2}dz = 0$$
First we let $R \rightarrow \infty$ and observe that:
$$\mid\frac{1-e^{iz}}{z^2}\mid \ \leq \ \frac{2}{\mid z\mid^2}$$
so the integral over $\gamma_R^+$ goes to 0. Therefore:
$$\int_{\mid x \mid \geq \epsilon}\frac{1-e^{ix}}{x^2}dx = -\int_{\gamma_{\epsilon}^+}\frac{1-e^{iz}}{z^2}dz$$
Why does letting $R \rightarrow \infty$ lead to the above inequality? What does $R \rightarrow \infty$ mean in the scope of the diagram, and why does the integral over $\gamma_R^+$ go to zero? Not really sure how the last equality is formulated as well...
[back to book]
Next, note that:
$$f(z) = \frac{iz}{z^2} + E(z)$$
where $E(z)$ is bounded as $z \rightarrow 0$, while on $\gamma_{\epsilon}^+$ we have $z = \epsilon e^{i\theta}$ and $dz = i\epsilon e^{i \theta}d\theta$. Thus,
$$\int_{\gamma_{\epsilon}^+}\frac{1 - e^{iz}}{z^2}dz \rightarrow \int_{\pi}{0}(-ii)d\theta = -\pi$$ as $\epsilon \rightarrow 0$. Taking real parts then yields:
$$\int_{-\infty}^{\infty}\frac{1-\cos{x}}{x^2}dx = \pi$$
Since the integrand is even, the desired formula is proved.
I don't quite follow the first part of this, but I think more importantly, how does solving all of this help us solve the original integral? What exactly am I taking the "real parts" of?
Sorry, I know it's a lot, but any sort of walkthrough would be appreciated.
$\int_{\gamma_R^+} \left|\frac{1-e^{iz}}{z^2}\right|dz \le \int_{\gamma_R^+} \frac{2}{R^2} dz = \pi R \frac{2}{R^2}$
– r123454321 Sep 14 '14 at 22:47And you're right that we shouldn't have that second equality. I meant to have a $\le$ sign there, and that comes from the fact that we're integrating a positive constant over a curve of length $\pi R$, so we'll get something less than or equal to that constant times the length of the curve. I've corrected it in the original post. Thanks!
– Josh Keneda Sep 15 '14 at 00:01How is that worked out? Not seeing where the $z$ in the denominator went, or how the integrand became $idz$!
– r123454321 Sep 15 '14 at 00:18