TITLE: Integral $\int_0^\infty \log(1+x^2)\frac{\cosh \pi x +\pi x\sinh \pi x}{\cosh^2 \pi x}\frac{dx}{x^2}=4-\pi$?
QUESTION [12 upvotes]: Hello am looking for a solution to proving this.
$$
I:=\int_0^\infty \log(1+x^2)\frac{\cosh \pi x +\pi x\sinh \pi x}{\cosh^2 \pi x}\frac{dx}{x^2}=4-\pi.
$$
This one is related to Integral $\int_0^\infty \log(1+x^2)\frac{\cosh{\frac{\pi x}{2}}}{\sinh^2{\frac{\pi x}{2}}}\mathrm dx=2-\frac{4}{\pi}$ that the community together seemed to solve!
I tried writing
$$
I=\int_0^\infty \log(1+x^2)\frac{dx}{x^2\cosh \pi x}+\int_0^\infty \log(1+x^2)\frac{\pi x\tanh \pi x}{\cosh \pi x }\frac{dx}{x^2}
$$
but is not so clear now that I have two integrals to solve.  I wasn't sure how integrating by parts would give me a clearer integral as the terms do not clean up here like the last one.  I am not sure how else
Introducing something like $I(\alpha), I'(\alpha)$ in this situation did help but not much after this: $$
I(\alpha)=\int_0^\infty \log(1+\alpha x^2) \frac{\cosh \pi x +\pi x\sinh \pi x}{\cosh^2 \pi x}\frac{dx}{x^2}, \frac{dI}{d\alpha}=
$$ 
$$
\int_0^\infty \frac{dx}{1+\alpha x^2}\frac{\cosh \pi x +\pi x\sinh \pi x}{\cosh^2 \pi x}=\int_0^\infty \frac{dx}{(1+\alpha x^2)\cosh \pi x}+\pi\int_0^\infty \frac{dx}{1+\alpha x^2}\frac{x\tanh \pi x}{\cosh \pi x}
$$
  Thank you

REPLY [3 votes]: I will present an alternative solution here.
Denote, for $a$ between $-\pi$ and $\pi$ inclusive, $$F(a)=\int_{-\infty}^{\infty} {\cosh(ax)\over {\cosh(\pi x)}}{1\over {1+x^2}}dx$$ then by differentiation under the integral sign, which is easily justified by uniform convergence, we have 
$$F''(a)+F'(a)=\int_{-\infty}^{\infty} {\cosh(ax)\over {\cosh(\pi x)}}dx = \sec {a\over 2}$$
The above can be evaluated by standard complex analysis techniques.
Note that $F(\pi)=\pi$ and $F'(0)=0$
These initial value conditions, along with the differential equation above, can be solved with variation of parameters, giving 
$$F(a)=4\cos{a\over 2}-\pi\cos a-2\sin a\ln\tan({a\over 4}+{\pi\over 4})$$
This gives $$F(0)=\int_{-\infty}^{\infty} {1\over {\cosh(\pi x)}}{1\over {1+x^2}}dx=4-\pi$$
which is the same as the original question according to Ron Gordon's answer.