# Integration of $\int_0^\infty\frac{1-\cos x}{x^2(x^2+1)}\,dx$ by means of complex analysis

Dear all: this time I have the integral $$\int_0^\infty\frac{1-\cos x}{x^2(x^2+1)}\,dx$$and we must try to solve it using complex integration, residues, Cauchy's Theorem and the whole lot. (BTW, does anyone have any idea whether this integral can be solved without complex functions?)

$\underline{\text{What I did}}$: Letting $\,\gamma\,$ be the integration path containing the segments \begin{align}(i)&\,\,\text{the real interval} \,[-R\,,\,-\epsilon]\\(ii)&\,\,\text{the "little" half circle} \,\{z\;|\;z=\epsilon e^{i\theta}\,,\,\theta\in [0,\pi]\}\\(iii)&\,\,\text{ the real interval}\,[\epsilon\,,\,R]\\(iv)&\,\,\text{ and the "big" half circle}\,\{z\;|\;z=R e^{i\theta}\,,\,\theta\in [0,\pi]\}\end{align} we take the integral $$I:=\oint_\gamma\frac{1-e^{iz}}{z^2(z^2+1)}\,dz$$ As the only pole of this function within $\,\gamma\,$ is the simple one $\,z=i\,$ (for $\,\epsilon<1<R\,$, say), and $$\,\operatorname{Res}_{z=i}\left(\frac{1-e^{iz}}{z^2(z^2+1)}\right)=\lim_{z\to i}\frac{1-e^{iz}}{z^2(z+i)}=\frac{e^{-1}-1}{2i}$$We get from the Cauchy's residue theorem $$\displaystyle{I=2\pi i\,\frac{e^{-1}-1}{2i}=\pi\left(\frac{1}{e}-1\right)}$$

We now pass to evaluate the above integral on each segment of $\,\gamma\,$ described above:$$\text{on}\,(iv)\,\text{it is easy:}\,\left|\frac{1-e^{iz}}{z^2(z^2+1)}\right|\leq\frac{1+e^{-R\cos\theta}}{R^4}\xrightarrow[R\to\infty]{} 0$$

On $\,(i)\,,\,(iii)\,$ together and letting $\,R\to \infty\,$ we get $\,\displaystyle{\int_{-\infty}^\infty\frac{1-\cos x}{x^2(x^2+1)}\,dx}\,$ , which isn't a problem as the integrand function is even.

So here comes the problem: on $\,(ii)\,$ we have:$$z=\epsilon e^{i\theta}\Longrightarrow dz=\epsilon ie^{i\theta}d\theta\,,\,0\leq\theta\leq \pi\,\,\text{but going from left to right, so}$$$$\oint_{z=\epsilon e^{i\theta}}\frac{1-e^{iz}}{z^2(z^2+1)}\,dz=\int_\pi^0\frac{1-e^{i\epsilon e^{i\theta}}}{\epsilon^2e^{2i\theta}\left(\epsilon^2e^{2i\theta}+1\right)}\,\epsilon ie^{i\theta}\,d\theta$$

Now, the only thing I could came up with to evaluate the above integral when $\,\epsilon\to 0\,$ is to get the limit into the integral, getting $$\lim_{\epsilon\to 0}\frac{1-e^{i\epsilon e^{i\theta}}}{\epsilon e^{i\theta}\left(\epsilon^2 e^{2i\theta}+1\right)}=-i\Longrightarrow \int_\pi^0\frac{1-e^{i\epsilon e^{i\theta}}}{\epsilon^2e^{2i\theta}\left(\epsilon^2e^{2i\theta}+1\right)}\,\epsilon ie^{i\theta}\,d\theta\xrightarrow [\epsilon\to 0]{} -\pi$$applying L'Hospital, so the final result is$$\pi\left(\frac{1}{e}-1\right)=I\xrightarrow [R\to\infty\,,\,\epsilon\to 0]{} \int_{-\infty}^\infty\frac{1-\cos x}{x^2(x^2+1)}\,dx-\pi$$from which we get the value of $\,\displaystyle{\frac{\pi}{2e}}\,$ for our integral, which is correct (at least according to Wolframalpha), yet...

