How to prove that $\int_0^1\left(\sum\limits_{k=n}^\infty {x^k\over k}\right)^2\,dx = \int_0^1 2x^{n-1}\log\left(1+{1\over\sqrt{x}}\right)\,dx$

Let $\mathcal{R}_n$ denote the integral on the right-hand-side of eq. (2): $$ \mathcal{R}_n = \int_0^1 2 x^{n-1} \log\left(1+\frac{1}{\sqrt{x}}\right) \mathrm{d}x $$ Consider $$ \begin{eqnarray} (n+1) \mathcal{R}_{n+1} - n \mathcal{R}_n &=& \int_0^1 2 \left( (n+1) x^{n} - n x^{n-1} \right) \log\left(1+\frac{1}{\sqrt{x}}\right) \mathrm{d}x \\ &=& \int_0^1 2 \log\left(1+\frac{1}{\sqrt{x}}\right) \mathrm{d} \left( -x^n \left(1-x\right)\right) \\ &=& \int_0^1 \left(\sqrt{x}-1\right)x^{n-1} \mathrm{d} x = \frac{2}{2n+1} - \frac{1}{n} \end{eqnarray} $$ Therefore: $$ n \mathcal{R}_n = \mathcal{R}_1 + \sum_{m=1}^{n-1} \left( \frac{2}{2m+1} - \frac{1}{m} \right) = \psi\left(n+\frac{1}{2}\right) - \psi(n) + 2 \left(\log(2)-1\right) + \mathcal{R}_1 $$ Integral $\mathcal{R}_1$ can be easily integrated by parts: $$ \mathcal{R}_1 = 2 \int_0^1 \log\left(1+\frac{1}{\sqrt{x}}\right)\mathrm{d} x\stackrel{\text{by parts}}{=} \left. 2\left( x \log\left( 1 + \frac{1}{\sqrt{x}}\right) + \sqrt{x} - \log\left(1+\sqrt{x}\right) \right) \right|_{x \downarrow 0}^{x = 1} = 2 $$ Thus $$ n \mathcal{R}_n = 2 \log(2) + \psi\left(n+\frac{1}{2}\right) - \psi(n) $$

Similarly, denoting $\mathcal{L}_n = \int_0^1 f_n(x)^2 \mathrm{d} x$ the integral on the left-hand-side of eq. (2): $$ \begin{eqnarray} n \left(\mathcal{L}_{n+1} - \mathcal{L}_n\right) &=& \int_0^1 \left( n f_{n+1}(x)^2 - n \left( \frac{x^n}{n} + f_{n+1}(x) \right)^2 \right)\mathrm{d} x \\ &=& \int_0^1 \left( -2 x^n f_{n+1}(x) - \frac{x^{2n}}{n}\right)\mathrm{d} x \\ &=& \color\maroon{2 \int_0^1 x^n \log(1-x) \mathrm{d} x} + {\color\blue{2 \int_0^1 x^n \sum_{k=1}^{n} \frac{x^k}{k} \mathrm{d} x}} - \frac{1}{n(2n+1)} \\ &=& \color\maroon{-\frac{2}{n+1} H_{n+1}} + 2 \sum_{k=1}^n \frac{1}{k(k+n+1)} - \frac{1}{n(2n+1)} \\ &=& \frac{2}{n+1} \left( \psi(n+1) - \psi(2+2n) \right) - \frac{1}{n(2n+1)} \\ &=& \frac{1}{n (n+1)} \left( \psi(n+1)-\psi\left(n+\frac{3}{2}\right)-2 \log (2) \right) -\frac{1}{n^2 (2 n+1)} \end{eqnarray} $$ where $f_n(x) = \sum_{k=n}^\infty \frac{x^k}{k}$. Now since $\mathcal{L}_1 = \int_0^1 \log^2(1-x)\mathrm{d} x = 2$, and since $\mathcal{R}_{n+1} - \mathcal{R}_n$ equals to $\mathcal{L}_{n+1} -\mathcal{L}_n$, we establish that $\mathcal{L}_n = \mathcal{R}_n$: $$ \mathcal{R}_{n+1} - \mathcal{R}_n = 2\log(2) \left( \frac{1}{n+1}- \frac{1}{n} \right) + \frac{1}{n+1} \left( \psi\left(n+\frac{3}{2}\right) - \psi (n+1)\right) - \frac{1}{n} \left( \psi\left(n+\frac{1}{2}\right) - \psi (n)\right) \stackrel{\color\maroon{\text{use recurrence equation for } \psi}}{=} \mathcal{L}_{n+1} - \mathcal{L}_n $$


