I am trying to evaluate the value of $$\int_0^\infty\frac{\cos(x) - e^{-x}}{x}dx$$. I am assuming I am supposed to use contour integration, as I was required just before to calculate the value of $$\int_0^\infty\frac{\sin(x)}{x}dx$$ using contour integration over a semicircle in the upper half complex plane.

I may be able to use contour integration directly again in order to calculate this new value, but I prefer using the value I already found for sin to get the new value, if possible.

I have tried differentiating the old term and exchanging the order of intgeration and differentiation (guided by the fact that $(sinx)' = cosx$), but got an expression I cannot simplify to the form above.

  • $\begingroup$ You need to consider a quarter circle, the contour moves back to the origin along the imaginary axis. $\endgroup$ – Count Iblis May 31 '16 at 17:02
  • $\begingroup$ @CountIblis thanks, but if there is a way to derive that without using contour integration again I would be glad to learn about it $\endgroup$ – Sirventus May 31 '16 at 17:04

Since: $$ \mathcal{L}\left(\cos x-e^{-x}\right) = \frac{s}{1+s^2}-\frac{1}{s+1} $$ we have:

$$\begin{eqnarray*} \color{red}{I} = \int_{0}^{+\infty}\frac{\cos x-e^{-x}}{x}\,dx &=& \int_{0}^{+\infty}\frac{s-1}{(s+1)(s^2+1)}\,ds\\[0.1cm]&=&\frac{1}{2}\lim_{s\to +\infty}\log\left(\frac{s^2+1}{(s+1)^2}\right)=\color{red}{\large 0}.\end{eqnarray*} $$

Quite impressive, don't you think? That also follows from a symmetry argument: $$ \int_{0}^{1}\frac{s-1}{(s+1)(1+s^2)}\,ds = -\int_{1}^{+\infty}\frac{s-1}{(s+1)(s^2+1)}\,ds $$

by just applying the substitution $s=\frac{1}{t}$ in the second integral.

You may also use the Cantarini-Frullani's theorem, from which: $$ \int_{0}^{+\infty}\frac{e^{-ix}-e^{-x}}{x}\,dx = -\frac{\pi i}{2}, $$ then take the real part of both sides.

  • $\begingroup$ @BehrouzMaleki: $$\frac{s}{1+s^2}-\frac{1}{s+1}=\frac{(s^2+s)-(s^2+1)}{(s+1)(s^2+1)}=\frac{ \color{red}{s-1} }{(s+1)(s^2+1)}.$$ $\endgroup$ – Jack D'Aurizio May 31 '16 at 17:29
  • $\begingroup$ yes guy so sorry $\endgroup$ – Behrouz Maleki May 31 '16 at 17:35

We know $$\int_{0}^{\infty }{\frac{f(x)}{x}}dx=\int_{0}^{\infty }{\mathcal{L}(f(x))}ds$$ then $$\int_{0}^{\infty }{\frac{\cos x-{{e}^{-x}}}{x}}dx=\int_{0}^{+\infty }{\left( \frac{s}{1+{{s}^{2}}}-\frac{1}{s+1} \right)}\,ds=\underset{s\to \infty }{\mathop{\lim }}\,\ln \left(\frac{\sqrt{s^2+1}}{s+1} \right)=0$$



Using contour integration we begin by writing the integral of interest as

$$\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx=\text{Re}\left(\int_0^\infty \frac{e^{ix}-e^{-x}}{x}\,dx\right) \tag 1$$

Next, we note that from Cauchy's Integral Theorem

$$\oint_C \frac{e^{iz}-e^{-z}}{z}\,dz=0 \tag 2$$

where $C$ is the closed contour comprised of (i) the line segment from $\epsilon>0$ to $R$, (ii) the quarter circle of radius $R$ centered at the origin from $R$ to $iR$, (iii) the line segment from $iR$ to $i\epsilon$, and (iv) the quarter circle of radius $\epsilon$ centered at the origin from $i\epsilon$ to $\epsilon$.

We can write $(2)$ as

$$\begin{align}\oint_C \frac{e^{iz}-e^{-z}}{z}\,dz&=\int_\epsilon^R \frac{e^{ix}-e^{-x}}{x}\,dx+\int_R^\epsilon \frac{e^{-y}-e^{-iy}}{iy}\,i\,dy\\\\ &+\int_0^{\pi/2}\frac{e^{iRe^{i\phi}}-e^{-Re^{i\phi}}}{Re^{i\phi}}\,iRe^{i\phi}\,d\phi\\\\ &+\int_{\pi/2}^0\frac{e^{i\epsilon e^{i\phi}}-e^{-\epsilon e^{i\phi}}}{\epsilon e^{i\phi}}\,i\epsilon e^{i\phi}\,d\phi\tag 3 \end{align}$$

As $R\to \infty$ and $\epsilon \to 0$, the third and fourth integrals on the right-hand side of $(3)$ can be shown to approach zero. Using $(2)$, we see that

$$\int_0^\infty \frac{e^{ix}-e^{-x}}{x}\,dx=-\int_0^\infty \frac{e^{-iy}-e^{-y}}{y}\,dy \tag 4$$

whence taking the real part of both sides of $(4)$ and comparing with $(1)$ yields

$$\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx=-\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx$$

Therefore, we find that

$$\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx=0$$ ________________________-


An alternative suggested by Ron Gordon, is to start with the integral


Then, we can write

$$\begin{align} 0&=\int_\epsilon^R \frac{e^{ix}}{x}\,dx+\int_R^\epsilon \frac{e^{-x}}{x}\,dx+i\int_0^{\pi/2} e^{iRe^{i\phi}}\,d\phi+i\int_{\pi/2}^0 e^{i\epsilon^{i\phi}}\,d\phi\\\\ &=\int_{\epsilon}^R\frac{e^{ix}-e^{-x}}{x}\,dx+i\int_0^{\pi/2} e^{iRe^{i\phi}}\,d\phi+i\int_{\pi/2}^0 e^{i\epsilon^{i\phi}}\,d\phi\tag 5 \end{align}$$

As $R\to \infty$, the third integral on the right-hand side of $(5)$ approaches $0$. As $\epsilon \to 0$ the fourth integral on the right-hand side approaches $-i\pi/2$. Therefore,

$$\int_0^\infty \frac{e^{ix}-e^{-x}}{x}\,dx=i\pi/2 \tag 6$$

Taking real and imaginary parts of $(6)$ yield respectively

$$\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx=0$$


$$\int_0^\infty \frac{\sin(x)}{x}\,dx=\frac{\pi}{2}$$

  • $\begingroup$ Wouldn't it be easier to just consider $$\oint_C dz \frac{e^{i z}}{z} $$ where $C$ is the quarter circle? $\endgroup$ – Ron Gordon May 31 '16 at 19:47
  • $\begingroup$ @rongordon Ron, that contour works as well as the one herein. I'm not sure how one measures that approach as "easier." It seems to have as many operations. -Mark $\endgroup$ – Mark Viola May 31 '16 at 19:56
  • $\begingroup$ well for one, your assertion that the third integral in Eq (3) goes to zero is far from trivial. Using the integral I suggested, convergence is a lot clearer. $\endgroup$ – Ron Gordon May 31 '16 at 20:37
  • $\begingroup$ @RonGordon That third integral appears in your proposed methodology too, does it not? And to prove the assertion, one can simply use $\sin(x)\ge 2x/\pi$ on $[0,\pi/2]$. $\endgroup$ – Mark Viola May 31 '16 at 20:54
  • $\begingroup$ @RonGordon Ron, I've amended the post of record to include the approach that you suggested. As an homage, I referenced your name; I hope that you don't mind. -Mark $\endgroup$ – Mark Viola May 31 '16 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.