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

-
Isn't it an improper one? +1. – Babak S. Jan 18 '13 at 14:09
This is not actually an improper integral. The integrand decreases from $1$ to $\frac14$ as $x$ goes from $0$ to $1$. – robjohn Dec 19 '14 at 2:34
@robjohn yeah, right. I probably misinterpreted a limit. – user 1618033 Dec 19 '14 at 7:25

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

-
Nice job! That fills in the gap (although I still want to work from that other sum directly). – Ron Gordon Jan 18 '13 at 21:18
@rlgordonma What is the other sum? This is the sum you had as well. – user17762 Jan 18 '13 at 21:19
@Chris'ssister I think I asked you back sometime as well. Where do get these cool/challenging/interesting problems/integrals from? – user17762 Jan 18 '13 at 21:39
@Marvis: I get it now. You appreciated that seeing a $\log{2 \pi}$ meant that you knew to look for a factor of $\log{n!}$ and this guided you accordingly. Good stuff, love the teamwork. – Ron Gordon Jan 18 '13 at 21:43
@rlgordonma Yes. Teamwork - That's one of the many things, I love about this site. – user17762 Jan 18 '13 at 22:18

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$

-
A very interesting and nice solution. Thank you! And short! – user 1618033 Jan 19 '13 at 11:12
A very interesting approach! Approximating logarithm as a limit of certain sequence of rational functions seems a powerful and illuminating method! Of course +1 upvote! – Sangchul Lee Jan 20 '13 at 12:06
would the downvoter care to comment? – robjohn Dec 19 '14 at 2:20

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.

-
thank you for your answer! Nice and fast (+1) – user 1618033 Jan 18 '13 at 21:52
@Chris'ssister, I thank you for this nice problem, too. I always enjoy your problems. :) – Sangchul Lee Jan 18 '13 at 21:59
Glad to hear that! :-) And I always have something nice to learn from your answers. – user 1618033 Jan 18 '13 at 22:01

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.

-
Turns out...the sum does NOT diverge! It is far from obvious, but $I(k) \sim 1/(2 k^3)$ as $k \rightarrow \infty$, so the sum goes as $1/k^2$, which does indeed converge by the comparison test. See for yourself: wolframalpha.com/input/… – Ron Gordon Jan 18 '13 at 16:28
Ooops. Yes, you're right! Moreover, it tends to the value specified by GEdgar. – user 1618033 Jan 18 '13 at 16:38
I'm on it...it is pretty cool. Updates soon... – Ron Gordon Jan 18 '13 at 16:39
@Chris'ssister: almost there: wolframalpha.com/input/… – Ron Gordon Jan 18 '13 at 16:58
@rlgorgonma: the last sum is fascinating as well. At this moment I don't know what I should do with it but still thinking on it. – user 1618033 Jan 18 '13 at 17:01

$$\int_0^1\left(\frac{1}{\log x} + \frac{1}{1-x}\right)^2\;dx = \log(2\pi) - \frac{3}{2} \approx 0.3378770664$$

-
Nice! How would one derive this? – nbubis Jan 18 '13 at 15:25
I get the same thing, but I used Mathematica and the Inverse Symbolic Calculator. I am working on something more satisfying. – robjohn Jan 18 '13 at 16:18
If it involves $\log(2\pi)$, then it must be about $\zeta'(0)$, right? – GEdgar Jan 18 '13 at 17:31
@GEdgar: I finally completed my derivation, and in mine, $\log(2\pi)$ came from Stirling's Approximation. – robjohn Jan 19 '13 at 10:22

Ron:

I am not trying to be pretentious, and I realize this is an old post, but if I may offer a little input on the evaluation of your zeta sum. If I can assume you're still interested at this point.

I believe it was Choi who has done research on these series.

Using the Barnes G function, many series involving zeta have been evaluated.

Here is a little. The G represents the Barnes G function. The derivation of this can probably be found by searching for Choi's papers on the matter.

$\displaystyle \sum_{k=1}^{\infty}\frac{\zeta(2k)-1}{k+1}=\frac{-1}{2}log(2\pi)+1/2-\log(2)-\int_{0}^{1}log[G(t+2)]dt+\int_{0}^{1}log[G(t+1)]dt$

Note that $\displaystyle\int_{0}^{1}log[G(t+2)]dt=log(2\pi)-1+C$

$\displaystyle\int_{0}^{1}log[G(t+1)]dt=\frac{1}{2}log(2\pi)+C$

Putting this together we find the C cancels and we arrive at the result of $\displaystyle\frac{3}{2}-log(\pi)$

So, taking your log(2) and subtracting this from it:

$\displaystyle log(2)-(3/2-log(\pi))=log(2\pi)-3/2$ as required.

