# Evaluating the Integral: $\int_0^\infty \frac{( \frac{1}{2} - \cos x )}{x} dx$

Evaluating the Integral: $\int_0^\infty\left[\frac{1}{2} - \cos\left(x\right)\right]\,{\rm dx \over x}$

I came upon this limit: $\lim_{x\rightarrow\infty} -Ci(x) + Ci(1/x) +\ln(x)$, is it $\gamma$ ?

Here $Ci(x) = \gamma + \ln x + \int_0^x \frac{\cos t -1}{t} dt$ is the cosine integral and $\gamma$ is the Euler constant. The Limit and the Integral appear to be equal.

• $$\frac{\frac12-\cos x}{x}$$ has a non-integrable singularity in $0$. Nov 2 '13 at 23:45
• How about if that 1/2 would be a 1? Nov 2 '13 at 23:47
• Well the limit gives me this: 0.57721566490153286060651209008240243104215933593992359880576723488486772677766467093694706329174674955186905961593475130...
– Alan
Nov 2 '13 at 23:51
• @Alan Numerically, that is Euler's Constant, $\gamma$ Nov 2 '13 at 23:56
• That looks like Euler's constant! Nov 2 '13 at 23:56

$$\int_0^{+\infty}\left(\frac 1 2 - \cos x\right)\frac {dx} x = \gamma$$

\begin{align*}\int_{1/n}^n \left(\frac 1 2 - \cos x\right)\frac {dx} x &= \int_{1/n}^1 \left(1 - \cos x\right)\frac {dx} x -\int_1^n \cos x\frac {dx} x+ \frac 1 2 \left(\int_1^n \frac {dx} x -\int_{1/n}^1 \frac {dx} x\right) \\ &=\int_{1/n}^1 (1-\cos x) \frac {dx} x - \int_1^n \cos x \frac {dx} x \end{align*} $$\bbox[0.2ex,border:0.5pt solid black]{\int_0^1 \frac {1-\cos(y)}y\,dy -\int_1^{+\infty} \frac {\cos(y)} y\,dy=\gamma}$$

Here is the proof of Gronwall, 1918. For $n$ a positive integer \begin{align} A(n) &= \int_0^{n\pi} \frac{1-\cos (y)}{y} dy - \ln ( n\pi ) \\ &= \int_0^1 \frac{1-\cos (y)}{y} dy + \int_1^{n\pi} \frac{1-\cos (y)}{y} dy - \ln ( n\pi ) \\ &= \int_0^1 \frac{1-\cos(y)}{t} dy - \int_1^{n\pi} \frac{\cos(y)}{y} dy \end{align}

With a change of variable $x = 2 \pi ny$:

\begin{align} \int_0^{n\pi} \frac{1-\cos(x)}{x} xy &= \int_0^{\frac{1}{2}} \frac{1 - \cos (2\pi ny)}{y} dy \\ &= \pi \int_0^{\frac{1}{2}} \frac{1 - \cos (2 \pi ny)}{\sin(\pi y)} dy + \int_0^{\frac{1}{2}} g(y) dy - \int_0^{\frac{1}{2}} g(y) \cos ( 2 \pi ny) dy \end{align}

$g(y) = \frac{1}{y} - \frac{\pi}{\sin (\pi y)}$ which is continuous on $[0,\frac{1}{2}]$ with $g(0) = 0$.

With Riemann-Lebesgue theorem $$\int_0^\frac{1}{2} g(y) \cos ( 2 \pi n y ) dy \rightarrow 0 \text{ for } n \rightarrow + \infty$$

\begin{align} \int_0^\frac12 g(y) dy &= \lim_{s \to 0^+} \int_s^\frac12 \left( \frac 1y - \frac \pi{\sin(\pi y)} \right) dy \\ &= \lim_{s \to 0^+} \left[ \ln \left( \frac{y}{\tan ( \pi/2\;y )} \right) \right]_s^{\frac{1}{2}} = \ln ( \pi ) - 2 \ln (2) \end{align}

On the other hand \begin{align} \pi \int_{0}^{\frac{1}{2}} \frac{1 - \cos ( 2 \pi n y)}{\sin ( \pi y )} dy &= 2\pi \int_{0}^{\frac{1}{2}} \sum_{k=1}^{n} \sin ( (2k-1) \pi y ) dy \\ &= \sum_{k=1}^{n} \frac{2}{2k-1} ={\ln (n) + 2 \ln (2) + \gamma + o(1)} \end{align}

