TITLE: Evaluate $\int_0^\infty \cos(bx)(x-\ln(e^x-1))dx $
QUESTION [5 upvotes]: I have been given the integral
  $$\int_0^\infty \cos(bx)(x-\ln(e^x-1))dx$$
  from a friend. I found an answer in terms of the digamma function, but he told me that the answer is obtainable without imaginary numbers. I am completely dumbfounded on how he got the answer.

I have absolutely no idea where to start without using complex numbers. When $b=0$, it's pretty easy to show that it evaluates to $\zeta(2)$ or $\frac{\pi^2}{6}$. But I can't figure out a general form without using digamma.

REPLY [7 votes]: \begin{align}
\int_0^\infty \cos bx(x-\ln(e^x-1))dx
&= \int_0^\infty \cos bx\ln\dfrac{1}{1-e^{-x}}\ dx\\
&= \int_0^\infty \cos bx\sum_{n=1}^\infty\dfrac{e^{-nx}}{n}\ dx\\
&= \sum_{n=1}^\infty\dfrac{1}{n}\int_0^\infty \cos bx\ e^{-nx}\ dx\\
&= \sum_{n=1}^\infty\dfrac{1}{n}\dfrac{n}{b^2+n^2}\\
&= \sum_{n=1}^\infty\dfrac{1}{b^2+n^2}\\
&= \frac{\pi\coth\pi b}{2b}-\dfrac{1}{2b^2}
\end{align}
where $\sum_{n = 1}^\infty \frac{1}{n^2 + a^2} = \frac{\pi\coth(\pi a)}{2a} - \frac{1}{2a^2}$. Note that 
$$\int_0^\infty \cos bx\ e^{-nx}\ dx={\cal L}(\cos bx)\Big|_{s=n}=\dfrac{n}{b^2+n^2}$$