How can I justify the introduction of the limit into the integral?? The only way that seems to me possible (if at all) is to substitute $$\epsilon\to\frac{1}{\delta}$$ to get an indefinite integral with upper limit equal to $\,\infty\,$ inj $\,(ii)\,$ above and then use the dominated convergence theorem (or perhaps the monotone one).

My question is two fold: Is the substitution just described what can put me out of my misery in this case? , and: Is it possible to justify the passage of the limit into the integral without making the substitution and, thus, without resourcing to an indefinite integral with infinite upper limit?

Thank you to anyone investing he/his time just to read this question, and of course any ideas, corrections will be deeply appreciated.

• Integrand has a removable singularity in $z=0$, so letting $$f(z) = \begin{cases} \frac{1 - \cos z}{z^2 (1+z^2)} & z \neq 0 \\ \frac{1}{2} & z =0 \end{cases}$$ you don't have to consider upper small circle. – qoqosz Jun 18 '12 at 21:40

## 7 Answers

$$\int_0^\infty\frac{1-\cos x}{x^2(x^2+1)}\,dx$$

Since

$$\frac{1}{{{x^2}({x^2} + 1)}} = \frac{1}{{{x^2}}} - \frac{1}{{{x^2} + 1}}$$

You have

$$\int_0^\infty {\frac{{1 - \cos x}}{{{x^2}}}} {\mkern 1mu} - \int_0^\infty {\frac{{1 - \cos x}}{{1 + {x^2}}}} dx$$

Now

$$\int_0^\infty {\frac{{1 - \cos x}}{{{x^2}}}} {\mkern 1mu} =- \left. {\frac{{1 - \cos x}}{x}} \right|_0^\infty + \int_0^\infty {\frac{{\sin x}}{x}} {\mkern 1mu} = \int_0^\infty {\frac{{\sin x}}{x}} = \frac{\pi }{2}$$

So maybe now it is easier to tackle $$\int_0^\infty {\frac{{1 - \cos x}}{{1 + {x^2}}}} dx$$ which gives

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

and thus

$$\int_0^\infty {\frac{{1 - \cos x}}{{{x^2}({x^2} + 1)}}} {\mkern 1mu} dx = \int_0^\infty {\frac{{\cos x}}{{1 + {x^2}}}dx}$$

EDIT

Since the last solution is not very satisfactory, as it has been discussed, I'll supply this solution:

Define

$$F\left( \varphi \right) = \int\limits_0^{ + \infty } {\frac{{\cos \varphi x}}{{1 + {x^2}}}dx}$$

Clearly the integral is absolutely convergent.

Thus, use the Laplace Transform, to obtain:

$$L\left( s \right) = \int\limits_0^{ + \infty } {\frac{s}{{{x^2} + {s^2}}}\frac{1}{{1 + {x^2}}}dx}$$

We evaluate this integral:

$$\frac{s}{{{x^2} + {s^2}}}\frac{1}{{1 + {x^2}}} = \frac{s}{{1 - {s^2}}}\left( {\frac{1}{{1 + {x^2}}} - \frac{1}{{{s^2} + {x^2}}}} \right)$$

\eqalign{ & L\left( s \right) = \frac{s}{{1 - {s^2}}}\int\limits_0^{ + \infty } {\left( {\frac{1}{{1 + {x^2}}} - \frac{1}{{{s^2} + {x^2}}}} \right)dx} \cr & L\left( s \right) = \frac{s}{{1 - {s^2}}}\left( {\frac{\pi }{2} - \int\limits_0^{ + \infty } {\frac{1}{{{s^2} + {x^2}}}dx} } \right) \cr & L\left( s \right) = \frac{s}{{1 - {s^2}}}\left( {\frac{\pi }{2} - \frac{1}{s}\frac{\pi }{2}} \right) \cr & L\left( s \right) = \frac{\pi }{2}\frac{s}{{1 - {s^2}}}\frac{{s - 1}}{s} = \frac{\pi }{2}\frac{1}{{1 + s}} \cr}

Taking the inverse transform, we arrive at

$$F\left( \varphi \right) = \frac{\pi }{2}{e^{ - \varphi }}$$

This is clearly for $\varphi >0$, thus the evenness of the function forces

