$\int_{0}^{\infty} \frac{\cos x - e^{-x}}{x} \mathrm dx$ Evaluate Integral

Evaluate $$\int_{0}^{\infty} \frac{\cos x - e^{-x}}{x} \ dx$$


To use your technique: $$J(a)=\int_0^\infty\frac{\cos x-e^{-x}}{x}e^{-ax}dx$$ then $$dJ/da=\int_0^\infty(\cos x e^{-ax} -e^{-(1+a)x})dx=a/(a^2+1)-1/(a+1)$$ hence $J(a)=\frac12\log(a^2+1)-\log(a+1)+C$. $C$ can be determined by $J(a)\to 0$ as $a\to\infty$, hence $C=0$ and $J(0)=0$.


$$\int_0^\infty {{{\cos x - {e^{ - x}}} \over x}dx} = \int_0^\infty {\left( {{s \over {1 + {s^2}}} - {1 \over {1 + s}}} \right)ds} = \mathop {\lim }\limits_{s \to \infty } \log {{\sqrt {{s^2} + 1} } \over {s + 1}} = 0$$