# Proof verification: $\int_{-\infty}^{\infty}\operatorname{sech}\left(x\right)\ln\left(\cosh\left(x\right)\right)dx\ =\ \pi\ln\left(2\right)$.

This is more of a post I wanted to share. I have decided to tackle the following integral via contour integration:

$$\int_{-\infty}^{\infty}\operatorname{sech}\left(x\right)\ln\left(\cosh\left(x\right)\right)dx.$$

Proof. Let that integral equal $$I$$. Let $$f(z) = \frac{\text{Log}{(z+i)}}{z^2+1},$$ where Log represents the principal logarithm. We shall traverse, in a counterclockwise direction, a path $$C$$ defined by

$$C = \left[-R,R\right] \cup \Gamma,$$

which is a large semicircle of radius R above the real axis.

We can express the contour integral over $$C$$ as

$$\oint_Cf(z)dz = \int_{-R}^{R}f(z)dz + \int_{\Gamma}f(z)dz$$

Notice the only singularity that resides in $$C$$ is $$i$$. Taking the residue at that pole yields

$$\oint_Cf(z)dz = 2\pi i\text{Res}{(f(z),i)} = 2\pi i \lim_{z \to i}f(z) = \pi\ln{(2)} + i\frac{\pi^2}{2},$$

after evaluating the limit and doing some algebra. By transitivity and taking the limit as R goes to infinity, we see that

$$\lim_{R \to \infty} \int_{-R}^{R}f(z)dz + \lim_{R \to \infty} \int_{\Gamma}f(z)dz = \pi\ln{(2)} + i\frac{\pi^2}{2}.$$

Let's call the first and second integrals $$I_1$$ and $$I_2$$, respectively. Rewriting $$I_1$$ gives us

\eqalign{\int_{-R}^{R} \frac{\text{Log}(z+i)}{z^2+1}dz &= \int_{-R}^0 \frac{\text{Log}(z+i)}{z^2+1}dz + \int_{0}^R \frac{\text{Log}(z+i)}{z^2+1}dz \cr &= \int_{R}^0 \frac{\text{Log}(-y+i)}{(-y)^2+1}d(-y) + \int_{0}^R \frac{\text{Log}(z+i)}{z^2+1}dz \cr &= \int_{0}^R \frac{\text{Log}((i-y)(i+y))}{y^2+1}dy \cr &= i\frac{\pi^2}{2} + \int_0^R \frac{\ln{(1+y^2)}}{1+y^2}dy\cr}

after doing some basic manipulations and integration.

Note if $$|z| = R$$, then $$z$$ is on $$R$$. Dealing with $$I_2$$ as $$R$$ approaches infinity, consider the following inequalities:

$$|\text{Log}(z+i)| = |\ln|z+i| + i\text{Arg}(z+i)| \leq ||z+i| + i\pi| \leq R+1+\pi;$$

$$\left|z^2+1\right| \geq \left|\left|z^2\right|-1\right| = R^2 - 1.$$

By applying the ML-Inequality and Squeeze Theorem, we get

$$0 \leq \left|\int_{\Gamma}f(z)dz\right| \leq |f(z)|\left(\frac{2\pi R}{2}\right) \leq \frac{R+1+\pi}{R^2-1}$$

$$\lim_{R \to \infty} 0 \leq \lim_{R \to \infty} \left|\int_{\Gamma}f(z)dz\right| \leq \lim_{R \to \infty} \frac{R+1+\pi}{R^2-1}$$

$$0 \leq \lim_{R \to \infty} \left|\int_{\Gamma}f(z)dz\right| \leq 0.$$

This implies that

$$\lim_{R \to \infty} \int_{\Gamma}f(z)dz = 0.$$

Going back and taking R to infinity, we see that

\eqalign{ \pi \ln{(2)} + i\frac{\pi^2}{2} &= i\frac{\pi^2}{2} + \int_0^{\infty} \frac{\ln{(1+y^2)}}{1+y^2}dy + 0 \cr \pi \ln{(2)} &= \int_0^{\infty} \frac{\ln{(1+y^2)}}{1+y^2}dy. \cr }

Letting $$y = \sinh{(x)}$$, we get

$$\int_0^{\infty} \frac{\ln{(1+y^2)}}{1+y^2}dy = \int_0^{\infty}\frac{\ln{(\sinh^2{(x)}+1)}\cosh{(x)}}{\sinh^2{(x)}+1}dx = 2\int_0^{\infty}\operatorname{sech}\left(x\right)\ln\left(\cosh\left(x\right)\right)dx.$$

Since $$\operatorname{sech}\left(x\right)\ln\left(\cosh\left(x\right)\right)$$ is an even function, we see that

$$2\int_0^{\infty}\operatorname{sech}\left(x\right)\ln\left(\cosh\left(x\right)\right)dx = \int_{-\infty}^{\infty}\operatorname{sech}\left(x\right)\ln\left(\cosh\left(x\right)\right)dx.$$

Therefore,

$$\int_{-\infty}^{\infty}\operatorname{sech}\left(x\right)\ln\left(\cosh\left(x\right)\right)dx\ =\ \pi\ln\left(2\right).$$

Q.E.D.

Let me know if you know any other strategies you have. If you have any suggestions on optimizing the solution or find any errors, please do not hesitate to share them with me!

P.S. Does anyone know how to draw a semicircle contour using LaTeX? Like using a Tikz package or something?

• Integral confirmed by Mathematica. Jul 22, 2022 at 3:59
• @DavidG.Stork Sweet! Jul 22, 2022 at 4:00
• I cannot answer this question, but I can look at the P.S. and get back to you, perhaps by the end of today. +1. Jul 22, 2022 at 4:09
• Simpler solution: math.stackexchange.com/a/3254439/42969 Jul 22, 2022 at 4:28
• $$2\int_{0}^{+\infty}\frac{\log\cosh x}{\cosh x}\,dx \stackrel{\cosh x\mapsto u}{=}2\int_{1}^{+\infty}\frac{\log u}{u\sqrt{u^2-1}}\,du\stackrel{u\mapsto 1/v}{=}2\int_{0}^{1}\frac{-\log v}{\sqrt{1-v^2}}\,dv\stackrel{v\mapsto \sin\theta}{=}-2\int_{0}^{\pi/2}\log\sin\theta\,d\theta$$ and the last integral can be simply evaluated by exploiting symmetry and the duplication formula for the sine function. Jul 22, 2022 at 14:44

\begin{align} &\int_{-\infty}^{\infty}\operatorname{sech}(x)\ln\left(\cosh x \right)\ dx \\ =& \ 2\int_{0}^{\infty}\ln\left(\cosh x \right)\ d(-\tan^{-1}\text{csch} \ x) \\ \overset{ibp}=&\ 2\int_{0}^{\infty}\tanh x\ \tan^{-1}(\text{csch} \ x)\ dx \overset{t = \text{csch} \ x }= 2\int_0^{\infty}\frac{\tan^{-1}t}{t(1+t^2)}dt\\ =& \ 2\int_0^{\infty}\int_0^1 \frac{1}{(1+t^2)(1+y^2 t^2)}dy dt = \pi\int_0^1 \frac{1}{1+y}dy =\pi\ln2\\ \end{align}
• @Accelerator - Thanks. I guess I’m just familiar with it as one of the anti’s for $\text{sech}\ x$, which admittedly is less known Jul 24, 2022 at 16:08