# Using Cauchy's Integral Theorem to evaluate integral?

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.

I wrote this post to make all of the minutia clear. The big picture is more important, though. See Mike's answer for that.

The general idea is this: we can define a holomorphic function whose real part looks just like the desired integrand on the real line, and we have some strong tools for integrating holomorphic functions, so maybe we can use information about this holomorphic function's integral to deduce information about our original integral.

In this case, we see that the real part of $f(z)=\frac{{1}-e^{iz}}{z^2}$ is precisely $\frac{1-\cos{x}}{x^2}$ if $z=x$ is real. That's why we consider $f(z)$. Its real part looks just like the function that we want to integrate. So we note that $$\int_{-\infty}^{\infty} \frac{{1}-e^{iz}}{z^2} \,dz = \int_{-\infty}^\infty \frac{1-(\cos{x}+i\sin{x})}{x^2} \,dx = \int_{-\infty}^{\infty} \frac{1-\cos{x}}{x^2} \,dx + i \int_{-\infty}^{\infty} \frac{-\sin{x}}{x^2} \,dx.$$ So, in particular, we have: $$\Re (\int_{-\infty}^{\infty} f(z) \,dz) = \int_{-\infty}^{\infty} \Re(f(z)) \,dz = \int_{-\infty}^{\infty} \frac{1-\cos{x}}{x^2} \,dx =2\int_{0}^{\infty} \frac{1-\cos{x}}{x^2} \,dx .$$ This means that if we can just figure out what $\int_{-\infty}^{\infty} f(z)$ is, then we can just take its real part, and that must be twice the integral you want to evaluate.

To figure out what $\int_{-\infty}^{\infty} f(z)$ is, we'd like to use the strength of Cauchy's theorem. Cauchy's theorem says that if we integrate over the given igloo, we've got to get zero, no matter what $R$ and $\epsilon$ are. We choose the igloo because we have to avoid the "problem" point at 0, where $f$ isn't holomorphic, and because we need a closed loop for Cauchy. We'll recover the integral on the real line from $-\infty$ to $\infty$ as we let $R$ get huge and $\epsilon$ get small.

As you note, from Cauchy's theorem, we get: $$\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.$$ Rearranging, this means that $$\int_{-R}^{-\epsilon}\frac{1-e^{ix}}{x^2}dx + \int_{\epsilon}^R\frac{1-e^{ix}}{x^2}dx = - \int_{\gamma_{\epsilon}^+}\frac{1-e^{iz}}{z^2}dz - \int_{\gamma_R^+}\frac{1-e^{iz}}{z^2}dz. \quad\quad (*)$$ Now, as we let $R$ and $\epsilon$ do their thing, the left side of this equation is going to tend to $\int_{-\infty}^{\infty} f(z) dz$. So we just need to figure out what the right side is doing. To do this, we'll consider what happens as we vary our diagram, taking $R$ to be really big first and then taking $\epsilon$ to be small. Since the above equalities didn't depend on our choices of $R$ and $\epsilon$, varying the diagram with big $R$ or small $\epsilon$ won't cause any problems.

As $R$ runs off to infinity, we have: $$\left|\int_{\gamma_R^+}\frac{1-e^{iz}}{z^2}dz\right| \le \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} = \frac{2\pi}{R} \rightarrow 0,$$ so the $\int_{\gamma_R^+}\frac{1-e^{iz}}{z^2}$ term on the right hand side of $(*)$ goes to zero in the limit. So, letting $R$ go to infinity in $(*)$, we get $$\int_{-\infty}^{-\epsilon}\frac{1-e^{ix}}{x^2}dx + \int_{\epsilon}^\infty\frac{1-e^{ix}}{x^2}dx = - \int_{\gamma_{\epsilon}^+}\frac{1-e^{iz}}{z^2}dz, \quad\quad\quad (**)$$ which is just a rephrasing of the equality you asked about.

And now we just need to know what happens to the right side of this equation as $\epsilon$ gets small.

For this, we'll see what happens if we just take the power series representation for the $e^{iz}$ term in $f$ about zero. We have: $$f(z) = \frac{1-e^{iz}}{z^2} = \frac{1 - \sum_{n=0}^\infty\frac{(iz)^n}{n!}}{z^2} = -\frac{\sum_{n=1}^\infty \frac{(iz)^n}{n!}}{z^2} = -\frac{iz}{z^2} +\sum_{n=2}^\infty \frac{(iz)^{n-2}}{n!}.$$

