Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


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

share|cite|improve this question
Maple says $-\gamma/2$. – AD. Oct 13 '12 at 12:30
@Chris'ssister: I like your question here. They are really like simple or difficult puzzles. Thanks for sharing them here. – Babak S. Oct 13 '12 at 13:11
@Babak Sorouh: I'm really glad to read these words. Thank you! – user 1618033 Oct 13 '12 at 13:14
up vote 21 down vote accepted

Related problems: (I), (II). Recalling the Mellin transform of a function $f$

$$ F(s) = \int_{0}^{\infty} x^{s-1}f(x) \,dx .$$

Then we consider the more general integral

$$ F(s) = \int_{0}^{\infty} x^{s-1}\left(\cos x - e^{-x^2}\right) \, dx \,. $$

The value of the integral in our problem follows by taking the limit as $s\to 0 $ in the above integral. Evaluating the above integral gives

$$ F(s) = \Gamma \left( s \right) \cos \left( \frac{\pi \,s}{2} \right) - \frac{1}{2}\, \Gamma \left(\frac{s}{2} \right) \,.$$

Taking the limit as $s \to 0 \,,$ we get the desired result

$$ \int_{0}^{\infty} \frac{\cos x - e^{-x^2}}{x} \ dx = -\frac{\gamma}{2}\,. $$

share|cite|improve this answer
your way seems so simple! Thanks! (+1) – user 1618033 Oct 13 '12 at 19:30
@Chris'ssister: You are welcome. – Mhenni Benghorbal Oct 13 '12 at 19:43
+1. It's quite simple and elegant. – Felix Marin Oct 30 '14 at 20:00
@FelixMarin: Thanks for the comment. I really appreciate it. – Mhenni Benghorbal Dec 26 '14 at 19:16

The result is

$$ \int_{0}^{\infty} \frac{\cos x - e^{-x^2}}{x} \, dx = -\frac{\gamma}{2},$$

where $\gamma$ is the Euler-Mascheroni constant.

Some direct calculations are available, but I prefer to consider it as a difference of some sort of log-singularities. you can find a slightly general method in this line of approach to calculate integrals of this form in my blog posting.

share|cite|improve this answer
thanks for the answer (+1) – user 1618033 Oct 13 '12 at 12:35
It would be nice to see more of the behind-the-scenes work here. Perhaps an application of the centers that are mentioned in your blog. – robjohn Oct 25 '14 at 13:02

Contour integration along the contour $[0,R]\cup Re^{i\pi/2[0,1]}\cup i[R,0]$ says that $$ \int_0^\infty\frac{e^{ix}}{x^\alpha}\mathrm{d}x=e^{i\pi(1-\alpha)/2}\int_0^\infty\frac{e^{-x}}{x^\alpha}\mathrm{d}x\tag{1} $$ since the integral along the curve vanishes as $R\to\infty$. Thus, $$ \begin{align} \int_0^\infty\frac{e^{ix}-e^{-x^2}}{x^\alpha}\mathrm{d}x &=e^{i\pi(1-\alpha)/2}\Gamma(1-\alpha)-\frac12\Gamma\left(\frac{1-\alpha}2\right)\\ &=\frac{e^{i\pi(1-\alpha)/2}\Gamma(2-\alpha)-\Gamma\left(\frac{3-\alpha}2\right)}{1-\alpha}\tag{2} \end{align} $$ Take the limit of $(2)$ as $\alpha\to1^-$ using L'Hospital and the fact that $\Gamma'(1)=-\gamma$: $$ \begin{align} \int_0^\infty\frac{e^{ix}-e^{-x^2}}{x}\mathrm{d}x &=\frac{-\frac{i\pi}2+\gamma-\frac\gamma2}{-1}\\[4pt] &=-\frac\gamma2+\frac{i\pi}2\tag{3} \end{align} $$ Therefore, we have both $$ \boxed{\bbox[5pt]{\displaystyle\int_0^\infty\frac{\cos(x)-e^{-x^2}}{x}\mathrm{d}x=-\frac\gamma2}}\tag{4} $$ and $$ \int_0^\infty\frac{\sin(x)}{x}\mathrm{d}x=\frac\pi2\tag{5} $$ where $\gamma$ is the Euler-Mascheroni Constant.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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