# How to evaluate integral: $\int_{0}^{\infty} e^{-x}\left|\sin{x}\right| \ dx$

I try to evaluate integral below.I solved indefinite integral but after evaluating limit I get wrong result.I don't know where can be problem.Maybe I just use the wrong method?

$$\int_{0}^{\infty} e^{-x}\left|\sin{x}\right| \ dx=$$

$$= \left[ -\frac{1}{2}e^{-x}\operatorname{sgn}\left(\sin{x}\right)\left(\sin{x}+\cos{x}\right)\right]_0^\infty$$

• The absolute value messes things up. You need to separate the interval into subintervals where $\sin x$ is either positive or negative, then integrate them all separately. It's relatively easy to do, because of periodicity – Yuriy S Aug 30 '19 at 10:01

The problem comes from the fact that your antiderivative has discontinuities where $$\sin x$$ changes sign, and is not differentiable.
The correct integral can be found by summing the "jumps" required to restore continuity. (These jumps have amplitude $$(-1)^ke^{-k\pi}$$).
$$\int_{0}^{+\infty}e^{-x}|\sin x|\,dx =\sum_{k\geq 0}\int_{k\pi}^{(k+1)\pi}e^{-x}|\sin x|\,dx=\sum_{k\geq 0}(-1)^k\int_{k\pi}^{(k+1)\pi}e^{-x}\sin(x)\,dx$$ equals $$\sum_{k\geq 0}\int_{0}^{\pi}e^{-x-k\pi}\sin(x)\,dx =\int_{0}^{\pi}\sin(x)e^{-x}\sum_{k\geq 0}e^{-k\pi}\,dx=\frac{1}{1-e^{-\pi}}\int_{0}^{\pi}e^{-x}\sin(x)\,dx$$ or $$\frac{1}{1-e^{-\pi}}\,\text{Im}\int_{0}^{\pi}e^{(i-1)x}\,dx=\frac{1}{1-e^{-\pi}}\,\text{Im}\left[\frac{e^{(i-1)x}}{i-1}\right]_{0}^{\pi} =\frac{1}{1-e^{-\pi}}\,\text{Im}\left[\frac{-e^{-\pi}-1}{i-1}\right]=\frac{1}{2}\cdot\frac{1+e^{-\pi}}{1-e^{-\pi}}$$ that is $$\color{blue}{\frac{1}{2}\coth\left(\frac{\pi}{2}\right)}$$.
Integrating by parts twice, we get $$\int e^{-x}\sin(x)\,\mathrm{d}x=-\frac{\sin(x)+\cos(x)}2e^{-x}\tag1$$ Thus, $$\int_{2k\pi}^{(2k+1)\pi} e^{-x}|\sin(x)|\,\mathrm{d}x=\frac12\left(e^{-2k\pi}+e^{-(2k+1)\pi}\right)\tag2$$ and $$\int_{(2k+1)\pi}^{(2k+2)\pi} e^{-x}|\sin(x)|\,\mathrm{d}x=\frac12\left(e^{-(2k+1)\pi}+e^{-(2k+2)\pi}\right)\tag3$$ Therefore, \begin{align} \int_0^\infty e^{-x}|\sin(x)|\,\mathrm{d}x &=\frac12+\sum_{k=1}^\infty e^{-k\pi}\\ &=\frac12+\frac{e^{-\pi}}{1-e^{-\pi}}\\ &=\frac12\frac{1+e^{-\pi}}{1-e^{-\pi}}\\[3pt] &=\frac12\coth\left(\frac\pi2\right) \end{align}
\begin{align} &\bbox[15px,#ffd]{\int_{0}^{\infty}\expo{-x}\verts{\sin\pars{x}}\dd x} = \int_{0}^{\infty}\expo{-x}\mrm{sgn}\pars{\sin\pars{x}}\cos\pars{x}\,\dd x \\[5mm] = &\ \int_{x\ =\ 0}^{x\ \to\ \infty}\mrm{sgn}\pars{\sin\pars{x}} \,\dd\braces{{1 \over 2}\expo{-x}\bracks{\sin\pars{x} - \cos\pars{x}}} \\[5mm] = &\ -\,{1 \over 2} - \int_{0}^{\infty}\braces{{1 \over 2}\expo{-x} \bracks{\sin\pars{x} - \cos\pars{x}}} \bracks{2\delta\pars{\sin\pars{x}}\cos\pars{x}}\,\dd x \\[5mm] = &\ -\,{1 \over 2} + \int_{0}^{\infty}\expo{-x}\cos^{2}\pars{x} \,\delta\pars{\sin\pars{x}}\,\dd x \\[5mm] = &\ \sum_{n = -\infty}^{\infty}\int_{0}^{\infty}\expo{-x}\cos^{2}\pars{x} \,\delta\pars{x - n\pi}\,\dd x \\[5mm] = &\ -\,{1 \over 2} + \sum_{n = 0}^{\infty}\expo{-n\pi} = -\,{1 \over 2} + {1 \over 1 - \expo{-\pi}} = \bbox[15px,#ffd,border:1px solid navy]{{1 \over 2}\coth\pars{\pi \over 2}}\ \approx\ 0.5452 \end{align}