# How to evaluate improper integral $\int_{0}^{\infty}\frac{\tan^{-1}{x}}{e^{ax}-1}dx$?

I'm trying to evaluate the improper integral,

$$I(a)=\int_{0}^{\infty}\frac{\tan^{-1}{x}}{e^{ax}-1}\mathrm{d}x,~~~\text{where }a\in\mathbb{R}^+.$$

Does this integral have a simple closed form expression? And if so, how best to obtain it?

My attempt

My first idea was to integrate by parts using $f=\tan^{-1}{x}$ and $dg=\frac{\mathrm{d}x}{e^{ax}-1}$, with the hope that the resulting integral would be amenable to solution by differentiating under the integral sign. So I found the indefinite integral,

$$\int\frac{\tan^{-1}{x}}{e^{ax}-1}\mathrm{d}x=\tan^{-1}{x}\left(\frac{1}{a}\log{(1-e^{ax})}-x\right)-\int\left(\frac{\log{(1-e^{ax})}}{a(x^2+1)}-\frac{x}{x^2+1}\right)\mathrm{d}x,$$

but then I realized that this would result in an imaginary boundary term for the corresponding definite integral over $[0,\infty)$ since,

$$\begin{cases}\lim_{x\to\infty}\tan^{-1}{x}\left(\frac{1}{a}\log{(1-e^{ax})}-x\right)=i\frac{\pi^2}{2a},\\ \lim_{x\to0}\tan^{-1}{x}\left(\frac{1}{a}\log{(1-e^{ax})}-x\right)=0.\end{cases}$$

I want to avoid complex variables if at all possible, so I don't know if I want to continue down this route.

Can anyone offer any hints or suggestions?

CORRECTION: As Vladimir pointed out, the correct anti-derivative is actually,

$$\int\frac{\tan^{-1}{x}}{e^{ax}-1}\mathrm{d}x=\tan^{-1}{x}\left(\frac{1}{a}\log{(e^{ax}-1)}-x\right)-\int\left(\frac{\log{(e^{ax}-1)}}{a(x^2+1)}-\frac{x}{x^2+1}\right)\mathrm{d}x.$$

Then, since,

$$\begin{cases}\lim_{x\to\infty}\tan^{-1}{x}\left(\frac{1}{a}\log{(e^{ax}-1)}-x\right)=\frac{\pi}{2}\cdot0=0,\\ \lim_{x\to0}\tan^{-1}{x}\left(\frac{1}{a}\log{-e^{ax}-1)}-x\right)=0,\end{cases}$$

we have,

$$I(a)=-\int_{0}^{\infty}\left(\frac{\log{(e^{ax}-1)}}{a(x^2+1)}-\frac{x}{x^2+1}\right)\mathrm{d}x.$$

• $I(\pi)=\dfrac{1-\ln2}2$. Jun 12, 2014 at 4:14
• Not $\log(1-e^{ax})$ but $\log(e^{ax}-1)$. Check your computations. Jun 12, 2014 at 4:17
• @Vladimir Oops. Thank you very much for pointing that out. With your correction, the boundary terms vanish identically when integrating by parts. Awesome. Jun 12, 2014 at 4:41
• Looks like the integral has a closed form expression: $$\int_0^\infty\frac{\tan^{-1}x}{e^{ax}-1} dx = \frac{\pi}{2a}\left[2\log\Gamma\left(\frac{a}{2\pi}+1\right)-\log(a)\right] - \frac12\log\left(\frac{a}{2\pi e}\right)$$ The way I obtain this is very sloppy and ugly, there should be a cleaner way to get this. Jun 12, 2014 at 6:59

Consider a related integral $\displaystyle\;J(a) = \int_0^\infty e^{-ax}\tan^{-1}(x) dx\;$. We can integrate it by part to get: $$J(a) = \frac{1}{a}\int_0^\infty e^{-ax}\frac{dx}{1+x^2}$$