Here's a way to do it by brute force. First write $$ \begin{align} \int_0^1\left(\sum_{k = n}^\infty \frac{x^k}{k}\right)^2\,dx & = \sum_{k,m\geq n}\frac{1}{km}\int_0^1x^{k+m}\,dx \\ & = \sum_{k,m \geq n} \frac{1}{km(k+m+1)}. \end{align} $$ Put $r = k+m$, so that $m = r-k$, and transform the sum: $$ \begin{align} \sum_{k,m\geq n} \frac{1}{km(k+m+1)} &= \sum_{r = 2n}^\infty \frac{1}{r+1}\sum_{k = n}^{r-n}\frac{1}{k(r-k)} \\ &= \sum_{r = 2n}^\infty \frac{1}{r(r+1)}\sum_{k=n}^{r-n}\left(\frac{1}{k} + \frac{1}{r-k}\right) \\ & = \sum_{r = 2n}^\infty \frac{2}{r(r+1)}\sum_{k = n}^{r-n}\frac{1}{k} \\ & = 2\sum_{r = 2n}^\infty\left(\frac{1}{r}\sum_{k = n}^{r-n}\frac{1}{k} - \frac{1}{r+1}\sum_{k = n}^{r-n}\frac{1}{k}\right) \\ & = 2\sum_{r = 2n}^\infty\left(\frac{1}{r}\sum_{k = n}^{r - n}\frac{1}{k} - \frac{1}{r+1}\sum_{k = n}^{r+1 - n} \frac{1}{k}\right) + 2 \sum_{r = 2n}^\infty \frac{1}{(r+1)(r+1 - n)}. \\ \end{align} $$ The first sum in the last line telescopes, so it can be evaluated as $$ 2\sum_{r = 2n}^\infty \left(\frac{1}{r}\sum_{k = n}^{r - n}\frac{1}{k} - \frac{1}{r+1}\sum_{k = n}^{r+1 - n}\frac{1}{k}\right) = \lim_{r \to \infty} \left(\frac{1}{n^2} - \frac{2}{r+1}\sum_{k = n}^{r+1 - n}\frac{1}{k}\right) = \frac{1}{n^2}. $$ Thus we need to prove that $$ \frac{1}{n^2} + 2\sum_{r = 2n}^\infty \frac{1}{(r+1)(r+1 - n)} = 2\int_0^1 x^{n-1}\log(1+x^{-1/2})\,dx. $$ Since $$ \begin{align} 2\int_0^1 x^{n-1}\log(1+x^{-1/2})\,dx &= 2\int_0^1 x^{n-1}\log(1 + x^{1/2})\,dx - \int_0^1 x^{n-1}\log{x}\,dx \\ & = 2\int_0^1 x^{n-1}\log(1+x^{1/2})\,dx + \frac{1}{n^2}, \end{align} $$ we need only prove that $$ \sum_{r = 2n}^\infty \frac{1}{(r+1)(r+1 - n)} = \int_0^1 x^{n-1}\log{(1+x^{1/2})}\,dx. $$ This can be done by developing $\log{(1+x^{1/2})}$ in powers of $x^{1/2}$: $$ \begin{align} \int_0^1 x^{n-1}\log{(1+x^{1/2})}\,dx & = \sum_{m = 1}^\infty\frac{(-1)^{m+1}}{m} \int_0^1 x^{n- 1 + m/2}\,dx \\ & = 2\sum_{m = 1}^\infty \frac{(-1)^{m+1}}{m(2n+m)} \\ & = 2 \sum_{\text{$m$ odd}} - 2\sum_{\text{$m$ even}} \frac{1}{m(2n+m)} \\ & = 2 \sum - 4\sum_{\text{$m$ even}} \frac{1}{m(2n+m)} \\ & = 2 \sum_{m = 1}^\infty \frac{1}{m(2n+m)} - \sum_{m = 1}^\infty \frac{1}{m(n+m)} \\ & = 2 \sum_{m = 1}^\infty \frac{1}{m}\left(\frac{1}{2n+m} - \frac{1}{2n+2m}\right) \\ & = \sum_{m = 1}^\infty \frac{1}{(2n+m)(n+m)} \\ & = \sum_{r = 2n}^\infty \frac{1}{(r + 1)( r +1 - n)}, \end{align} $$ which proves the identity. The other methods are obviously more concise, but after working through this I couldn't resist posting it.