TITLE: How to prove $\int_0^\infty \ln(1+\frac{z}{\cosh(x)})dx=\frac{\pi^2}{8}+\frac{(\cosh^{-1}(z))^2}{2},z\ge1$ and a closed form for $-1<z<1$?
QUESTION [9 upvotes]: I observed graphically that $$f(z)=\int_0^\infty \ln\left(1+\frac{z}{\cosh(x)}\right)dx=\frac{\pi^2}{8}+\frac{(\cosh^{-1}(z))^2}{2},z\ge1$$
Can anyone explain why this holds? I tried differentiating with respect to $z$ but I didn't really know how to continue further.
Also, if anyone knows how to obtain a closed form of $f(z)$ for $-1<z<1$ it would be greatly appreciated as I'm curious about specific values such as $f(-\frac{1}{2})=-\frac{7\pi^2}{72}$ and $f(\frac{1}{2})=\frac{5\pi^2}{72}.$

REPLY [4 votes]: First,
$$
\begin{align}
\int_0^{\pi/2}\frac{\mathrm{d}\theta}{1+\alpha\sin(\theta)}
&=\int_0^1\frac{2\,\mathrm{d}z}{1+2\alpha z+z^2}\tag1\\
&=\frac1{\sqrt{\alpha^2-1}}\int_0^1\left(\frac1{z+\alpha-\sqrt{\alpha^2-1}}-\frac1{z+\alpha+\sqrt{\alpha^2-1}}\right)\mathrm{d}z\tag2\\
&=\frac1{\sqrt{\alpha^2-1}}\left[\log\left(\frac{z+\alpha-\sqrt{\alpha^2-1}}{z+\alpha+\sqrt{\alpha^2-1}}\right)\right]_0^1\tag3\\
&=\frac1{\sqrt{\alpha^2-1}}\log\left(\alpha+\sqrt{\alpha^2-1}\right)\tag4\\
&=\left\{\begin{array}{}
\frac1{\sqrt{1-\alpha^2}}\cos^{-1}(\alpha)&\text{if }|\alpha|\le1\\
\frac1{\sqrt{\alpha^2-1}}\cosh^{-1}(\alpha)&\text{if }\alpha\ge1
\end{array}\right.\tag5
\end{align}
$$
Explanation:
$(1)$: substitute $z=\tan(\theta/2)$
$(2)$: partial fractions
$(3)$: integrate
$(4)$: evaluate
$(5)$: simplify in different cases
Therefore,
$$
\begin{align}
\int_0^\infty\log\left(1+\frac{\alpha}{\cosh(x)}\right)\,\mathrm{d}x
&=\int_1^\infty\log\left(1+\frac{2\alpha}{u+\frac1u}\right)\frac{\mathrm{d}u}u\tag6\\
&=\int_0^1\log\left(1+\frac{2\alpha}{u+\frac1u}\right)\frac{\mathrm{d}u}u\tag7\\
&=\int_0^{\pi/4}\log\left(1+\alpha\sin(2\theta)\right)\frac{2\,\mathrm{d}\theta}{\sin(2\theta)}\tag8\\
&=\int_0^{\pi/2}\log\left(1+\alpha\sin(\theta)\right)\frac{\mathrm{d}\theta}{\sin(\theta)}\tag9\\
&=\left\{\begin{array}{}
\frac{\pi^2}8-\frac12\cos^{-1}(\alpha)^2&\text{if }|\alpha|\le1\\
\frac{\pi^2}8+\frac12\cosh^{-1}(\alpha)^2&\text{if }\alpha\ge1
\end{array}\right.\tag{10}
\end{align}
$$
Explanation:
$\phantom{1}(6)$: substitute $u=e^x$
$\phantom{1}(7)$: substitute $u\mapsto1/u$
$\phantom{1}(8)$: substitute $u=\tan(\theta)$
$\phantom{1}(9)$: substitute $\theta\mapsto\theta/2$
$(10)$: apply the integral of $(5)$