# 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 Commented Aug 30, 2019 at 10:01
• You can still use the fundamental theorem of calculus and limits, but you have to sum up all the discontinuities that occur at every pi. Commented Jan 20, 2023 at 16:31

$$\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)}$$.

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}$$).

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}

$$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$$ $$\ds{\bbox[15px,#ffd]{\int_{0}^{\infty}\expo{-x}\verts{\sin\pars{x}}\dd x = {1 \over 2}\,{\expo{\pi} + 1 \over \expo{\pi} - 1} = {1 \over 2}\coth\pars{\pi \over 2}}:\ {\large ?}}$$

\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}