Using this, we can rewrite our integral as $$I(a) = \int_0^\infty \left(\sum_{n=1}^\infty e^{-nax}\right)\tan^{-1}(x)dx = \sum_{n=1}^\infty J(na) = \sum_{n=1}^\infty \frac{1}{na}\int_0^\infty e^{-nax}\frac{dx}{1+x^2}$$ Replace $x$ by $x/n$ in each terms, this can be transformed as $$I(a) = \frac{1}{a}\int_0^\infty e^{-at}\left(\sum_{n=1}^\infty \frac{1}{t^2+n^2}\right) dt$$ Start with a infinite product expansion of $\displaystyle\;\frac{\sinh(\pi x)}{\pi x}\;$. By taking logarithm and differentiate, $$\frac{\sinh(\pi x)}{\pi x} = \prod_{n=1}^\infty \left(1 + \frac{x^2}{n^2}\right) \quad\implies\quad \sum_{n=1}^\infty \frac{1}{x^2 + n ^2 } = \frac{1}{2x}\left( \pi\coth(\pi x) - \frac{1}{x}\right)$$ we can rewrite the sum inside above integrand of $I(a)$ and obtain

$$I(a) = \frac{\pi}{2a}F\left(\frac{a}{\pi}\right) \quad\text{ where }\quad F(x) = \int_0^\infty e^{-xt} \left(\coth(t) - \frac{1}{t}\right) \frac{dt}{t}$$ Notice $$-\frac{dF(x)}{dx} = \int_0^\infty e^{-xt}\left(\coth(t) - \frac{1}{t}\right)dt$$ and compare this with a integral representation of digamma function $\displaystyle\;\psi(x) = \frac{d\log\Gamma(x)}{dx}\;$, $$\psi(x) = \int_0^\infty\left(\frac{e^{-t}}{t} - \frac{e^{-xt}}{1-e^{-t}}\right)dt \quad\implies\quad \psi\left(\frac{x}{2}\right) = \int_0^\infty\left(\frac{e^{-2t}}{t} - \frac{2e^{-xt}}{1-e^{-2t}}\right)dt$$ We get $$\begin{array}{rrl} &-\frac{dF(x)}{dx} &= \int_0^\infty \frac{e^{-2t} - e^{-xt}}{t}dt - \frac12 \left[\psi\left(\frac{x}{2}\right) + \psi\left(\frac{x}{2}+1\right)\right]\\ &&= \log\frac{x}{2} - \frac12\left[\psi\left(\frac{x}{2}\right) + \psi\left(\frac{x}{2}+1\right)\right]\\ \implies & F(x) &= \text{const.} + \log\Gamma\left(\frac{x}{2}\right) + \log\Gamma\left(\frac{x}{2}+1 \right) - x\log\left(\frac{x}{2e}\right) \end{array}$$ Since $\lim\limits_{x\to\infty}F(x) = 0$, we can use Stirling's approximation to fix the constant in $F(x)$ to $-\log(2\pi)$. As a result, We find

$$I(a) = \frac{\pi}{2a}\left[ 2\log\Gamma\left(\frac{a}{2\pi}+1\right) - \log(a)\right] -\frac12\log\left(\frac{a}{2\pi e}\right)$$

• I got so much to learn from this, thank you achille hui! :) I started out with the same integral $J(a)$ but had no idea about the product expansion of sinh you used. Your solution is really elegant. Jun 12, 2014 at 11:36
• @PranavArora: See Basel problem. Jun 12, 2014 at 16:50
• Wonderful solution! Could you elaborate a bit more on how to obtain the integral expression for $\psi(x)$ ? Jun 12, 2014 at 16:52
• @Lucian, I just look up that integral expansion of $\psi(x)$ from wiki and use it. The story is I use a small $\epsilon$ and approximate $$\coth t - \frac{1}{t} \approx \coth t - \epsilon\cosh(\epsilon t) = (1-\epsilon) + 2\sum_{n=1}^\infty\left(e^{-2nt} - \epsilon e^{-2n\epsilon t}\right)$$ I substitute this into the integral of $-F'(x)$ to study its qualitative behavior. I notice part of the expansion is very similar to that of $\psi(x)$. This prompt me to re-express part of the integral by $\psi(\cdots)$. What's remain is sufficiently simple and I know how to deal with it directly. Jun 12, 2014 at 17:31


