# Integral of $\ln(\tanh(x))$

I'd like a hint toward how I could evaluate this definite integral. I'm aware it's likely to be non elementary and I haven't found a way to evaluate it yet:$$\int_0^\infty \ln(\tanh(x))\,\,\mathrm{d}x$$

If you're curious where this came from, I was looking at an integral involving $$\ln(\sin(x))$$ and I thought of this one.

Thanks.

• Related: math.stackexchange.com/questions/2182256/integral-of-ln-cosh-x Did you find a solution for $\int_0^{\infty}\log(\sinh(x))$? Mathematica gives $\int_0^{\infty}\log(\tanh(x))=-\frac{\pi^2}{8}$ so there might be a nice way to solve this one – Václav Mordvinov Dec 5 '18 at 20:13
• I believe that both $\int_0^\infty{\ln\left(\sinh\left(x\right)\right)}\,\,\mathrm{d}x$ and $\int_0^\infty{\ln\left(\cosh\left(x\right)\right)}\,\,\mathrm{d}x$ diverge but that result for tanh seems promising for a really satisfying solution. – Sheepe Dec 5 '18 at 20:19
• In the light of some of the solutions below, why not now consider a generalization of your original integral: $\int_0^\infty \left(\ln(\tanh(x)) \right)^n\, dx$ where n is a positive integer. – James Arathoon Dec 8 '18 at 17:32

By applying the definition of the hyperbolic tangent function in terms of the exponential we obtain

\begin{align} \int_0^{\infty}\log(\tanh(x))dx&=\int_0^{\infty}\log\left(\frac{e^x-e^{-x}}{e^x+e^{-x}}\right)dx \\ &=\int_0^{\infty}\log\left(\frac{1-e^{-2x}}{1+e^{-2x}}\right)dx\\ &=\int_0^{\infty}\log\left(1-e^{-2x}\right)-\log\left(1+e^{-2x}\right)dx \end{align}

Now by expanding the logarithm as a series $$($$!$$)$$ we further get

\begin{align} \int_0^{\infty}\log\left(1-e^{-2x}\right)-\log\left(1+e^{-2x}\right)dx&=\int_0^{\infty}-\sum_{n=1}^{\infty}\frac1{n}e^{-2nx}+\sum_{n=1}^{\infty}\frac{(-1)^n}{n}e^{-2nx}dx\\ &=-\sum_{n=1}^{\infty}\left[-\frac{e^{-2nx}}{2n^2}\right]_0^{\infty}+\sum_{n=1}^{\infty}\left[(-1)^{n+1}\frac{e^{-2nx}}{2n^2}\right]_0^{\infty}\\ &=-\sum_{n=1}^{\infty}\frac1{2n^2}-\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{2n^2}\\ &=-\frac12\zeta(2)-\frac12\eta(2)\\ &=-\frac12\frac{\pi^2}6-\frac12\frac{\pi^2}{12}\\ &=-\frac{\pi^2}8 \end{align}

Which is the desired result. $$\zeta(s)$$ denotes the Riemann Zeta Function and $$\eta(s)$$ the Dirichlet Eta Function respectively for which the values are known.

Anyway this solution is kind of unsteady since I cannot really justify the validity of the power series of the logarithmic functions $$($$which is normally restricted to $$|x|<1$$ $$)$$ nor the termwise integration. Nevertheless it leads to the right solution.

EDIT:

As illustrated by ComplexYetTrivial within the comments the validity of the series expansion of the logarithm is guaranteed due the the fact that $$e^{-2x}<1$$ for all $$x>0$$ from where the series converges. Whereas the termwise integration is justified by the monotone dominate convergence theorem. Thus my proposed solution seems to be entirely fine.

• Absolutely amazing, thank you very much. – Sheepe Dec 5 '18 at 20:40
• @Sheepe Thank you. Howsoever I am still unsure about the convergence radius of the logarithmic series expansion which is dismissed withtin this solution ^^ – mrtaurho Dec 5 '18 at 20:41
• Since $\mathrm{e}^{-2 x} < 1$ for $x>0$, the series expansion is valid. Termwise integration is justified by the monotone/dominated convergence theorem, so the solution is perfectly fine! – ComplexYetTrivial Dec 5 '18 at 20:42
• I did get up until the series substitution in my own attempts, but out of my own concerns of the same idea I couldn't see how to continue but it seems to work out nevertheless. – Sheepe Dec 5 '18 at 20:43
• @ComplexYetTrivial This completes my evaluation and clears my doubts! Thank you! Firstly I was sceptical about my own attempt but out of pure curiosity I finished the evaluation and indeed it turned out to work :) – mrtaurho Dec 5 '18 at 20:50

Through the substitution $$x=\text{arctanh}(t)$$ we have $$I=\int_{0}^{+\infty}\log\tanh x\,dx = \int_{0}^{1}\frac{\log t}{1-t^2}\,dt$$.
Since $$\int_{0}^{1}t^{2n}\log(t)\,dt = -\frac{1}{(2n+1)^2}$$ we have

$$I = -\sum_{n\geq 0}\frac{1}{(2n+1)^2}=-\left[\zeta(2)-\frac{1}{4}\zeta(2)\right]=-\frac{3}{4}\cdot\frac{\pi^2}{6}=\color{red}{-\frac{\pi^2}{8}}.$$

Here is a slight variation on a theme.

Making use of the result $$\tanh^2 x = 1 - \mbox{sech}^2 x$$, we can write the integral as $$I = \frac{1}{2} \int_0^\infty \ln (1 - \text{sech}^2 x) \, dx.$$ Setting $$\text{sech}^2 x \mapsto x$$ gives $$I = \frac{1}{4} \int_0^1 \frac{\ln (1 - x)}{x \sqrt{1 - x}} \, dx.$$ There are many ways to evaluate this integral. One way is by enforcing a substitution of $$x \mapsto 1 - x^2$$. Doing so we arrive at $$I = \int_0^1 \frac{\ln x}{1 - x^2} \, dx,$$ which is exactly the same point @Jack D'Aurizio arrived at in his solution.

Departing from Jack, we now employ a self-similar substitution of $$u = \dfrac{1 - x}{1 + x}$$.

Thus $$I = \frac{1}{2} \int_0^1 \frac{1}{u} \ln \left (\frac{1 - u}{1 + u} \right ) \, du = \frac{1}{2} \int_0^1 \frac{\ln (1 - u)}{u} \, du - \frac{1}{2} \int_0^1 \frac{\ln (1 + u)}{u} \, du.$$ In the second of these integrals let $$u \mapsto -u$$ \begin{align*} I &= \frac{1}{2} \int_0^1 \frac{\ln (1 - u)}{u} \, du - \frac{1}{2} \int_0^{-1} \frac{\ln (1 - u)}{u} \, du\\ &= -\frac{1}{2} \text{Li}_2 (1) + \frac{1}{2} \text{Li}_2 (-1)\\ &= -\frac{1}{2} \cdot \frac{\pi^2}{6} + \frac{1}{2} \cdot -\frac{\pi^2}{12}\\ &= -\frac{\pi^2}{8}, \end{align*}
where use of the dilogarithm function has been made.

Another option: $$\ln\tanh x=-2\operatorname{artanh}\exp -2x=-2\sum_{k\ge 0}\frac{\exp -(4k+2)x}{2k+1},$$so$$\int_0^\infty\ln\tanh x dx=-\sum_{k\ge 0}\frac{1}{(2k+1)^2}=-\frac{\pi^2}{8}.$$