$$F\left( \varphi \right) = \frac{\pi }{2}{e^{ - |\varphi| }}$$

and the result follows:

$$F\left( 1 \right) = \int\limits_0^\infty {\frac{{\cos x}}{{1 + {x^2}}}dx} = \frac{\pi }{{2e}}$$

• $\frac{\pi}{2}$ cancels each other. – qoqosz Jun 18 '12 at 21:13
• @qoqosz Whoops, thanks! – Pedro Tamaroff Jun 18 '12 at 21:14
• @Peter Tamaroff: can you solve it entirely for me? (if you're willing) I'd like to see your way. – user 1357113 Jun 18 '12 at 21:27
• $\displaystyle\mathrm{PV}\int_{-\infty}^\infty\cos(x)\,\mathrm{d}x=\lim_{L\to\infty}\int_{-L}^L\cos(x)\,\mathrm{d}x=\lim_{L\to\infty}2\sin(L)$ which doesn't exist. – robjohn Jun 18 '12 at 23:06
• It is true that $$\int_{-\infty}^\infty\frac{\cos(\varphi x)}{1+x^2}\mathrm{d}x=\pi e^{-|\varphi|}$$ However, $\displaystyle F''(\varphi)=-\int_{-\infty}^\infty\frac{x^2\cos(\varphi x)}{1+x^2}\mathrm{d}x$ (the negative of what appears above). – robjohn Jun 19 '12 at 5:36

Since the integrand is even, we get \begin{align} \int_0^\infty\frac{1-\cos(x)}{x^2(x^2+1)}\,\mathrm{d}x &=\frac12\int_{-\infty}^\infty\frac{1-\cos(z)}{z^2(z^2+1)}\,\mathrm{d}z\tag{1} \end{align} Since $\lim\limits_{z\to0}\frac{1-\cos(z)}{z^2}=\frac12$, the singularity of the integrand near $z=0$ is removable. Therefore, since the integrand vanishes for $z$ within $\frac12$ of the real axis as $|z|\to\infty$ and there are no singularities within $\frac12$ of the real axis, the integral in $(1)$ does not change when shifting the path of integration from $z=t$ to $z=t-\frac{i}{2}$.

Now we can break up the integral as $$\frac14\int_{\gamma^+}\frac{1-e^{iz}}{z^2(z^2+1)}\mathrm{d}z +\frac14\int_{\gamma^-}\frac{1-e^{-iz}}{z^2(z^2+1)}\mathrm{d}z\tag{2}$$ where $\gamma^+$ and $\gamma^-$ are as depicted below:

$\hspace{4.6cm}$ $\gamma^+$ circles two singularities ($z=0$ and $z=i$) clockwise, and $\gamma^-$ circles one singularity ($z=-i$) counter-clockwise.

All of the singularities are simple, so to get the residue at $z=z_0$, we just need to multiply by $z-z_0$ and taking $\displaystyle\lim_{z\to z_0}$

At $z=0$ the residue of $\displaystyle\frac{1-e^{iz}}{z^2(z^2+1)}$ is $-i$

At $z=i$ the residue of $\displaystyle\frac{1-e^{iz}}{z^2(z^2+1)}$ is $\displaystyle\frac{1-e^{-1}}{-2i}$

At $z=-i$ the residue of $\displaystyle\frac{1-e^{-iz}}{z^2(z^2+1)}$ is $\displaystyle\frac{1-e^{-1}}{2i}$

Putting these together with $(2)$ yields \begin{align} \frac12\int_{-\infty}^\infty\frac{1-\cos(z)}{z^2(z^2+1)}\,\mathrm{d}z &=\frac{2\pi i}{4}\left(-i+\frac{1-e^{-1}}{-2i}\right)-\frac{2\pi i}{4}\left(\frac{1-e^{-1}}{2i}\right)\\ &=\frac{\pi}{2}\left(1-\frac{1-e^{-1}}{2}-\frac{1-e^{-1}}{2}\right)\\ &=\frac{\pi}{2e} \end{align}

• Thanks @Rob. Nevertheless, and after the singularity at zero has been removed, I think it's way easier to take only the upper half circle that you denoted $\,\gamma^+\,$ and let its radius tend to infinity. That way we also save one residue's calculation (see my comment to Peter's answer above). +1 – DonAntonio Jun 19 '12 at 14:31
• @DonAntonio: Your suggestion doesn't work because $\cos(z)$ blows up as $|\mathrm{Im}(z)|\to\infty$. Thus, the integral around either half circle blows up as the radius increases. This is why I separated $\cos(z)$ into exponentials and integrated one around the upper half plane and the other around the lower half plane. – robjohn Jun 19 '12 at 16:19
• I'm not sure I follow, as I didn't use $\,\cos z\,$ but actually $\,1-e^{iz}\,$ in the numerator, and so did you, though you also used $\,\cos z\,$. Anyway, I can't see how taking the whole circle instead of only half of it would solve the problem you mention as in passing to the limit on the real axis and being $\,\cos x\,$ and odd function we'd have the same proble, wouldn't we? Please do correct me if I'm wrong – DonAntonio Jun 19 '12 at 16:41
• @DonAntonio: I was commenting on this comment. However, I see that we have switched to the original question. With $$\int_{-\infty}^\infty\frac{1-e^{iz}}{z^2(1+z^2)}\,\mathrm{d}z$$ a singularity at $z=0$ (on the path of integration) is introduced, and must be handled. Furthermore, since none of the singularities has residue zero and none of the residues cancel, I don't see that we can leave any of them out. – robjohn Jun 19 '12 at 17:13

An easy way:

Consider $$I(a)=\int_0^\infty\frac{1-\cos ax}{x^2(x^2+1)}\,dx ;a\geqslant 0$$ Next:

$$\frac{dI}{da}= \int_0^\infty\frac{\sin ax}{x}\frac{dx}{x^2+1}$$

$$\frac{d^2I}{da^2}=\int_0^\infty\frac{\cos ax}{x^2+1}\,dx=\frac{\pi e^{-a}}{2}$$

Thus

$$\frac{dI}{da}=-\frac{\pi e^{-a}}{2}+\frac{\pi}{2}$$ because of $\frac{dI(0)}{da}=0$

$$I(a)= \frac{\pi e^{-a}}{2}+\frac{\pi a}{2}-\frac{\pi}{2}$$ because of $I(0)=0$

Finally, original integral:

$$I=I(1)=\frac{\pi e^{-1}}{2}$$

• Very nice @Martin, thanks. This in fact is Feynman's way. +1 – DonAntonio Jun 19 '12 at 14:27

HINT: I think that this integral would work great by using Feynman way. Your integral is very similar to one you may find in this document, namely the last page, the last integral where the author offers a set of problems to solve by using this way:

http://ocw.mit.edu/courses/mathematics/18-304-undergraduate-seminar-in-discrete-mathematics-spring-2006/projects/integratnfeynman.pdf

• @Valentin See my answer along with qoqosz's remarks in the comments. – Pedro Tamaroff Jun 18 '12 at 22:33

Maple gets this anti-derivative: $$\int \frac{1 - \operatorname{cos} (x)}{x^{2} \bigl(x^{2} + 1\bigr)} d x = -\operatorname{arctan} (x) - \frac{1}{x} - \frac{\operatorname{Si} (x - i) \operatorname{sinh} (1)}{2} - \frac{i}{2} \operatorname{Ci} (x - i) \operatorname{cosh} (1) - \frac{\operatorname{Si} (x + i) \operatorname{sinh} (1)}{2} + \frac{i}{2} \operatorname{Ci} (x + i) \operatorname{cosh} (1) + \frac{\operatorname{cos} (x)}{x} + \operatorname{Si} (x)$$ Perhaps this is done by writing $1/(x^2(1+x^2))$ in complex partial fractions? Then: the limit at $+\infty$ is $-\pi\sinh(1)/2$ and at $0$ is $-\pi\cosh(1)/2$. Subtract to get $\pi/(2e)$.

Regarding the justification you asked, about bringing the limit inside the integral: $$\lim_{\varepsilon\to 0}\frac{1-e^{i\varepsilon e^{i\theta}}}{\varepsilon e^{i\theta}\left(\varepsilon^2 e^{2i\theta}+1\right)}=-i\Longrightarrow \int_\pi^0\frac{1-e^{i\varepsilon e^{i\theta}}}{\varepsilon^2e^{2i\theta}\left(\varepsilon^2e^{2i\theta}+1\right)}\,\varepsilon ie^{i\theta}\,d\theta\xrightarrow [\varepsilon\to 0]{} -\pi$$ Yes, dominated convergence works fine here, to see this put $$f_\varepsilon(\theta)=\frac{1-e^{i\varepsilon e^{i\theta}}}{\varepsilon e^{i\theta}\left(\varepsilon^2 e^{2i\theta}+1\right)}$$ In order to estimate this correctly, first note that the numerator as well as the denominator is zero at $\varepsilon=0$, which we must take care of. To do that, fix $\varepsilon\in(0,1]$ and let $A,B\in\mathbb{C}$, then (by the Taylor expansion of $x\mapsto \exp(x)$) $$\frac{1-e^{\varepsilon A}}{\varepsilon B}= -\frac{A}{B} - \varepsilon g_\varepsilon(A,B)$$ where
$$|g_\varepsilon(A,B)|\leq g_\varepsilon(|A|,|B|)\leq g_1(|A|,|B|) =\frac{e^{|A|}-1-|A|}{|B|}.$$
With $A=ie^{i\theta}$ and $B=e^{i\theta}$, it follows that $$|f_\varepsilon(\theta)|\leq \frac{1}{1-\varepsilon^2} + \frac{2}{1-\varepsilon^2}\leq 1+2=3$$ and hence by dominated convergence $$i\int_\pi^0 f_\varepsilon(\theta)d\theta\to i\int_\pi^0 -i d\theta=-\pi$$

Edit: Actually the convergence is uniform as long as $$\frac{e^{|A|}-1-|A|}{|B|}$$ stays bounded, which it does here.

$\newcommand{\angles}{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}{\displaystyle{#1}} \newcommand{\expo}{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\pars}{\left(\, #1 \,\right)} \newcommand{\partiald}[]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\verts}{\left\vert\, #1 \,\right\vert}$ $\ds{\int_{0}^{\infty}{1-\cos\pars{x} \over x^{2}\pars{x^{2} + 1}}\,\dd x:\ {\large ?}}$

\begin{align}&\color{#c00000}{\int_{0}^{\infty}% {1-\cos\pars{x} \over x^{2}\pars{x^{2} + 1}}\,\dd x} =\half\int_{-\infty}^{\infty}\bracks{1 - \cos\pars{x}} \pars{{1 \over x^{2}} - {1 \over x^{2} + 1}}\,\dd x \\[3mm]&=\int_{-\infty}^{\infty}{\sin^{2}\pars{x/2} \over x^{2}}\,\dd x -\half\int_{-\infty}^{\infty}{\dd x \over 1 + x^{2}} +\half\Re\int_{-\infty}^{\infty}{\expo{\ic x} \over \pars{x - \ic}\pars{x + \ic}}\,\dd x \\[3mm]&=\underbrace{\overbrace{\half\int_{-\infty}^{\infty}% {\sin^{2}\pars{x} \over x^{2}}\,\dd x}^{\ds{=\ {\pi \over 2}}}\ -\ \overbrace{\half\int_{-\infty}^{\infty}{\dd x \over 1 + x^{2}}}^{\ds{=\ {\pi \over 2}}}}_{\ds{\color{#c00000}{\LARGE=\ 0}}}\ +\ \half\,\Re\int_{-\infty}^{\infty}{\expo{\ic x} \over \pars{x - \ic}\pars{x + \ic}}\,\dd x \end{align}

We are just left with one integral: $$\color{#66f}{\large\int_{0}^{\infty}% {1-\cos\pars{x} \over x^{2}\pars{x^{2} + 1}}\,\dd x} = \half\Re\int_{-\infty}^{\infty}{\expo{\ic x} \over \pars{x - \ic}\pars{x + \ic}}\,\dd x =\half\Re\pars{2\pi\ic\,{\expo{\ic\pars{\ic}} \over \ic + \ic}} =\color{#66f}{\large{\pi \over 2\expo{}}}$$