Set $\quad\ds{ax \equiv 2\pi t\quad\imp\quad x = {2\pi t \over a}}$: \begin{align} {\rm I}\pars{a}&={2\pi \over a}\int_{0}^{\infty} {\arctan\pars{2\pi t/a}\over \expo{2\pi t} - 1}\,\dd t \quad\imp\quad \totald{\bracks{a{\rm I}\pars{a}}}{a} =2\pi\int_{0}^{\infty}{-2\pi t/a^{2} \over \pars{2\pi t/a}^{2} + 1}\, {\dd t \over \expo{2\pi t} - 1} \end{align}

$$\totald{\bracks{a{\rm I}\pars{a}}}{a} =-\int_{0}^{\infty} {t\,\dd t \over \bracks{t^{2} + \pars{a/2\pi}^{2}}\pars{\expo{2\pi t} - 1}}$$

We'll use the identity ${\bf\mbox{6.3.21}}$ where $\ds{\Psi\pars{z}}$ is the Digamma Function ${\bf\mbox{6.3.1}}$ \begin{align} \Psi\pars{z} = \ln\pars{z} - {1 \over 2z} - 2 \int_{0}^{\infty} {t\,\dd t \over \pars{t^{2} + z^{2}}\pars{\expo{2\pi t} - 1}}\tag{$\bf 6.3.21$} \end{align} we'll get $$\totald{\bracks{z\,{\rm I}\pars{2\pi z}}}{z} =\half\bracks{\Psi\pars{z} - \ln\pars{z} + {1 \over 2z}}$$

\begin{align} {\rm I}\pars{2\pi z}&={1 \over 2z} \bracks{\ln\pars{\Gamma\pars{z}} + z - z\ln\pars{z} + \half\,\ln\pars{z}} +{{\rm C} \over z} \end{align} where $\ds{\rm C}$ is a constant and $\ds{\Gamma\pars{z}}$ is the Gamma Function ${\bf\mbox{6.1.1}}$.

$\ds{C}$ is found by noting that $\ds{\lim_{z \to \infty}{\rm I}\pars{2\pi z} = 0}$. With Stirling Asymptotic Formula ${\bf\mbox{6.1.41}}$: $$\ln\pars{\Gamma\pars{z}}\sim \pars{z - \half}\ln\pars{z} - z + \half\,\ln\pars{2\pi}\,,\qquad \verts{z} \to \infty\quad\mbox{in}\quad \verts{{\rm arg}\pars{z}} < \pi$$ we get $\ds{C = -\,{\ln\pars{2\pi} \over 4}}$ such that \begin{align} {\rm I}\pars{2\pi z}&={1 \over 2z} \bracks{\ln\pars{\Gamma\pars{z}} + z - z\ln\pars{z} + \half\,\ln\pars{z \over 2\pi}} \end{align}