Finally $$A(n) = \gamma + o(1)$$

Thanks very much to Sladjan Stankovik for providing insight into this problem for me.

• There is something suble here. Having $$\lim_{n\to +\infty}\int_{1/n}^{n} f(x)\,dx = C$$ does not imply that $f(x)$ is a Riemann-integrable function over $\mathbb{R}^+$ with $$\int_{0}^{+\infty}f(x)\,dx = C.$$ @Daniel Fischer is completely right. Jan 21 '14 at 3:21
• @JackD'Aurizio: No one said he wasn't... :-) Being able to compute $\displaystyle\lim_{n\to\infty}\sum_{k=-n}^nk=0$, for instance, is not the same thing as saying that $\displaystyle\sum_{k=-\infty}^\infty k$ makes any sense. (Obviously, changing either center of the sum's terms to anything other than $0$, and/or destroying the symmetry of its limits, will yield completely different results). Jan 21 '14 at 12:04
• @Lucian: we totally agree, I was simply pointing out that the very first line of this answer, strictly speaking, is wrong. Jan 21 '14 at 13:16
• Reference for the problem : "Euler’s constant with integrals" by Moubinool OMARJEE , Lycée Jean-Lurçat Paris , France -- Twenty-six different integrals that lead to Euler's Constant. (I have no problem with the problem being formulated in a more modern context.) The result of Gronwall is , of course, from 1918.
– Alan
Jan 22 '14 at 2:04
• @Alan i edited your answer, by converting it to $\TeX$. Can you review it once?
– Guy
Mar 25 '14 at 12:21

$\newcommand{\+}{^{\dagger}} \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert} \newcommand{\wt}[1]{\widetilde{#1}}$ $\ds{\lim_{\epsilon \to 0^{+}}\,\int_{\epsilon}^{1/\epsilon} \bracks{\half - \cos\pars{x}}\,{\dd x \over x} = \gamma.\quad}$ $\ds{\quad\gamma}$ is the Euler-Mascheroni Constant.

\begin{align} &\color{#c00000}{ \lim_{\epsilon \to 0^{+}}\,\int_{\epsilon}^{1/\epsilon}\bracks{ \half - \cos\pars{x}}\,{\dd x \over x}} =\lim_{\epsilon \to 0^{+}}\,\bracks{-\int_{\epsilon}^{1/\epsilon}{ \cos\pars{x} - 1 \over x}\,\dd x - \half\int_{\epsilon}^{1/\epsilon} {\dd x \over x}} \\[3mm]&=\lim_{\epsilon \to 0^{+}}\,\braces{ -\bracks{{\rm Ci}\pars{1 \over \epsilon} - \ln\pars{1 \over \epsilon} - \gamma} + \bracks{{\rm Ci}\pars{\epsilon} - \ln\pars{\epsilon} - \gamma} -\half\ln\pars{1/\epsilon \over \epsilon}}\tag{1} \end{align} where $\ds{{\rm Ci}\pars{x}}$ is one of the Cosine Integral Functions.

Expression $\pars{1}$ can be rewritten as \begin{align} &\color{#c00000}{ \lim_{\epsilon \to 0^{+}}\,\int_{\epsilon}^{1/\epsilon}\bracks{ \half - \cos\pars{x}}\,{\dd x \over x}} =\gamma + \lim_{\epsilon \to 0^{+}}\, \braces{-{\rm Ci}\pars{1 \over \epsilon} + \bracks{{\rm Ci}\pars{\epsilon} - \ln\pars{\epsilon} - \gamma}}\tag{2} \end{align}

However $$\lim_{\epsilon \to 0^{+}}\,{\rm Ci}\pars{1 \over \epsilon} = 0\,,\qquad \lim_{\epsilon \to 0^{+}}\,\,\bracks{ {\rm Ci}\pars{\epsilon} - \gamma - \ln\pars{\epsilon}} = 0$$

such that $\pars{2}$ leads to $$\color{#00f}{\large \lim_{\epsilon \to 0^{+}}\int_{\epsilon}^{1/\epsilon}\bracks{ \half - \cos\pars{x}}\,{\dd x \over x} = \gamma}$$