# Evaluating very nasty logarithmic integrals: Part I

In this post, we’ll continue our exploration of logarithmic integrals and Euler sums. We’ll also discuss the contour integration method for evaluating Euler sums. It is recommended that the reader goes through the previous posts, (A) and (B), before reading this post.

## Integral #1

Our first integral is the following: \begin{aligned} I &= \int_0^1 \frac{\log(t)\log(1-t)\log(1+t)}{t}dt \end{aligned} We will use the integral $J = \int_0^1 \frac{\log(t)\log^2(1-t)}{t}dt$ as a starting point. Make the substitution $t\mapsto t^2$ in $J$ to obtain: \begin{aligned} J &= 2\int_0^1 \frac{\log(t^2) \log^2(1-t^2)}{t}dt \\ &= 4\int_0^1 \frac{\log(t)\log^2(1-t)}{t}dt + 4\int_0^1 \frac{\log(t)\log^2(1+t)}{t}dt + 8\int_0^1 \frac{\log(t)\log(1-t) \log(1+t)}{t}dt \\ &= 4J + 4\int_0^1 \frac{\log(t)\log^2(1+t)}{t}dt + 8I \end{aligned}

Solving the above equation for $I$ gives us: $$I = -\frac{3}{8}J - \frac{1}{2} \int_0^1 \frac{\log(t)\log^2(1+t)}{t}dt \quad \color{blue}{\cdots (1)}$$ Applying integration by parts and using the generating function of the Harmonic number yields: \begin{aligned} \int_0^1 \frac{\log(t)\log^2(1+t)}{t}dt &= -\int_0^1 \frac{\log^2(t)\log(1+t)}{1+t}dt \\ &= -\sum_{n=1}^\infty (-1)^{n+1} H_n \int_0^1 t^{n} \log^2(t) \; dt \\ &= -2\sum_{n=1}^\infty (-1)^{n+1} \frac{H_n}{(n+1)^3} \\ &= -2\sum_{n=0}^\infty (-1)^{n+1} \frac{H_{n+1}-\frac{1}{n+1}}{(n+1)^3} \\ &= 2\sum_{n=1}^\infty (-1)^{n+1} \frac{H_n}{n^3} - 2\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n^4} \\ &= 2\text{Li}_4(-1) + 2\sum_{n=1}^\infty (-1)^{n+1} \frac{H_n}{n^3} \quad \color{blue}{\cdots (2)} \end{aligned} A similar calculation shows that: $$J = 2\zeta(4) - 2\sum_{n=1}^\infty \frac{H_n}{n^3} \quad \color{blue}{\cdots (3)}$$ From (A), we know how to evaluate $\sum_{n=1}^\infty (-1)^{n+1} \frac{H_n}{n^3}$ and $\sum_{n=1}^\infty \frac{H_n}{n^3}$. \begin{aligned} \sum_{n=1}^\infty \frac{H_n}{n^3} &= \frac{\pi^4}{72} \\ \sum_{n=1}^\infty (-1)^{n+1}\frac{H_n}{n^3} &= \frac{11\pi^4}{360}+\frac{\pi^2}{12}\log^2(2)-\frac{\log^4(2)}{12}-\frac{7}{4}\log(2)\zeta(3) -2\text{Li}_4\left(\frac{1}{2}\right) \end{aligned} Finally, putting everything together gives us: $$\boxed{I = -\frac{3\pi^4}{160}-\frac{\pi^2}{12}\log^2(2)+\frac{\log^4(2)}{12}+\frac{7}{4}\log(2)\zeta(3) +2\text{Li}_4\left(\frac{1}{2}\right)}$$

## Integral #2

The next integral on our list is $$K = \int_0^1 \frac{\log(x)\log(1+x^2)\arctan(x)}{x}dx$$ This integral was originally posted by the user FDP on math.stackexchange.com. My solution is posted there as well.

