## Integrals with Log, Part III

This one is an example of teamwork across the M.SE user base. I came up with a substitution and realization into a nifty sum, but got a bit stuck. Another power user, known as @marvis at the time, took over and evaluated the sum to get the correct result. This one was an extremely difficult integral by any measure.

The integral to evaluate is

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

OK, I’m going to lay this out up to a sum, which will likely evaluate into whatever answer was provided above. This integral is subject to the same sorts of tricks that I did for another integral involving a factor of $1/\log{x}$ in the integral. The first piece is to let $x = e^{-y}$; the integral becomes

$$\int_0^{\infty} dy \: e^{-y} \left ( \frac{(e^{-y} – (1-y))^2}{y^2 (1-e^{-y})^2} \right )$$

Now Taylor expand the factor $(1-e^{-y})^{-2}$, and if we can reverse the order of summation and integration, we get:

$$\sum_{k=1}^{\infty} k \int_0^{\infty} dy \: \left ( \frac{(e^{-y} – (1-y))^2}{y^2} \right ) e^{- k y}$$

The integral inside the sum is a bit difficult, although it is convergent. The way I see through it is to replace $k$ with a continuous parameter $\alpha$ and differentiate with respect to $\alpha$ inside the integral twice (to clear the pesky $y^2$ in the denominator) to get a function

$$I(\alpha) = \int_0^{\infty} dy \: \left ( \frac{(e^{-y} – (1-y))^2}{y^2} \right ) e^{- \alpha y}$$

\begin{align} & \frac{\partial^2 I}{\partial \alpha^2} = \int_0^{\infty} dy \: (e^{-y} – (1-y))^2 e^{- \alpha y} \\ & = \frac{1}{\alpha+2} – \frac{2}{\alpha+1} + \frac{2}{(\alpha+1)^2} + \frac{1}{\alpha} – \frac{2}{\alpha^2} + \frac{2}{\alpha^3} \\ \end{align}

You integrate this twice to recover $I(\alpha)$; the constants of integration may be shown to vanish by considering the limit as $\alpha \rightarrow \infty$. The original integral is then

$$\sum_{k=1}^{\infty} k \, I(k)$$

where

$$I(k) = (k+2) \log{ \left [ \frac{k (k+2)}{(k+1)^2} \right ] } + \frac{1}{k}$$

@marvis takes it from here:

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,][1] 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$$