Let $E(z) = \sum_{n=2}^\infty \frac{(iz)^{n-2}}{n!}$ (the second term on the right hand side above). Notice that if $\epsilon<1$, then on $\gamma_{\epsilon^+}$, we have $$|E(z)| \le \sum_{n=2}^\infty \frac{|iz|^{n-2}}{n!} \le \sum_{n=2}^\infty \frac{1}{n!} \le e,$$ so $E(z)$ stays bounded as $\epsilon$ shrinks, and we see that if $\epsilon<1$, $$\left| \int_{\gamma_{\epsilon^+}} E(z) dz\right| \le \int_{\gamma_{\epsilon^+}} |E(z)| |dz| \le \int_{\gamma_{\epsilon^+}} e |dz| = \pi \epsilon e \rightarrow 0 \text{ as }\epsilon \rightarrow 0.$$

Thus, \begin{align*}\lim_{\epsilon \rightarrow 0^+} \int_{\gamma_{\epsilon^+}} f(z) dz &= \lim_{\epsilon \rightarrow 0^+} \int_{\gamma_{\epsilon^+}} -\frac{iz}{z^2} dz + \lim_{\epsilon \rightarrow 0^+} \int_{\gamma_{\epsilon^+}} E(z) dz\\ &= \lim_{\epsilon \rightarrow 0^+} \int_{\gamma_{\epsilon^+}} - \frac{i}{z} dz + 0\\ &= \lim_{\epsilon \rightarrow 0^+} -i \int_\pi^0 i dz\\ &= -\pi.\end{align*}

Combining with $(**)$ and letting $\epsilon$ go to zero, we finally have: $$\int_{-\infty}^\infty f(z) dz = \pi.$$ Taking the real parts of both sides gives $$\int_{-\infty}^\infty \Re f(z) dz = 2 \int_0^\infty \frac{1-\cos{x}}{x^2} dx = \Re\pi = \pi.$$

So $\int_0^\infty \frac{1-\cos{x}}{x^2} dx = \frac {\pi}{2}$.

• Thanks so much, great, great post! Just a little small thing I want to clarify: In the equation directly above (**), how do these inequalities come about?: $\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}$ – Ryan Yu Sep 14 '14 at 22:47
• In particular, I understand how $|1-e^{iz}| < 2$ (numerator), but how does $|z^2| < R^2$ (denominator)? Am I missing something obvious? Furthermore, how does $\int_{\gamma_R^+} \frac{2}{R^2} dz = \pi R \frac{2}{R^2}$? Isn't $\gamma_R^+$ the integral from 0 to $\pi$, and thus shouldn't the result be $\frac{2\pi}{R^2}$ instead of $\frac{2\pi}{R}$? – Ryan Yu Sep 14 '14 at 22:49
• In the denominator $|z^2| = R^2$ as long as we stay on $\gamma_{R^+}$, because $z \in \gamma_{R^+}$ implies $|z|= R$. And 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 0:01
• That said, the actual value of $\int_{\gamma_{R^+}} \frac{2}{R^2}$ is $-\frac{4}{R}$. Integrating over $\gamma_{R^+}$ isn't the same as just integrating from $0$ to $\pi$. One way to see this is to just parametrize, and you'll see that $dz = iRe^{i\theta} d\theta$. But, since we're talking about Cauchy stuff, another way to see it is to note that $\int_{-R}^R \frac{2}{R^2} dz + \int_{\gamma_{R^+}} \frac{2}{R^2} dz = 0$ by Cauchy, so $\int_{\gamma_{R^+}} \frac{2}{R^2} dz = -\int_{-R}^R \frac{2}{R^2} dz = -\frac{4}{R}$. :) – Josh Keneda Sep 15 '14 at 0:10
• Cool, thanks so much! One more thing, if you don't mind... in this: – Ryan Yu Sep 15 '14 at 0:13

• Thanks. A followup: how are we able to directly translate the function from $\frac{1-\cos{x}}{x^2}$ to $\frac{1-e^{iz}}{z^2}$? I'm not quite seeing the algebra in motion here... – Ryan Yu Sep 14 '14 at 21:35