Using integration by parts gives us: $$K = - \frac{1}{2}\int_0^1 \frac{\log^2(x)\log(1+x^2)}{1+x^2}dx - \int_0^1 \frac{x \log^2(x) \arctan(x)}{1+x^2}dx$$ Now, we can use the following series expansions to reduce $K$ into Euler sums: \begin{aligned} \frac{\arctan (x)}{1+x^2} &= \sum_{n=0}^\infty (-1)^n \tilde{H}_n x^{2n+1} , \quad |x| < 1\\ \frac{\log(1+x^2)}{1+x^2} &= \sum_{n=1}^\infty (-1)^{n+1} H_n x^{2n} , \quad |x| < 1 \end{aligned} where $\tilde{H}_n = \sum_{i=0}^n \frac{1}{2i+1}$. This gives us: \begin{aligned} K &= -\sum_{n=0}^\infty (-1)^n \tilde{H}_n\int_0^1 x^{2n+2} \log^2(x)\; dx-\frac{1}{2}\sum_{n=1}^\infty (-1)^{n+1} H_n\int_0^1 x^{2n}\log^2(x)\; dx \\ &= -2\sum_{n=0}^\infty \frac{(-1)^n \tilde{H}_n}{(2n+3)^3} - \sum_{n=1}^\infty \frac{(-1)^{n+1} H_n}{(2n+1)^3} \\ &= -2\sum_{n=1}^\infty \frac{(-1)^{n+1} H_{2n}}{(2n+1)^3} \quad \color{blue}{\cdots (4)} \end{aligned} We’ll employ the contour integration method to evaluate the above Euler sum. It is a very powerful tool that can handle a large class of Euler sums (see, for e.g. Euler sums and contour integral representations by Philippe Flajolet and Bruno Salvy).

We’ll integrate the function $f(z) = \pi \csc(\pi z) \frac{\gamma+\psi_0(-2z+1)}{(-2z+1)^3}$ around the positively oriented square, $C_N$, with vertices $\pm \left(N+\frac{1}{4} \right)\pm \left(N+\frac{1}{4} \right)i$. It is easy to see that $$\lim_{N\to \infty}\int_{C_N}f(z)\; dz = 0$$ Hence, the sum of all residues of $f(z)$ at its poles is equal to $0$. A straightforward computation shows that the residues are: \begin{aligned} \mathop{\text{Res}}\limits_{z=-n} f(z) &= (-1)^n \frac{H_{2n}}{(2n+1)^3} , \quad n\in \{0,1,2,\cdots\} \\ \mathop{\text{Res}}\limits_{z=\frac{2n+1}{2}} f(z) &= \frac{(-1)^{n+1} \pi}{16 n^3} , \quad n\in \{1,2,3,\cdots\} \\ \mathop{\text{Res}}\limits_{z=n} f(z) &= \frac{(-1)^{n+1}H_{2n-1}}{(2n-1)^3}- 3\frac{(-1)^{n+1}}{(2n-1)^4}, \quad n\in \{1,2,3,\cdots \}\\ \mathop{\text{Res}}\limits_{z=\frac{1}{2}} f(z) &= \frac{\pi \zeta(3)}{2} \end{aligned} The list of local expansions of basic kernels given on page 6 of the above mentioned paper are quite useful for carrying out these computations. Now, adding up all the residues gives us: \begin{aligned} \frac{\pi \zeta(3)}{2}+\sum_{n=1}^\infty \frac{(-1)^n H_{2n}}{(2n+1)^3} + \frac{\pi}{16}\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n^3} + \sum_{n=1} ^\infty \frac{(-1)^{n+1}H_{2n-1}}{(2n-1)^3} -3\sum_{n=1}^\infty \frac{(-1)^{n+1}}{(2n-1)^4}&= 0\\ \implies \frac{\pi \zeta(3)}{2}+\sum_{n=1}^\infty \frac{(-1)^n H_{2n}}{(2n+1)^3} + \frac{\pi}{16}\left(\frac{3\zeta(3)}{4} \right) + \sum_{n=1}^\infty \frac{(-1)^n H_{2n}}{(2n+1)^3} -2 \sum_{n=1}^\infty \frac{(-1)^{n+1}}{(2n-1)^4} &= 0 \\ \implies -2\sum_{n=1}^\infty \frac{(-1)^{n+1}H_{2n}}{(2n+1)^3} + \frac{35\pi \zeta(3)}{64} -2\beta(4) = 0 \\ \implies \boxed{\sum_{n=1}^\infty \frac{(-1)^{n+1}H_{2n}}{(2n+1)^3} = -\beta(4) + \frac{35\pi \zeta(3)}{128}} \color{blue}{\cdots (5)} \end{aligned} where $\beta(s) = \sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)^s}$ is the Dirichlet beta function. Finally, plugging equation (5) into (4) gives us: $$\boxed{K = 2\beta(4) - \frac{35\pi \zeta(3)}{64}}$$

