# How to evaluate $\int_0^A \frac{\tanh x}{x}dx$?

How to evaluate $$\int_0^A \frac{\tanh x}{x}dx$$ Where $A$ is a large positive number.

The answer is: $$\ln (4e^\gamma A/\pi)$$, where $\gamma$ is Euler constant.

I have no idea how to get this result. Here is a numerical result, blue is the original integral. • Is it an asymptotic? – Vim Oct 23 '15 at 7:01
• $\int_0^1\tanh x dx / x =0.9096747536...$ but $\ln 4 e^{\gamma} / \pi =0.8187801402...$. – Math-fun Oct 23 '15 at 7:07

That formula is indeed an asymptotic expansion. Indeed, integration by parts yields

$$\int_{0}^{A} \frac{\tanh x}{x} \, dx = \tanh A \log A - \int_{0}^{A} \frac{\log x}{\cosh^2 x} \, dx$$

for $A > 0$, and we easily see

$$\int_{0}^{A} \frac{\log x}{\cosh^2 x} \, dx = \int_{0}^{\infty} \frac{\log x}{\cosh^2 x} \, dx + \mathcal{O}(e^{-2A}\log A).$$

Finally, it is not impossible to compute the last integral, and the result is

$$\int_{0}^{\infty} \frac{\log x}{\cosh^2 x} \, dx = \log(\pi/4) - \gamma. \tag{*}$$

(I will skip this part, but if you want I will add a proof of this.) Putting altogether,

$$\int_{0}^{A} \frac{\tanh x}{x} \, dx = \log A + \gamma - \log(\pi/4) + \mathcal{O}(e^{-2A}\log A).$$

Addendum. (Proof of $\text{(*)}$) Notice that

$$I(s) := \int_{0}^{\infty} \frac{x^{s-1}}{\cosh^2 x} \, dx$$

defines a holomorphic function for $\Re(s) > 0$ and that the integral in $\text{(*)}$ is $I'(1)$. Our goal is to identify $I(s)$. This can be done by the following standard technique:

\begin{align*} I(s) &= \int_{0}^{\infty} 4x^{s-1} \cdot \frac{e^{-2x}}{(1 + e^{-2x})^2} \, dx \\ &= \int_{0}^{\infty} 4x^{s-1} \sum_{k=1}^{\infty} (-1)^{k-1} k e^{-2kx} \, dx \\ &= 2^{2-s} \Gamma(s) \sum_{k=1}^{\infty} (-1)^{k-1} k^{1-s} \\ &= 2^{2-2s}(2^s - 4) \Gamma(s) \zeta(s-1). \end{align*}

This calculation works only when $\Re(s) > 2$, but the result remains valid for all of $\Re(s) > 0$ by the principle of analytic continuation. Then logarithmic differentiation gives

$$I'(1) = I(1)\left( -3\log 2 + \frac{\Gamma'(1)}{\Gamma(1)} + \frac{\zeta'(0)}{\zeta(0)} \right).$$

Now the conclusion follows from known facts

$$\zeta(0) = -\frac{1}{2}, \quad \zeta'(0) = -\frac{1}{2}\log(2\pi), \quad \Gamma'(1) = -\gamma.$$

• Please kindly add that part. Thank you very much! I don't quite understand how $\gamma$ come out, there must be some special integral that I am not familiar. – an offer can't refuse Oct 23 '15 at 7:09