TITLE: A Binet-like integral $\int_{0}^{1} \left(\frac{1}{\ln x} + \frac{1}{1-x} -\frac{1}{2} \right) \frac{x^s }{1-x}\mathrm{d}x$
QUESTION [12 upvotes]: I met this integral

$$
\int_{0}^{1}
\left(\frac{1}{\ln x} + \frac{1}{1-x} -\frac{1}{2} \right) \frac{ \mathrm{d}x}{1-x} \qquad (*)
$$

while evaluating this log-cosine integral. I made several attemps before being successful.
Find a closed form for

$$
I(s): = \int_{0}^{1}
\left(\frac{1}{\ln x} + \frac{1}{1-x} -\frac{1}{2} \right) \frac{x^s }{1-x}\mathrm{d}x, \quad \Re (s)>-1. \qquad (**)
$$

REPLY [6 votes]: Recall Binet's formula
$$
\log \Gamma(z)= \left( z-\frac{1}{2}\right)\log z - z + \frac{1}{2}\log(2\pi) + 
\int_0^{\infty} \!
\left(\frac{1}{2} - \frac{1}{x} + \frac{1}{e^{x}-1} \right)\frac{e^{-zx}}{x} \mathrm{d}x,\quad \Re z >0
$$ 
which, upon making  $x = - \log v$, can be written as

$$
\log \Gamma(z)= \! \left( z-\frac{1}{2}\right)\log z - z + \frac{1}{2}\log(2\pi) - \!\!
\int_0^{1} \!
\left(\frac{1}{\log v}+\frac{1}{1-v}-\frac{1}{2}\right)\frac{v^{z-1}}{\log v}\mathrm{d}v, \, \Re z >0
$$

and Gauss' formula 

$$
-\psi(z)+\log z = \int_0^{1} \left(\frac{1}{\log v}+\frac{1}{1-v}\right)v^{z-1} \mathrm{d}v.
$$

One may check that
\begin{multline} 
\displaystyle \left(\frac{1}{\log u} + \frac{1}{1-u} - \frac{1}{2} \right) \frac{u^s}{1-u} = u^{s} \frac{d}{du}\left\{u \left(\frac{1}{\log u} + \frac{1}{1-u}\right)\right\} \, \\
+ \left(\displaystyle \frac{1}{\log u} + \frac{1}{1-u} - \frac{1}{2} \right) \frac{u^s}{\log u} - \frac{1}{2} \left(\displaystyle \frac{1}{\log u} + \frac{1}{1-u}\right)u^s. 
\end{multline}
Hence our integral $I(s)$ is the sum of three integrals.
The first,
\begin{multline} 
I_{1}(s) =\displaystyle \left.\left(\frac{1}{\log u} + \frac{1}{1-u} \right)u^{s+1} \right|_{0}^{1} 
- s \int_{0}^{1}\! 
\displaystyle \left(\displaystyle \frac{1}{\log u} + \frac{1}{1-u}\right)u^{s}
\mathrm{d}u,
\end{multline}
using Gauss' formula,
$$
I_{1}(s) = \frac{1}{2} + s \left( \psi(s+1)-\log \left(s+1\right) \right).
$$
The second, applying Binet's formula,
\begin{multline} 
I_{2} (s)= \displaystyle  \int_{0}^{1}\! \left(\displaystyle \frac{1}{\log u} + 
\frac{1}{1-u} -\frac{1}{2} \right) \frac{u^{s}}{\log u} \mathrm{d}u \\
= -\log \Gamma(s+ 1)+ \left(s + 1/2 \right)\log \left(s+ 1 \right) - s - 1 + \frac{1}{2}\ln(2\pi).
\end{multline}
The third, using Gauss' formula once more
\begin{equation} 
I_{3}(s) = - \frac{1}{2} \displaystyle  \int_{0}^{1}\! \left(\displaystyle \frac{1}{\log u} + \frac{1}{1-u}\right)u^{s} \mathrm{d}u  = 
\frac{1}{2}\left( \psi(s+1)-\log \left(s+1\right) \right).
\end{equation}
Consequently, $ I(s)=I_{1}(s)+I_{2}(s)+I_{3}(s)$  is given by

\begin{multline} 
I(s):= \displaystyle \int_0^{1} \left(\frac{1}{\log u}+
\frac{1}{1-u}-\frac{1}{2}\right) \frac{u^s}{1-u} \mathrm{d}u \\
= -\log \Gamma(s+1) + \left( s +\frac{1}{2}\right) \psi(s+1) - s - \frac{1}{2} + \frac{1}{2}\ln(2\pi).
\end{multline}

We have, with $s=0$,

$$
\int_{0}^{1}
\left(\frac{1}{\log x} + \frac{1}{1-x} -\frac{1}{2} \right) \frac{ \mathrm{d}x}{1-x} = -\frac{1}{2}+\frac{1}{2} \ln (2 \pi)-\frac{1}{2} \gamma.
$$