Following are some more examples of Euler sums that can be evaluated using the contour integration method: \begin{aligned} \sum_{n=0}^\infty\frac{(-1)^n\psi_2(n+1)}{2n+1} &= 8\beta(4)+\frac{\pi^2}{3}G-\frac{7\pi}{2}\zeta(3) \\ \sum_{n=0}^\infty\frac{(-1)^n\psi_1(n+1)}{(2n+1)^2} &= 6\beta(4)+\frac{\pi^2}{4}G-\frac{7\pi}{4}\zeta(3) \\ \sum_{n=1}^\infty \frac{(-1)^{n+1} H_n}{(2n+1)^3} &= -3\beta(4)+\frac{7\pi}{16}\zeta(3)+\frac{\pi^3}{16}\log(2) \end{aligned} where $G=\beta(2)$ denotes the Catalan’s constant. Some integrals that can be evaluated with the above Euler sums are: \begin{aligned} \int_0^1 \frac{\log^2(x)\arctan(x)}{x\left(1-x^2 \right)}dx &=\beta(4)+\frac{7\pi \zeta(3)}{64}+\frac{\pi^3 \log(2)}{32} \\ \int_0^1\frac{\log(x)\arctan(x)\text{arctanh}(x)}{x}dx &= \frac{\pi^2}{16}G-\frac{7\pi\zeta(3)}{32} \\ \int_0^{\frac{\pi}{2}}\frac{x}{\sin x}\log^2\left(\frac{1+\cos x-\sin x}{1+\cos x+\sin x}\right)dx &= \frac{\pi^2}{6}G +4\beta(4) \end{aligned}

# Euler Sums involving square of Harmonic numbers

In my previous post on Euler sums, we evaluated sums containing $H_n$ and $H_n^{(2)}$. In this post, we’ll derive some further results using the integral $\int_0^x \frac{\log^3(1-t)}{t}dt$. Our starting point is the following generating function identity: $$\sum_{n=1}^\infty (H_n)^2 x^n = \frac{\log^2(1-x)+\text{Li}_2(x)}{1-x} ,\quad -1\leq x < 1$$ This can derived by plugging $H_n = \int_0^1\frac{1-t^n}{1-t}dt$ and interchanging the sum and the integral. We can rewrite the above equation using the fact that $\sum_{n=1}^\infty H_n^{(2)} x^n = \frac{\text{Li}_2(x)}{1-x}$. $$\sum_{n=1}^\infty (H_n)^2 x^n = \frac{\log^2(1-x)}{1-x} + \sum_{n=1}^\infty H_n^{(2)} x^n , \quad -1\leq x < 1 \quad \color{blue}{\cdots (1)}$$

## 1. Evaluation of $\int_0^x \frac{\log^n(1-t)}{t}dt$

In this section, we will derive a formula for the integral $\int_0^x \frac{\log^n(1-t)}{t}dt$ where $n$ is a positive integer. First, we’ll consider the case when $0\leq x < 1$. We have: \begin{aligned} \int_0^x \frac{\log^n (1-t)}{t}dt &= \int_0^{-\log(1-x)} \frac{t^n e^{-t}}{1-e^{-t}}dt \quad (t\mapsto 1-e^{-t}) \\ &= \sum_{j=1}^\infty \int_0^{-\log(1-x)}t^n e^{-jt} dt \\ &= -\sum_{j=1}^\infty \left[e^{-jt}\sum_{i=0}^n \frac{(-1)^{n-i}\log^{n-i}(1-x)}{j^{i+1}}n^{\underline{i}} \right]_0^{-\log(1-x)} \\ &= - \sum_{j=1}^\infty \left( (1-x)^j \sum_{i=0}^n \frac{(-1)^{n-i}\log^{n-i}(1-x)}{j^{i+1}}n^{\underline{i}}-\frac{n!}{j^{n+1}} \right) \\ &= n! \zeta(n+1) + \sum_{i=0}^n (-1)^{n-i+1} n^{\underline{i}}\log^{n-i}(1-x) \text{Li}_{i+1}(1-x) \\ &\quad \color{blue}{\cdots (2)} \end{aligned}

A similar calculation shows that for $-1\leq x < 0$, we have: \begin{aligned} \int_x^0 \frac{\log^n(1-t)}{t}dt &= -\frac{\log^{n+1}(1-x)}{n+1} - n! \zeta(n+1) + \sum_{i=0}^{n} n^{\underline{i}}\log^{n-i}(1-x)\text{Li}_{i+1}\left(\frac{1}{1-x}\right) \\ &\quad \color{blue}{\cdots (3)} \end{aligned}

## 2. Sums with $(H_n)^2$

