# Real Analysis Methodologies to Prove $-\int_x^\infty \frac{\cos(t)}{t}\,dt=\gamma+\log(x)+\int_0^x \frac{\cos(t)-1}{t}\,dt$ for $x>0$

In this question, the OP asked to prove the Cosine Integral identity $$-\int_x^\infty \frac{\cos(t)}{t}\,dt=\gamma+\log(x)+\int_0^x \frac{\cos(t)-1}{t}\,dt$$, where $$\gamma$$ is the Euler-Mascheroni constant. However, the two posted answers are incomplete and seem unsatisfactory.

Using Complex Anaysis

One can show for $$x>0$$ that $$-\int_x^\infty \frac{\cos(t)}{t}\,dt=\gamma+\log(x)+\int_0^x \frac{\cos(t)-1}{t}\,dt$$ using contour integration. To wit, Cauchy's Integral Theorem guarantees that

\begin{align} 0&=\oint_C \frac{e^{iz}}{z}\,dz\\\\ &=\int_\epsilon^R \frac{e^{ix}}{x}\,dx +\int_0^{\pi/2}\frac{e^{iRe^{i\phi}}}{Re^{i\phi}}\,iRe^{i\phi}\,d\phi+\int_R^\epsilon \frac{e^{-x}}{ix}\,i\,dx+\int_{\pi/2}^0 \frac{e^{i\epsilon e^{i\phi}}}{\epsilon e^{i\phi}}\,i\epsilon e^{i\phi}\,d\phi\\\\ &=\int_\epsilon^R \frac{e^{ix}}{x}\,dx -\int_\epsilon^R \frac{e^{-x}}{x}\,dx-i\frac\pi2+O(\epsilon)+O\left(\frac1R\right)\tag1 \end{align}

whence after taking the real part of both sides of $$(1$$ and integrating by parts the integral $$\int_\epsilon^R \frac{e^{-x}}{x}\,dx$$ with $$u=e^{-x}$$ and $$v=\log(x)$$, we find

\begin{align}-\int_x^R \frac{\cos(x')}{x'}\,dx'&=\log(x)-\int_\epsilon^R e^{-x}\log(x)\,dx+\int_\epsilon^x\frac{\cos(x')-1}{x'}\,dx'\\\\ &-\log(\epsilon) -e^{-R}\log(R)+e^{-\epsilon}\log(\epsilon)+O\left(\frac1R\right)+O(\epsilon)\tag2 \end{align}

Letting $$R\to\infty$$ and $$\epsilon\to 0$$ in $$(2)$$ yields the sought relationship.

Using Real Analysis Alternatively, we can use either the Laplace Transform or "Feynman's Trick" to show that

$$\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx=\int_0^\infty \left(\frac{x}{x^2+1}-\frac1{x+1}\right)=0\tag3$$

Starting with $$(3)$$, is tantamount to starting with the real part of $$(1)$$ and we are done.

So, what are other ways to prove the coveted relationship using real analysis tools only?

Note that for each $$x>0$$, the improper integral $$\int_{x}^{\infty}\frac{\cos(t)}{t}dt$$ converges conditionally (in the sense that $$\lim_{A\rightarrow\infty}\int_{x}^{A}\frac{\cos(t)}{t}dt$$ exists but $$\lim_{A\rightarrow\infty}\int_{x}^{A}\left|\frac{\cos(t)}{t}\right|dt=\infty$$). Define $$F:(0,\infty)\rightarrow\mathbb{R}$$ by $$F(x)=\int_{x}^{\infty}\frac{\cos(t)}{t}dt$$. Note that we still have $$F'(x)=-\frac{\cos(x)}{x}$$. For, $$\begin{eqnarray*} F'(x) & = & \lim_{h\rightarrow0}\frac{\int_{x+h}^{\infty}\frac{\cos(t)}{t}dt-\int_{x}^{\infty}\frac{\cos(t)}{t}dt}{h}\\ & = & -\lim_{h\rightarrow0}\frac{\int_{x}^{x+h}\frac{\cos(t)}{t}dt}{h}\\ & = & -\frac{\cos(x)}{x}. \end{eqnarray*}$$

On the other hand, $$0$$ in the integral $$\int_{0}^{x}\frac{\cos(t)-1}{t}dt$$ is a removable singularity. For $$t\neq0$$, we have $$\begin{eqnarray*} \frac{\cos(t)-1}{t} & = & \frac{(1-\frac{1}{2!}t^{2}+\frac{1}{4!}t^{4}-\cdots)-1}{t}\\ & = & -\frac{1}{2!}t+\frac{1}{4!}t^{3}-\frac{1}{6!}t^{5}+\cdots. \end{eqnarray*}$$ Define $$\phi:\mathbb{R}\rightarrow\mathbb{R}$$ by $$\phi(t)=-\frac{1}{2!}t+\frac{1}{4!}t^{3}-\frac{1}{6!}t^{5}+\cdots$$. It can be proved that the power series converges everywhere (using root-test), and hence $$\phi$$ is an analytic function. Therefore $$\int_{0}^{x}\frac{\cos(t)-1}{t}dt=\int_{0}^{x}\phi(t)dt$$.

Now $$\frac{d}{dx}\int_{0}^{x}\frac{\cos(t)-1}{t}dt=\frac{\cos(x)-1}{x}$$.

Finally, define $$G:(0,\infty)\rightarrow\mathbb{R}$$ by $$G(x)=\int_{x}^{\infty}\frac{\cos(t)}{t}dt-\left[\ln(x)+\int_{0}^{x}\frac{\cos(t)-1}{t}dt\right].$$ Then $$G$$ is differentiable and $$G'(x)=-\frac{\cos(x)}{x}-\frac{1}{x}-\frac{\cos(x)-1}{x}=0$$. This shows that $$G$$ is a constant function.

• You have not evaluated the constant, which renders this development incomplete. But I appreciate your attempt. – Mark Viola Mar 16 at 16:49
• I thought that you just asked to prove that there exists a constant $\gamma$ such that ... You did not ask explicitly "compute the value of $\gamma$". – Danny Pak-Keung Chan Mar 16 at 16:59
• Read the question of the OP. "Real Analysis Methodologies to Prove $-\int_x^\infty \frac{\cos(t)}{t}\,dt=\gamma+\log(x)+\int_0^x \frac{\cos(t)-1}{t}\,dt$ for $x>0$." The constant $\gamma$ is explicitly written. How did you infer that I was interested in something considerably less than that. Furthermore, in the body of the question, I actually show two derivations that include $\gamma$. – Mark Viola Mar 16 at 17:08
• I interpret that line as "Prove that there exists $\gamma$ such that ... for all $x>0$. – Danny Pak-Keung Chan Mar 16 at 17:12
• You should state explicitly: Compute the value $\gamma$ and express it in close-form. Otherwise, I can write $\gamma = G(1) = \int_1^\infty \frac{\cos t}t dt - \int_0^1 \frac{\cos t -1}{t} dt$. – Danny Pak-Keung Chan Mar 16 at 17:17