TITLE: Integral that arises from the derivation of Kummer's Fourier expansion of $\ln{\Gamma(x)}$
QUESTION [24 upvotes]: I am trying to prove that for $0<x<1$,
$$\color{blue}{\ln{\Gamma(x)}=\frac{1}{2}\ln(2\pi)+\sum^\infty_{n=1}\left\{\frac{1}{2n}\cos(2\pi nx)+\frac{\gamma+\ln(2\pi n)}{n\pi}\sin(2\pi nx)\right\}}$$
It is quite straightforward to compute $a_0$ and $a_n$. $a_0$ is
\begin{align}
a_0
=2\int^1_0\ln{\Gamma(x)}\ {\rm d}x
=\int^1_0\ln\left(\frac{\pi}{\sin(\pi x)}\right)\ {\rm d}x
=\ln(2\pi)\\
\end{align}
As for $a_n$,
\begin{align}
a_n
=&2\int^1_0\ln{\Gamma(x)}\cos(2\pi nx)\ {\rm d}x
=\int^1_0\ln\left(\frac{\color{grey}{\pi}}{\sin(\pi x)}\right)\cos(2\pi nx)\ {\rm d}x\\
=&-\frac{1}{\pi}\int^\pi_0\ln(\sin{x})\cos(2nx)\ {\rm d}x
=\frac{1}{4n\pi}\int^\pi_{-\pi}\frac{\sin(2nx)\cos(x)}{\sin{x}}\ {\rm d}x
\end{align}
If we name the remaining integral $\mathcal{I}_n$, it is easy to see that $\mathcal{I}_{n+1}-\mathcal{I}_n=0$. Hence $\mathcal{I}_n=\mathcal{I}_1=2\pi$, and
$$a_n=\frac{2\pi}{4n\pi}=\frac{1}{2n}$$
However, I have trouble calculating $b_n$ and proving that
$$\color{red}{2\int^1_0\ln{\Gamma(x)}\sin(2n\pi x)\ {\rm d}x=\frac{\gamma+\ln(2n\pi)}{\pi n}}$$
The only idea that I can think of is to use the series representation of $\ln{\Gamma(x)}$
\begin{align}
\ln{\Gamma(x)}
=&-\gamma x-\ln{x}+\sum^\infty_{k=1}\left\{\frac{x}{k}-\ln\left(1+\frac{x}{k}\right)\right\}\\
=&-\gamma x-\ln{x}+\sum^\infty_{m=2}\frac{(-1)^m\zeta(m)}{m}x^m
\end{align}
and multiply throughout by $\sin(2n\pi x)$ then integrating term by term. However, arriving to the final result using this method definitely seems arduous. Therefore, I seek your assistance in evaluating the integral in red. Help will be greatly appreciated. Thank you.

REPLY [19 votes]: Random Variable has kindly pointed out that the integral has been evaluated by Cody on this site. Here is a slightly different method of evaluating this integral.
Begin with the infinite product representation of the gamma function.
\begin{align}
\Gamma(x)=\frac{e^{-\gamma x}}{x}\prod^\infty_{k=1}e^\frac{x}{k}\left(1+\frac{x}{k}\right)
\end{align}
Take the logarithm and multiply throughout by $\sin(2n\pi x)$.
\begin{align}
\ln{\Gamma(x)}\sin(2n\pi x)=-(\gamma x+\ln{x})\sin(2n\pi x)+\sum^\infty_{k=1}\left\{\frac{x}{k}-\ln\left(1+\frac{x}{k}\right)\right\}\sin(2n\pi x)
\end{align}
Integrating the non-sum terms from $0$ to $1$,
\begin{align}
\int^1_0(-\gamma x-\ln{x})\sin(2n\pi x)\ {\rm d}x
=&\frac{\gamma}{2n\pi}+\frac{\ln{x}\cos(2n\pi x)}{2n\pi}\Bigg{|}^1_0-\int^1_0\frac{\cos(2n\pi x)}{2n\pi x}{\rm d}x\\
=&\frac{\gamma}{2n\pi}+\left[\frac{\ln{x}\cos(2n\pi x)-{\rm Ci}(2n\pi x)}{2n\pi}\right]^1_0\\
=&\frac{\gamma-{\rm Ci}(2n\pi)}{2n\pi}-\lim_{\epsilon\to 0}\frac{\ln{\epsilon}-{\rm Ci}(2n\pi \epsilon)}{2n\pi}\\
=&\frac{\gamma-{\rm Ci}(2n\pi)}{2n\pi}-\lim_{\epsilon\to 0}\frac{\ln{\epsilon}-\ln(2n\pi)-\ln{\epsilon}-\gamma+\mathcal{O}(\epsilon)}{2n\pi}\\
=&\frac{2\gamma+\ln(2n\pi)-{\rm Ci}(2n\pi)}{2n\pi}
\end{align}
Integrate the remaining terms from $0$ to $1$.
\begin{align}
&\int^1_0\sum^\infty_{k=1}\left\{\frac{x}{k}-\ln\left(1+\frac{x}{k}\right)\right\}\sin(2n\pi x)\ {\rm d}x\\
=&-\frac{1}{2n\pi}\sum^\infty_{k=1}\left\{\frac{1}{k}+{\rm Ci}(2n\pi k+2n\pi)-{\rm Ci}(2n\pi k)-\ln\left(1+\frac{1}{k}\right)\right\}\\
=&-\frac{1}{2n\pi}\left[\sum^\infty_{k=1}\left\{\frac{1}{k}-\ln\left(1+\frac{1}{k}\right)\right\}+\lim_{N\to\infty}\left(\sum^{N+1}_{k=2}{\rm Ci}(2n\pi k)-\sum^{N}_{k=1}{\rm Ci}(2n\pi k)\right)\right]\\
=&-\frac{1}{2n\pi}\left[\gamma+\lim_{N\to\infty}\left({\rm Ci}(2n\pi+2n\pi N)-{\rm Ci}(2n\pi)\right)\right]
=\frac{{\rm Ci}(2n\pi)-\gamma}{2n\pi}
\end{align}
Adding them together,
\begin{align}
\color{red}{\int^1_0\ln{\Gamma(x)}\sin(2n\pi x)\ {\rm d}x}=\frac{2\gamma+\ln(2n\pi)-{\rm Ci}(2n\pi)+{\rm Ci}(2n\pi)-\gamma}{2n\pi}\color{red}{=\frac{\gamma+\ln(2n\pi)}{2n\pi}}
\end{align}
I am looking forward to seeing cleaner and more interesting approaches to this integral.

As an aside, I derived that
$$\int^1_0\psi_0(x+a)\sin(2n\pi x)={\rm Si}(2an\pi)-\frac{\pi}{2}$$
This isn't really related to the problem though.