We can divide equation (1) by $x$ and integrate both sides to get some interesting results. \begin{aligned} \sum_{n=1}^\infty \frac{(H_n)^2}{n}x^n &= -\frac{\log^3(1-x)}{3}-\log(1-x)\text{Li}_2(x)+\text{Li}_3(x), \quad -1\leq x < 1\quad \color{blue}{\cdots (4)} \\ \sum_{n=1}^\infty \frac{(H_n)^2}{n^2}x^n &= \text{Li}_4(x) + \frac{\text{Li}_2^2(x)}{2}-\frac{1}{3}\int_0^x \frac{\log^3(1-t)}{t}dt, \quad -1\leq x \leq 1\quad \color{blue}{\cdots (5)} \end{aligned} Equations (4) was obtained with the help of results from section (4) of this post.

One can now plug in $x=-1$ in equation (5) to get: $$\boxed{\sum_{n=1}^\infty \frac{(H_n)^2}{n^2}(-1)^{n+1} = \frac{41\pi^4}{1440} + \frac{\pi^2 \log^2(2)}{12}-\frac{\log^4(2)}{12}-\frac{7}{4}\log(3)\zeta(3)-2\text{Li}_2\left(\frac{1}{2}\right)}$$ Of course, equation (3) was used to evaluate $\int_{-1}^0 \frac{\log^3(1-t)}{t}dt$.

# The Contour Integration approach to Infinite Series

Today, we will evaluate the series $\sum_{n=0}^\infty \frac{\cot\left(\frac{2n+1}{2}\pi\sqrt{2} \right)}{(2n+1)^3}$ using contour integration. Define $f:\mathbb{C}\to \mathbb{C}$ as $$f(z) = \frac{\pi \tan(\pi z)\tan(\pi z \theta)}{z^3}$$ where the parameter $\theta$ is a positive irrational number. Let $C_N$ denote the positively oriented square with vertices $(N+1)(1+i),\; (N+1)(-1+i),\; (N+1)(-1-i)$ and $(N+1)(1-i)$. With some effort, one can show that: \begin{aligned} \left|\int_{C_N} f(z) dz\right| &\leq \frac{4\pi}{(N+1)^2} \left(|\tan((N+1)\pi \theta)| + \frac{1}{|\tanh((N+1)\pi) \tanh((N+1)\pi \theta)|}\right) \end{aligned} By Weyl’s equidistribution theorem, the sequence $\{(N+1)\theta \}_{N=1}^\infty$ is equidistributed modulo 1. Therefore, we can choose a subsequence $\{(N_k+1) \theta\}_{k=1}^\infty$ such that $|\tan(\pi (N_k+1) \theta)|$ remains bounded. It follows that: $$\lim_{k\to \infty}\int_{C_{N_k}} f(z)\; dz = 0$$ On the other hand, Residue theorem gives us: $$\frac{1}{2\pi i}\int_{C_{N_k}} f(z) dz = \substack{\displaystyle \text{Res} \\ z=0}f(z) + \sum_{i=-{N_k}}^{N_k} \substack{\displaystyle \text{Res} \\ z=\frac{2i+1}{2}}f(z) + \sum_{|j+\frac{1}{2}|\leq \theta (N_k+1)} \substack{\displaystyle \text{Res} \\ z=\frac{2j+1}{2\theta}}f(z)$$

This means that the sum of residues of $f(z)$ at it’s poles is equal to zero. A simple calculation shows that: \begin{aligned} \substack{\displaystyle \text{Res} \\ z=0}f(z) &= \pi^3 \theta \\ \substack{\displaystyle \text{Res} \\ z=\frac{2n+1}{2}}f(z) &= -8\frac{\tan\left(\frac{\pi \theta}{2}(2n+1) \right)}{(2n+1)^3}, \quad n\in \{0,1,2,\cdots\}\\ \substack{\displaystyle \text{Res} \\ z=\frac{2n+1}{2\theta}}f(z) &= -8\theta^2 \frac{\tan\left(\frac{\pi}{2\theta}(2n+1) \right)}{(2n+1)^3} , \quad n\in \{0,1,2,\cdots\} \end{aligned} Finally, putting everything together gives us the relation: $$\sum_{n=0}^\infty \frac{\tan\left(\frac{\pi \theta}{2}(2n+1) \right)}{(2n+1)^3} + \theta^2 \sum_{n=0}^\infty \frac{\tan\left(\frac{\pi}{2\theta}(2n+1) \right)}{(2n+1)^3} = \frac{\pi^3 \theta}{16}$$ The final result is obtained by substituting $\theta = \sqrt{2}+1$ in the above equation. $$\boxed{\sum_{n=0}^\infty \frac{\cot\left(\frac{2n+1}{2}\pi\sqrt{2} \right)}{(2n+1)^3} = -\frac{\pi^3}{32\sqrt{2}}}$$