Set $\ds{z = {a \over 2\pi}}$ $\ds{\pars{~\mbox{with}\ a \in {\mathbb R}^{+}~}}$: \begin{align} &\color{#77f}{\large\int_{0}^{\infty}\!\!\!{\arctan\pars{x}\,\dd x \over \expo{ax} - 1}} \\[3mm]&=\color{#77f}{\large{\pi \over a} \bracks{\ln\pars{\Gamma\pars{a \over 2\pi}} + {a \over 2\pi} - {a \over 2\pi}\, \ln\pars{a \over 2\pi} + \half\,\ln\pars{a \over 4\pi^{2}}}} \end{align}

I hope it is OK that I chime in, but I had played around with this one sometime back using the Abel-Plana formula. A formula which can come in handy. It isn't as nice as Achille and Felix solutions, but it does show how cool the AP formula can be.

In case you're unfamiliar, the Abel-Plana formula states:

$$\sum_{n=0}^{\infty}f(n)=1/2f(0)+\int_{0}^{\infty}f(x)dx+i\int_{0}^{\infty}\frac{f(ix)-f(-ix)}{e^{2\pi x}-1}dx$$

Now, let $\displaystyle f(n)=\frac{1}{(n+t)^{a}}$

Note the sum $\sum_{n=0}^{\infty}\frac{1}{(n+t)^{a}}=\zeta(a,t)$

and we have: $$\sum_{n=0}^{\infty}\frac{1}{(n+t)^{a}}=\frac{1}{2t^{a}}+\frac{1}{(s-1)t^{s-1}}+i\int_{0}^{\infty}\frac{(t+ix)^{-a}-(t-ix)^{-a}}{e^{2\pi x}-1}dx \tag{1}$$.

Note that $$\frac{1}{(t+ix)^{a}}-\frac{1}{(t-ix)^{a}}=\frac{2}{i(t^{2}+x^{2})^{a/2}}\sin(a\cdot \tan^{-1}(x/t))$$

diff (1) w.r.t 'a' and get:

$$\zeta'(a,t)=\frac{-\log(t)}{2t^{a}}-\frac{t^{1-a}[1+(a-1)\log(t)]}{(a-1)^{2}}+i\int_{0}^{\infty}\frac{(t-ix)^{-a}\log(t-ix)-(t+ix)^{-a}\log(t+ix)}{e^{2\pi x}-1}dx \tag{2}$$

The integral on the right can be written as:

$$2\Im \int_{0}^{\infty}\frac{(t+ix)^{-a}\log(t+ix)}{e^{2\pi x}-1}dx$$

Now, let $a=0$ in (2):

$$\zeta'(0,t)=(t-1/2)\log(t)-t+i\int_{0}^{\infty}\frac{\log(t-ix)-\log(t+ix)}{e^{2\pi x}-1}dx$$

Notice what the right side is beginning to look like?. Remember the complex arctan identity.

so, we have $$\zeta'(0,t)=(t-1/2)\log(t)-t+2\int_{0}^{\infty}\frac{\tan^{-1}(x/t)}{e^{2\pi x}-1}dx$$

We can also use an identity that states $\displaystyle \zeta'(0,t)=\log\Gamma(t)-1/2\log(2\pi)$

and finally arrive at:

$$\log\Gamma(t)-1/2\log(2\pi)=(t-1/2)\log(t)-t+2\int_{0}^{\infty}\frac{\tan^{-1}(x/t)}{e^{2\pi x}-1}dx$$

But, to get this last arctan integral into your form, I used the same sub Felix used and let $t\to \frac{a}{2\pi}$

$$\frac{2\pi}{a}\int_{0}^{\infty}\frac{\tan^{-1}(\frac{2\pi u}{a})}{e^{2\pi u}-1}du=\frac{\pi}{a}\left[\log\Gamma(\frac{a}{2\pi})-\frac{a}{2\pi}\log(\frac{a}{2\pi})+1/2\log(\frac{a}{2\pi})+\frac{a}{2\pi}-1/2\log(2\pi)\right]$$

i.e. Let $a=2\pi$ and get the famous:

$\displaystyle \int_{0}^{\infty}\frac{\tan^{-1}(x)}{e^{2\pi x}-1}dx=1/2-1/4\log(2\pi)$

• It's awesome that you took the time to go over the calculations in such detail. Yes, the responses provided by achille and Felix are hands down the more elegant solutions for this specific integral, but you're given me lots of great practice material for calculations I'm not completely comfortable with. Cheers. Jun 13, 2014 at 21:59
• I wanted to be thorough and show you the Abel-Plana formula. It is a good one to know and can be used inventively in many integrals and such.
– Cody
Jun 13, 2014 at 22:03
• Coincidentally, I just learned learned about Abel-Plana a few days ago, and I attempted to apply it towards completing my solution to the problem math.stackexchange.com/questions/818609/…. While it was clear to me that the formula was the key to finishing the solution, I just didn't have the dexterity to apply it in a way that actually yields useful results. I was actually thinking about that problem when I told you your calculations looked like great practice material :) Jun 13, 2014 at 22:23
• Indeed, the Abel-Plana formula is used to get the digamma function identity by starting from $\displaystyle{\large\Psi\left(z\right) = 1 + \left(z - 1\right)\sum_{n = 0}^{\infty}{1 \over \left(n + z\right)\left(n + 1\right)}}$. Jun 13, 2014 at 22:25
• Well, I feel stupid. A few months ago I evaluated $\int_{0}^{\infty} \frac{\arctan (\frac{x}{z})}{e^{\pi x}-1} \ dx$ on here. I didn't link to it because I didn't think it was directly related. But all I needed to do was make a substitution and then choose a particular value of $z$. Jun 13, 2014 at 22:58