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$$


Using the fact that $\displaystyle\frac1{\log(x)}=-\lim_{n\to\infty}\frac{1/n}{1-x^{1/n}}$ yields $$ \begin{align} &\int_0^1\left(\frac1{1-x}+\frac1{\log(x)}\right)^2\,\mathrm{d}x\\ &=\lim_{n\to\infty}\int_0^1\left(\frac1{1-x}-\frac{1/n}{1-x^{1/n}}\right)^2\,\mathrm{d}x\\ &=\lim_{n\to\infty}\int_0^1\left(\frac1{(1-x)^2}-\frac{2/n}{(1-x)(1-x^{1/n})}+\frac{1/n^2}{(1-x^{1/n})^2}\right)\,\mathrm{d}x\tag{1} \end{align} $$ For each term in the last integral, we can use the power series for the integrand to get $$ \int_0^a\frac1{(1-x)^2}\,\mathrm{d}x =\frac{a}{1-a}\tag{2} $$ $$ \int_0^a\frac1{(1-x)(1-x^{1/n})}\,\mathrm{d}x =\int_0^a\left(\sum_{k=0}^\infty x^{k/n}\left\lfloor\frac{k+n}{n}\right\rfloor\right)\,\mathrm{d}x =\sum_{k=n}^\infty\frac{n}{k}a^{k/n}\left\lfloor\frac{k}{n}\right\rfloor\tag{3} $$ $$ \int_0^a\frac1{(1-x^{1/n})^2}\,\mathrm{d}x =\int_0^a\left(\sum_{k=0}^\infty(k+1)x^{k/n}\right)\,\mathrm{d}x =\sum_{k=n}^\infty (k-n+1)\frac{n}{k}a^{k/n}\tag{4} $$ Combining $(2)$, $(3)$, and $(4)$ as in $(1)$ yields $$ \begin{align} &\int_0^1\left(\frac1{1-x}+\frac1{\log(x)}\right)^2\,\mathrm{d}x\\ &=\lim_{a\to1}\lim_{n\to\infty}\int_0^a\left(\frac1{(1-x)^2}-\frac{2/n}{(1-x)(1-x^{1/n})}+\frac{1/n^2}{(1-x^{1/n})^2}\right)\,\mathrm{d}x\tag{5}\\ &=\lim_{a\to1}\frac{a}{1-a}+\lim_{n\to\infty}\sum_{k=n}^\infty a^{k/n}\left(-\frac2k\left\lfloor\frac{k}{n}\right\rfloor+\frac{k-n+1}{kn}\right)\tag{6}\\ &=\lim_{a\to1}\color{#C00000}{\frac{a}{1-a}+\frac{a}{\log(a)}}+\lim_{n\to\infty}\color{#00A000}{\sum_{k=n}^\infty a^{k/n}\left(-\frac2k\left\lfloor\frac{k}{n}\right\rfloor+\frac{2k-n+1}{kn}\right)}\tag{7}\\ &=\color{#C00000}{\frac12}+\color{#00A000}{\int_1^\infty\left(-\frac2x\lfloor x\rfloor+2-\frac1x\right)\,\mathrm{d}x}\tag{8}\\ &=\frac12+\sum_{k=1}^\infty\left(2-(2k+1)\log\left(\frac{k+1}{k}\right)\right)\tag{9}\\ &=\frac12+\lim_{n\to\infty}2n+\color{#C00000}{2\sum_{k=2}^n\log(k)}-(2n+1)\log(n+1)\tag{10}\\ &=\frac12+\lim_{n\to\infty}2n+\color{#C00000}{\log(2\pi)+(2n+1)\log(n)-2n}-(2n+1)\log(n+1)\tag{11}\\ &=\frac12+\log(2\pi)-\lim_{n\to\infty}(2n+1)\log(1+1/n)\tag{12}\\ &=\log(2\pi)-\frac32\tag{13} \end{align} $$ Explanation:

$(5)$ Apply $(1)$

$(6)$ Apply $(2)$, $(3)$, and $(4)$

$(7)$ $\displaystyle\lim_{n\to\infty}\sum_{k=n}^\infty\frac1na^{k/n} =\lim_{n\to\infty}\frac1n\frac{a}{1-a^{1/n}} =-\frac{a}{\log(a)}$

$(8)$ $\displaystyle\lim_{a\to1}\frac{a}{1-a}+\frac{a}{\log(a)}=\frac12$ and a Riemann Sum

$(9)$ Break the integral into integer intervals

$(10)$ Collapse the telescoping sum

$(11)$ Stirling's Approximation

$(12)$ Arithmetic

$(13)$ $\displaystyle\lim_{n\to\infty}(2n+1)\log(1+1/n)=2$


Here is an another approach:

Let $I$ denote the integral. By the substitution $x = e^{-t}$, we have

\begin{align*} I &= \int_{0}^{\infty} \left\{ \frac{1}{(1-e^{-t})^{2}} - \frac{2}{t(1-e^{-t})} + \frac{1}{t^2} \right\} e^{-t} \, dt \\ &= \int_{0}^{\infty} \left\{ \frac{e^{t}}{(e^{t} - 1)^{2}} - \frac{1}{t^2} \right\} \, dt + \int_{0}^{\infty} \left\{ \frac{1 + e^{-t}}{t^2} - \frac{2}{t(e^{t}-1)} \right\} \, dt. \end{align*}

It is easy to observe that the first integral is

\begin{align*} \int_{0}^{\infty} \left\{ \frac{e^{t}}{(e^{t} - 1)^{2}} - \frac{1}{t^2} \right\} \, dt &= \left[ \frac{1}{t} - \frac{1}{e^{t} - 1} \right]_{0}^{\infty} = -\frac{1}{2}. \end{align*}

We thus focus on the second integral. Associated to it, we introduce

$$ F(s) = \int_{0}^{\infty} \left\{ \frac{1 + e^{-t}}{t^2} - \frac{2}{t(e^{t}-1)} \right\} e^{-st} \, dt. $$

By the twice differentiation, we have

\begin{align*}F''(s) &= \int_{0}^{\infty} \left\{ 1 + e^{-t} - \frac{2t}{(e^{t}-1)} \right\} e^{-st} \, dt \\ &= \frac{1}{s} + \frac{1}{s+1} - 2\sum_{n=1}^{\infty} \frac{1}{(n+s)^2} \\ &= \frac{1}{s} + \frac{1}{s+1} - 2\psi_{1}(s+1). \end{align*}

Integrating and using the condition $F'(+\infty) = 0$, we have

$$ F'(s) = \log s + \log(s+1) - 2\psi_{0}(s+1). $$

Here we used the estimate $\psi_{0}(s) \sim \log s$ as $s \to \infty$. Integrating again, we have

$$ F(s) = s \log s + (s+1)\log(s+1) - 2s - 1 - 2\log\Gamma(s+1) + C. $$

To determine the constant $C$, we rearrange the terms as

$$ F(s) = \left\{ (s+1)\log\left(\frac{s+1}{s}\right) - 1 \right\} + 2\left\{ \left(s+\frac{1}{2}\right)\log s - s - \log\Gamma(s+1) \right\} + C. $$

Then by the Stirling's formula, we have

$$ 0 = F(+\infty) = -\log(2\pi) + C $$

and thus $C = \log (2\pi)$. Therefore

$$I = -\frac{1}{2} + F(0) = \log(2\pi) - \frac{3}{2}$$

as desired.


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} $$

so the integral takes on the value

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

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

The sum may be simplified by Taylor expanding the $\log$ term; note that the unit value cancels and we get that the integral equals

$$ \log{2} + \sum_{k=2}^{\infty} \left [ 1 - k^2 \sum_{m=1}^{\infty} \frac{1}{m} \left ( \frac{1}{k^2} \right )^m \right ] $$

$$ = \log{2} - \sum_{m=1}^{\infty} \frac{1}{m+1} [\zeta{(2 m)}-1] $$

I have not yet evaluated this sum yet, but unless someone else does it before me, I will figure it out and come back.