# Evaluate $\int_0^1\left(\frac{1}{\ln x} + \frac{1}{1-x}\right)^2 \mathrm dx$

Evaluate
$$\int_0^1\left(\frac{1}{\ln x} + \frac{1}{1-x}\right)^2 \mathrm dx$$

As @rlgordonma has let us make use of the substitution $x = e^{-y}$ to get the integral as
$$\int_0^{\infty} dy e^{-y} \left ( \frac{(e^{-y} – (1-y))^2}{y^2 (1-e^{-y})^2} \right )$$
which can be rewritten as $$\sum_{k=1}^{\infty} k \int_0^{\infty} dy \left ( \frac{(e^{-y} – (1-y))^2}{y^2} \right ) e^{- k y}$$
If we call $$\int_0^{\infty} dy \left ( \frac{(e^{-y} – (1-y))^2}{y^2} \right ) e^{- k y} = I(k)$$ as @rlgordonma has, we get that
$$I(k) = (k+2) \log{ \left( \frac{k (k+2)}{(k+1)^2} \right )} + \frac{1}{k}$$
and we want to hence evaluate $$\sum_{k=1}^{\infty} k I(k).$$
Let us write down the first few terms to see what happens
$$kI(k) = 1 + k(k+2) \log(k) + k(k+2) \log(k+2) – 2 k(k+2) \log(k+1)$$
$$1I(1) = 1 + 3 \log(1) + 3 \log(3) – 6 \log(2)$$
$$2I(2) = 1 + 8 \log(2) + 8 \log(4) – 16 \log(3)$$
$$3I(3) = 1 + 15 \log(3) + 15 \log(5) – 30 \log(4)$$
$$4I(4) = 1 + 24 \log(4) + 24 \log(6) – 48 \log(5)$$
$$5I(5) = 1 + 35 \log(5) + 35 \log(7) – 70 \log(6)$$
We see that $$I(1) +2I(2) +3 I(3) + 4I(4) + 5I(5) = 5 + 2(\log 2 + \log 3 + \log 4 + \log 5) -46 \log 6 + 35 \log 7$$
So we see that if we sum upto $n$ terms, we will get a sum of the form $$n + 2 \log(n!) + (\cdot) \log(n+1) + (\cdot) \log(n+2)$$ and then we can call our good old reliable friend, Stirling, to help us with $\log(n!)$. Let us now proceed along these lines. We get
$$S_n = \sum_{k=1}^n k I(k) = \sum_{k=1}^{n} \left(1 + k(k+2) \log(k) + k(k+2) \log(k+2) – 2 k(k+2) \log(k+1) \right)$$
$$S_n = n + \sum_{k=1}^n \overbrace{\left(k(k+2) + (k-2)k – 2(k-1)(k+1) \right)}^2\log(k)\\ + ((n-1)(n+1)-2n(n+2)) \log(n+1) + (n(n+2)) \log(n+2)$$
$$S_n = n + 2 \sum_{k=1}^n \log(k) – (n^2 + 4n + 1) \log(n+1) + (n^2 + 2n) \log(n+2)$$
$$\sum_{k=1}^n \log(k) = n \log n – n + \dfrac12 \log(2 \pi) + \dfrac12 \log(n) + \mathcal{O}(1/n) \,\,\,\,\,\, \text{(By Stirling)}$$
Hence,
$$S_n = \overbrace{2 n \log n – n + \log(2 \pi) – (n^2 + 4n + 1) \log(n+1) + (n^2 + 2n) \log(n+2) + \log(n)}^{M_n} + \mathcal{O}(1/n)$$
The asymptotic for $M_n$ can now be simplified further by writing $$\log(n+1) = \log (n) + \log \left(1 + \dfrac1n \right)$$
and
$$\log(n+2) = \log (n) + \log \left(1 + \dfrac2n \right)$$
and using the Taylor series for $\log \left(1 + \dfrac1n \right)$ and $\log \left(1 + \dfrac2n \right)$.
$$M_n = \log(2 \pi) – \dfrac32 – \dfrac2{3n} + \dfrac3{4n^2} – \dfrac{17}{15n^3} + \mathcal{O}\left(\dfrac1{n^4}\right)$$
Now, letting $n \to \infty$ gives us
$$\log(2 \pi) – \dfrac32$$