A working knowledge of the Barnes G function will allow one to evaluate some tough series, especially involving log Gamma or zeta.

-
Thanks, Cody. Always interested in solving mysteries. I hope you took a look at Marvis's accepted solution, it really was a stroke of genius. Can you please provide a good link to the Barnes G function and perhaps some background material? I am not yet familiar with this stuff; hence, my difficulty. – Ron Gordon May 17 '13 at 13:57
Ron, I found the paper I was thinking of: google.com/… – Cody May 17 '13 at 15:04
Oh, btw, when you say Marvis, do you mean user17762?. Marvis has many ingenious solutions that I have seen. I just wish I could follow them all :) – Cody May 17 '13 at 15:06
Cody: yes, that is who I meant. I think he was an undergrad (or still is?) when he put that together - impressive! The paper looks very interesting - thanks - and I will have a read of it at my leisure. Which is what M.SE is to me - leisure. My job has very little to do with math, so this is all fun. – Ron Gordon May 17 '13 at 15:09

A bit late to the party, but here is a slightly different approach that doesn't use any series, Stirling's approximations or anything, though does make use of some values of the zeta function.

First substitute $x=e^{-y}$ to get

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

The integrand is awkward because when you multiply it out, the pieces separately diverge. Multiplying it by $y^z$ regulates the singularity at 0 but also gives standard integrals. So for $Re(z)>1$ we have (by parts)

$$\int_0^\infty \frac{1}{(1-e^{-y})^2}e^{-y}y^zdy=z\int_0^\infty \frac{e^{-y}}{1-e^{-y}}y^{z-1}dy=z\zeta(z)\Gamma(z)$$

and

$$\int_0^\infty \frac{1}{y(1-e^{-y})}e^{-y}y^zdy=\zeta(z)\Gamma(z)$$

$$\int_0^\infty \frac{1}{y^2}e^{-y}y^zdy=\Gamma(z-1)$$

Putting the bits together:

$$\int_0^\infty \left(\frac{1}{1-e^{-y}}-\frac{1}{y}\right)^2 e^{-y}y^zdy = \Gamma(z)\left(\frac{1}{z-1}+(z-2)\zeta(z)\right)$$

The derivation was valid for $Re(z)>1$, but both sides of the above equation are analytic for $Re(z)>-1$ (RHS has a removable singularity at $z=0$), so by analytic continuation we may take the limit $z\to0$. Near $z=0$, $\Gamma(z)=1/z+O(1)$, and the final answer is the derivative of $1/(z-1)+(z-2)\zeta(z)$ at 0, i.e.,

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

-
Like a boss ! :-$)$ – Lucian Feb 19 at 12:32

@RonGordon last sum becomes: \begin{align} &\sum_{k = 1}^{\infty}\left\{ 1 + \left(k + 1\right)^{2}\log\left(1 - {1 \over \left[k + 1\right]^2}\right) \right\}= \sum_{k = 1}^{\infty}\left\{ 1 - \left(k + 1\right)^{2} \int_{0}^{1}{{\rm d}x \over \left(k + 1\right)^{2} - x}\right\} \\[3mm]&= -\left[\int_{0}^{1}\sum_{k = 1}^{\infty}{1 \over \left(k + 1\right)^{2} - x}\right] \,x\,{\rm d}x = -\left[\int_{0}^{1}\sum_{k = 0}^{\infty} {1 \over \left(k + 2 + x^{1/2}\right)\left(k + 2 - x^{1/2}\right)}\right] \,x\,{\rm d}x \\[3mm]&= \int_{0}^{1}{ \Psi\left(2 - x^{1/2}\right) - \Psi\left(2 + x^{1/2}\right) \over 2x^{1/2}}\,x \,{\rm d}x = \underbrace{\int_{0}^{1} \color{#c00000}{\left\lbrack\Psi\left(2 - x\right) - \Psi\left(2 + x\right)\right\rbrack}\,x^{2}\,{\rm d}x} _{\displaystyle{\log\left(\pi\right) - {3 \over 2}}} \end{align}

since \begin{align} &\color{#c00000}{\Psi\left(2 - x\right) - \Psi\left(2 + x\right)} =\left[\Psi\left(1 - x\right) + {1 \over 1 - x}\right] - \left[\Psi\left(x\right) + {1 \over 1 + x} + {1 \over x}\right] \\[3mm]&=\left[\Psi\left(1 - x\right) - \Psi\left(x\right) - {1 \over x}\right] +{2x \over 1 - x^{2}} =\color{#c00000}{\left[\pi\cot\left(\pi x\right) - {1 \over x}\right] + {2x \over 1 - x^{2}}} \end{align}

Sorry. It was too long for a comment !!!

-
Good job there! (+1) – user 1618033 May 8 '14 at 17:07