## bookmark_borderEvaluating very nasty logarithmic integrals: Part III

This is part 3 of our series on very nasty logarithmic integrals. Please have a look at part 1 and part 2 before reading this post.

## Integral #5

The first integral that we will evaluate in this post is the following: $$I_1 = \int_0^1 \frac{\log^2(x) \arctan(x)}{1+x^2}dx$$ Of course, one can use brute force methods to find a closed form anti-derivative in terms of polylogarithms. Instead, a more elegant solution is possible by contour integration.

We’ll integrate the principal branch of $f(z) = \frac{\arctan(z)}{1+z^2}\left(\text{arctanh}^2(z) + \frac{\pi^2}{16} \right)$ around the following contour:

where

• $\gamma_{3,\epsilon}$ is an arc parameterized by $e^{it}$, where $\arctan\left(\frac{\epsilon \sqrt{4-\epsilon^4}}{2-\epsilon^2} \right)\leq t \leq \frac{\pi}{2} - \arctan\left(\frac{\epsilon \sqrt{4-\epsilon^4}}{2-\epsilon^2} \right)$.
• $\gamma_{2,\epsilon}$ and $\gamma_{4,\epsilon}$ are circular indents of radius $\epsilon$ around the branch points at $z=1$ and $z=i$, respectively.
• $\gamma_{1,\epsilon}$ is a straight line joining $0$ and $1-\epsilon$.
• $\gamma_{4,\epsilon}$ is a straight line joining $(1-\epsilon)i$ and $0$.
Note that $f$ is analytic on $|z| < 1$. It is easy to see that \begin{aligned} \lim_{\epsilon\to 0^+} \int_{\gamma_{2,\epsilon}}f(z)\; dz &= 0 \\ \lim_{\epsilon\to 0^+} \int_{\gamma_{4,\epsilon}}f(z)\; dz &= 0 \end{aligned} On $\gamma_{1,\epsilon}$, we have \begin{aligned} \lim_{\epsilon\to 0^+} \int_{\gamma_{1,\epsilon}} f(z)\; dz &= \int_0^1\frac{\arctan(x)}{1+x^2}\left(\text{arctanh}^2(x) + \frac{\pi^2}{16} \right)dx \\ &= \int_0^1\frac{\arctan(x) \text{arctanh}^2(x) }{1+x^2}dx + \frac{\pi^2}{16} \frac{\arctan^2(x)}{2}\Big|_0^1 \\ &= \frac{1}{4}\int_0^1 \frac{\arctan\left(\frac{1-x}{1+x} \right)\log^2(x)}{1+x^2}dx + \frac{\pi^4}{512} \quad \left(x\mapsto \frac{1-x}{1+x} \right) \\ &= \frac{1}{4}\int_0^1 \frac{\left(\frac{\pi}{4}-\arctan(x) \right)\log^2(x)}{1+x^2}dx + \frac{\pi^4}{512} \\ &= -\frac{I_1}{4} +\frac{\pi}{16}\int_0^1 \frac{\log^2(x)}{1+x^2}dx +\frac{\pi^4}{512} \\ &= -\frac{I_1}{4} + \frac{3\pi^4}{512}\quad \color{blue}{\cdots (1)} \end{aligned} Here, we used the fact that $\int_0^1 \frac{\log^2(x)}{1+x^2}dx = \frac{\pi^3}{16}$. Similarly, on $\gamma_{4,\epsilon}$ we have \begin{aligned} \lim_{\epsilon\to 0^+} \int_{\gamma_{5,\epsilon}} f(z) \; dz &= \int_i^0 \frac{\arctan(x)}{1+x^2}\left(\text{arctanh}^2(x) + \frac{\pi^2}{16} \right)dx \\ &= \int_0^1 \frac{\text{arctanh}(x)}{1-x^2}\left(\frac{\pi^2}{16}-\arctan^2(x) \right)dx \quad \left(x\mapsto i x \right) \\ &= \int_0^1\frac{\arctan(x) \text{arctanh}^2(x) }{1+x^2}dx \quad (\text{IBP}) \\ &= -\frac{I_1}{4}+\frac{\pi^4}{256} \quad \color{blue}{\cdots (2)} \end{aligned}

For the integral over $\gamma_{3,\epsilon}$, we will take advantage of the following identities: \begin{aligned} \arctan(e^{i\theta}) &= \frac{\pi}{4}+\frac{i}{2} \log\left(\frac{1+\tan \frac{\theta}{2}}{1-\tan \frac{\theta}{2}} \right), \quad 0\leq \theta \leq \frac{\pi}{2} \\ \text{arctanh}(e^{i\theta}) &= -\frac{1}{2}\log \left(\tan\frac{\theta}{2} \right)+\frac{i\pi}{4}, \quad 0\leq \theta \leq \frac{\pi}{2}\\ \end{aligned} We have \begin{aligned} \lim_{\epsilon\to 0^+} \int_{\gamma_{3,\epsilon}}f(z) \; dz &= i \int_0^{\frac{\pi}{2}}f(e^{i\theta}) e^{i\theta} \; d\theta \\ &= \frac{i}{2} \int_0^{\frac{\pi}{2}}\frac{\left( \frac{\pi}{4}+\frac{i}{2} \log\left(\frac{1+\tan \frac{\theta}{2}}{1-\tan \frac{\theta}{2}} \right)\right)\left( -\frac{i\pi}{4}\log \left(\tan\frac{\theta}{2} \right)+\frac{1}{4}\log^2\left(\tan \frac{\theta}{2} \right) \right)}{\cos \theta}d\theta \end{aligned} The real part of the above integral is \begin{aligned} \text{Re}\left[\lim_{\epsilon\to 0^+} \int_{\gamma_{3,\epsilon}}f(z) \; dz \right] &= \int_0^\frac{\pi}{2} \frac{\frac{1}{16}\log^2\left(\tan\frac{\theta}{2} \right)\log\left(\frac{1-\tan \frac{\theta}{2}}{1+\tan \frac{\theta}{2}} \right)+\frac{\pi^2}{32}\log\left(\tan\frac{\theta}{2} \right)}{\cos \theta} d\theta \\ &= \int_0^1 \frac{\frac{1}{8}\log^2\left(u \right)\log\left(\frac{1-u}{1+u} \right)+\frac{\pi^2}{16}\log\left(u \right)}{1-u^2} du \quad \left(u= \tan\frac{\theta}{2} \right) \\ &= -\frac{1}{8} \int_0^1 \frac{\log^2(u)\log\left(\frac{1+u}{1-u}\right)}{1-u^2} + \frac{\pi^2}{16}\left(-\frac{\pi^2}{8} \right) \\ &= \frac{1}{16}\int_0^1 \frac{\log(u) \log^2\left(\frac{1-u}{1+u} \right)}{u}du - \frac{\pi^4}{128} \quad \color{blue}{\cdots (3)} \end{aligned} Using the results from part 1, we get \begin{aligned} \int_0^1 \frac{\log(u)\log^2\left(\frac{1-u}{1+u} \right)}{u}du &= \frac{7}{4}\int_0^1 \frac{\log(u)\log^2(1-u)}{u}du + 2\int_0^1 \frac{\log(u)\log^2(1+u)}{u}du \\ &= \frac{7}{4}\left(2\zeta(4) - 2\sum_{n=1}^\infty \frac{H_n}{n^3} \right)+2\left(2\text{Li}_4(-1)+2\sum_{n=1}^\infty\frac{(-1)^{n+1} H_n}{n^3} \right) \\ &= -\frac{7\pi^4}{144}+4\sum_{n=1}^\infty \frac{(-1)^{n+1}H_n}{n^3} \end{aligned} By Cauchy’s integral theorem, the sum of (1), (2) and (3) is equal to zero. Therefore, \begin{aligned} &\; -\frac{I_1}{2} + \frac{5\pi^4}{512}+\frac{1}{16}\left(-\frac{7\pi^4}{144}+4 \sum_{n=1}^\infty \frac{(-1)^{n+1}H_n}{n^3}\right)-\frac{\pi^4}{128} = 0 \\ &\implies I_1 = -\frac{5\pi^4}{2304}+\frac{1}{2}\sum_{n=1}^\infty (-1)^{n+1}\frac{H_n}{n^3} \\ &\implies I_1 = -\frac{5\pi^4}{2304}+\frac{1}{2}\left(\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)\right) \\ &\implies \boxed{I_1 = \frac{151 \pi ^4}{11520}+\frac{\pi ^2}{24} \log ^2(2)-\frac{\log ^4(2)}{24} -\frac{7}{8} \zeta (3) \log (2)-\text{Li}_4\left(\frac{1}{2}\right)} \end{aligned} Refer to this post for the evaluation of $\sum_{n=1}^\infty (-1)^{n+1}\frac{H_n}{n^3}$.

## Integral #6

The next integral that we’ll evaluate is $$I_2 = \int_0^1 \frac{\log^3(x) \arctan(x)}{1+x^2}dx \quad \color{blue}{\cdots (4)}$$ Using the transformation $x\mapsto \frac{1}{x}$, we write the integral as: \begin{aligned} I_2 &= -\int_1^\infty\frac{\log^3(x)\left(\frac{\pi}{2}-\arctan(x) \right)}{1+x^2}dx \quad \color{blue}{\cdots (5)} \end{aligned} Adding up equations (4) and (5) and dividing both sides by 2 gives us: \begin{aligned} I_2 &= -\frac{\pi}{4}\int_1^\infty \frac{\log^3(x)}{1+x^2}dx + \frac{1}{2}\int_0^\infty \frac{\log^3(x) \arctan(x)}{1+x^2}dx\\ &= \frac{\pi}{4}\int_0^1 \frac{\log^3(x)}{1+x^2}dx + \frac{1}{2}\int_0^\infty \frac{\log^3(x) \arctan(x)}{1+x^2}dx \end{aligned} Note that \begin{aligned} \int_0^1 \frac{\log^3(x)}{1+x^2}dx &= \sum_{n=0}^\infty (-1)^n \int_0^1 x^{2n}\log^3(x) \; dx \\ &= -6\sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)^4} \\ &= -6\beta(4) \end{aligned} So, we have $$I_2 = - \frac{3\pi}{2}\beta(4) + \frac{1}{2}\int_0^\infty \frac{\log^3(x) \arctan(x)}{1+x^2}dx \quad \color{blue}{\cdots (6)}$$ To evaluate the integral in the above equation, we will use the Feynman technique. Define the function $F:\mathbb{R}_{> 0}\to \mathbb{R}$ as $F(s) = \int_0^\infty \frac{\log^3(x)\arctan(s x)}{1+x^2}dx$. Now, we have $$F'(s) = \int_0^\infty \frac{x \log^3(x)}{(1+x^2)(1+s^2 x^2)}dx$$ Before evaluating $F'(s)$, we will evaluate the simpler integral $\int_0^\infty \frac{x \log(x)}{(1+x^2)(1+s^2 x^2)}dx$. To do this, integrate the principal branch of $g(z) = \frac{z\log^2(-z)}{(1+z^2)(1+s^2 z^2)}$ around the following “key hole” contour:

where:

• $\gamma_{1,\epsilon, R}$ is a line joining the points $\sqrt{R^2-\epsilon^2}-i\epsilon$ and $-i\epsilon$.
• $\gamma_{2,\epsilon, R}$ is a line joining the points $i\epsilon$ and $\sqrt{R^2-\epsilon^2}+i\epsilon$.
• $\gamma_{3,\epsilon}$ is parameterized by $\epsilon e^{-i t}$ where $\frac{\pi}{2} \leq t \leq \frac{3\pi}{2}$.
• $\gamma_{4,R}$ is parameterized by $R e^{i t}$ where $\arctan\left(\frac{\epsilon}{\sqrt{R^2-\epsilon^2}} \right) \leq t \leq 2\pi - \arctan\left(\frac{\epsilon}{\sqrt{R^2-\epsilon^2}} \right)$.
As $\epsilon\to 0^+$ and $R\to \infty$, the integrals along $\gamma_{3,\epsilon}$ and $\gamma_{4,R}$ tend to 0. Therefore, we are only left with the integrals above and below the branch cut. The residues of $g(z)$ at it’s poles is given by: \begin{aligned} \mathop{\text{Res}}\limits_{z=i} \; g(z) &= -\frac{\pi^2}{8(1-s^2)} \\ \mathop{\text{Res}}\limits_{z=-i} \; g(z) &= -\frac{\pi^2}{8(1-s^2)} \\ \mathop{\text{Res}}\limits_{z=i/s} \; g(z) &= -\frac{\left(\log(s)+\frac{i\pi}{2} \right)^2}{2(1-s^2)} \\ \mathop{\text{Res}}\limits_{z=-i/s} \; g(z) &= -\frac{\left(\log(s)-\frac{i\pi}{2} \right)^2}{2(1-s^2)} \end{aligned} Now, the residue theorem gives us: \begin{aligned} &\; \int_0^\infty \frac{x\left((\log (x)-i\pi)^2 - (\log (x)+i\pi)^2 \right)}{(1+x^2)(1+s^2 x^2)}dx = 2i\pi \left(\mathop{\text{Res}}\limits_{z=i} \; g(z)+ \mathop{\text{Res}}\limits_{z=-i}\; g(z) + \mathop{\text{Res}}\limits_{z=i/s}\; g(z) + \mathop{\text{Res}}\limits_{z=-i/s}\; g(z) \right) \\ &\implies -4i\pi \int_0^\infty \frac{x\log(x)}{(1+x^2)(1+s^2 x^2)}dx = -2i\pi \frac{\log^2(s)}{1-s^2} \\ &\implies \boxed{\int_0^\infty \frac{x\log(x)}{(1+x^2)(1+s^2 x^2)}dx = \frac{\log^2(s)}{2(1-s^2)} }\quad \color{blue}{\cdots (7)} \end{aligned} To evaluate $F'(s)$, we can integrate the principal branch of $h(z) = \frac{z \log^4(-z)}{(1+z^2)(1+s^2 z^2)}$ around the same contour. This time, the residues are: \begin{aligned} \mathop{\text{Res}}\limits_{z=i} \; h(z) &= \frac{\pi^4}{32(1-s^2)} \\ \mathop{\text{Res}}\limits_{z=-i} \; h(z) &= \frac{\pi^4}{32(1-s^2)} \\ \mathop{\text{Res}}\limits_{z=i/s} \; h(z) &= -\frac{\left(\log(s)+\frac{i\pi}{2} \right)^4}{2(1-s^2)} \\ \mathop{\text{Res}}\limits_{z=-i/s} \; h(z) &= -\frac{\left(\log(s)-\frac{i\pi}{2} \right)^4}{2(1-s^2)} \end{aligned} The residue theorem gives us: \begin{aligned} &\; \int_0^\infty \frac{x\left((\log (x)-i\pi)^4 - (\log (x)+i\pi)^4 \right)}{(1+x^2)(1+s^2 x^2)}dx = 2i\pi \left(\mathop{\text{Res}}\limits_{z=i} \; h(z)+ \mathop{\text{Res}}\limits_{z=-i}\; h(z) + \mathop{\text{Res}}\limits_{z=i/s}\; h(z) + \mathop{\text{Res}}\limits_{z=-i/s}\; h(z) \right) \\ &\implies -8i\pi \int_0^\infty \frac{x\left(\log^3(x) -\pi^2 \log(x) \right)}{(1+x^2)(1+s^2 x^2)}dx = 2i\pi \frac{\frac{3\pi^2}{2}\log^2(s)-\log^4(s)}{1-s^2} \\ &\implies \boxed{\int_0^\infty \frac{x\log^3(x)}{(1+x^2)(1+s^2 x^2)}dx = \frac{\pi^2\log^2(s)+2\log^4(s)}{8(1-s^2)} }\quad \color{blue}{\cdots (8)} \end{aligned} Note that we used equation (7) to the get the above result. We can now calculate our original integral as follows: \begin{aligned} I_2 &= -\frac{3\pi}{2}\beta(4) + \frac{1}{2}\int_0^1 F'(s) ds \\ &= -\frac{3\pi}{2}\beta(4) + \frac{1}{2}\int_0^1 \frac{\pi^2\log^2(s)+2\log^4(s)}{8(1-s^2)} ds \\ &= -\frac{3\pi}{2}\beta(4) + \frac{\pi^2}{16}\int_0^1\frac{\log^2(s)}{1-s^2}ds+\frac{1}{8}\int_0^1 \frac{\log^4(s)}{1-s^2} ds \\ &= -\frac{3\pi}{2}\beta(4) + \frac{\pi^2}{16}\sum_{k=0}^\infty\int_0^1 s^{2k}\log^2(s)ds+\frac{1}{8}\sum_{k=0}^\infty\int_0^1 s^{2k}\log^4(s) ds \\ &= -\frac{3\pi}{2}\beta(4) + \frac{\pi^2}{8}\sum_{k=0}^\infty\frac{1}{(2k+1)^3}+3\sum_{k=0}^\infty\frac{1}{(2k+1)^5} \\ &= \boxed{-\frac{3\pi}{2}\beta(4) + \frac{7\pi^2}{64}\zeta(3) +\frac{93}{32}\zeta(5)} \end{aligned} Interestingly, $I_2$ can be reduced into an Euler sum which can be evaluated using contour integration.

## bookmark_borderEvaluating very nasty logarithmic integrals: Part II

In this post, we’ll evaluate some more nasty logarithmic integrals. Please read part 1 of this series if you haven’t done so already.

## Integral #3

We’ll start by finding a closed form for the integral: $$I_1 = \int_0^1 \frac{\log^2(1+x^2)}{1+x^2}dx$$ This integral can be reduced to Euler sums like our previous problem. But this time, the resulting Euler sums cannot be evaluated using the method of residues. Therefore, we’ll have to use a different approach.

Let us first consider the following integral: $$I_2 = \int_0^1 \frac{\log^2(1+ix)}{1+x^2}dx$$ Throughout this post, $\log$ denotes the principal branch of the logarithmic function defined by $\log z = \log|z| + i\text{arg}(z)$, with $-\pi < |\text{arg}(z)| \leq \pi$. We have \begin{aligned} I_2 &= \frac{1}{2}\int_0^1\log^2(1+ix)\left(\frac{1}{1+ix}+\frac{1}{1-ix} \right)dx \\ &= \frac{\log^3(1+ix)}{6i}\Big|_0^1 + \frac{1}{2}\int_0^1 \frac{\log^2(1+ix)}{1-ix}dx \\ &= \frac{\log^3(1+i)}{6i} + \frac{i}{2}\int_{\frac{1}{2}}^{\frac{1-i}{2}}\frac{\log^2(2(1-x))}{x}dx \\ &= \frac{\log^3(1+i)}{6i} + \frac{i}{2}\int_{\frac{1}{2}}^{\frac{1-i}{2}}\frac{\log^2(1-x)+\log^2(2)+2\log(2)\log(1-x)}{x}dx \\ &= \frac{\log^3(1+i)}{6i} + \frac{i\log^2(2)\log\left(1-i\right)}{2} + i\log(2) \left[\text{Li}_2\left(\frac{1}{2}\right)-\text{Li}_2\left(\frac{1-i}{2}\right) \right] \\ &\quad + \frac{i}{2}\int_{\frac{1}{2}}^{\frac{1-i}{2}}\frac{\log^2(1-x)}{x}dx \quad \color{blue}{\cdots (1)} \end{aligned} We can use equation (2) from (B) to evaluate $\int_{\frac{1}{2}}^{\frac{1+i}{2}}\frac{\log^2(1-x)}{x}dx$. \begin{aligned} \int_{\frac{1}{2}}^{\frac{1-i}{2}}\frac{\log^2(1-x)}{x}dx &= \log^2\left( \frac{1+i}{2}\right)\log\left(\frac{1-i}{2}\right) + 2\log\left(\frac{1+i}{2} \right)\text{Li}_2\left(\frac{1+i}{2}\right)-2\text{Li}_3\left(\frac{1+i}{2}\right) \\ &\quad +\log^3(2) + 2\log(2)\text{Li}_2\left(\frac{1}{2}\right) + 2\text{Li}_3\left(\frac{1}{2} \right) \quad \color{blue}{\cdots (2)} \end{aligned}

To simplify $\text{Li}_2\left(\frac{1+i}{2} \right)$ and $\text{Li}_2\left(\frac{1-i}{2} \right)$, we can use the following Dilogarithm identity: $$\text{Li}_2(1-z) + \text{Li}_2\left(1-z^{-1} \right) = -\frac{1}{2}\log^2(z)$$ This is easy to verify by differentiating both sides of the above equation with respect to $z$. Plugging in $z=\frac{1+i}{2}$ gives \begin{aligned} \text{Li}_2\left(\frac{1-i}{2}\right) &= -\text{Li}_2(i) - \frac{1}{2}\log^2\left(\frac{1+i}{2}\right) = \frac{5\pi^2}{96}-\frac{\log^2(2)}{8}+i\left(-G + \frac{\pi}{8}\log(2)\right) \\ \text{Li}_2\left(\frac{1+i}{2}\right) &= \overline{\text{Li}_2\left(\frac{1-i}{2}\right)} = \frac{5\pi^2}{96}-\frac{\log^2(2)}{8}-i\left(-G + \frac{\pi}{8}\log(2)\right) \end{aligned}

Now, we have everything needed to simplify equation (1). This is a tedious task so I used Mathematica to do it. The final result is \begin{aligned} I_2 &= -\frac{3\pi^3}{128}- \frac{G \log(2) }{2} + \frac{7\pi \log^2(2)}{32} + i\left( -\frac{ G \pi }{4} + \frac{7\pi^2 \log(2)}{192} + \frac{\log^3(2)}{48}+\frac{7}{8}\zeta(3) - \text{Li}_3\left(\frac{1+i}{2} \right)\right) \\ &\quad \color{blue}{\cdots (3)} \end{aligned} As of now, I am not aware of a closed form expression for $\text{Li}_3\left(\frac{1+i}{2} \right)$. So, we’ll leave it as it is. We can now extract $I_1$ from the real part of $I_2$. \begin{aligned} \text{Re }I_2 &= \int_0^1 \frac{\frac{1}{4}\log^2(1+x^2) - \arctan^2(x)}{1+x^2}dx \\ &= \frac{1}{4}\int_0^1 \frac{\log^2(1+x^2)}{1+x^2}dx - \frac{\arctan^3(x)}{3}\Big|_0^1 \\ &= \frac{1}{4}I_1 - \frac{\pi^3}{192} \end{aligned} Therefore, $$\boxed{I_1 = -2G\log(2) - \frac{7\pi^3}{96} + \frac{7\pi \log^2(2)}{8} + 4\text{ Im }\text{Li}_3\left(\frac{1+i}{2} \right)}\quad \color{blue}{\cdots (4)}$$ Now, let’s turn our attention to another integral: $$I_3 = \int_0^1 \frac{\log(x)\log(1+x^2)}{1+x^2}dx$$ Notice that with the help of some algebra, we can write: $$I_3 = -\frac{1}{2}\int_0^1 \frac{\log^2\left(\frac{x}{1+x^2} \right)}{1+x^2}dx + \frac{1}{2}\int_0^1 \frac{\log^2(1+x^2)}{1+x^2}dx + \frac{1}{2}\int_0^1 \frac{\log^2(x)}{1+x^2}dx$$ The leftmost integral can be dealt with the trigonometric substitution $x=\tan \theta$: \begin{aligned} \int_0^1 \frac{\log^2\left(\frac{x}{1+x^2} \right)}{1+x^2}dx &= \int_0^{\frac{\pi}{4}} \log^2\left(\sin \theta \cos\theta \right) \; d\theta \\ &= \int_0^{\frac{\pi}{4}} \log^2\left(\frac{\sin(2\theta)}{2} \right)\; d\theta \\ &= \frac{1}{2}\int_0^{\frac{\pi}{2}}\log^2\left(\frac{\sin \theta}{2} \right)\; d\theta \\ &= \frac{1}{2}\lim_{s\to 1}\frac{d^2}{ds^2}\int_0^{\frac{\pi}{2}}\left(\frac{\sin\theta}{2} \right)^{s-1}d\theta \\ &= \frac{1}{2}\lim_{s\to 1}\frac{d^2}{ds^2}\left[\frac{2^{-s}\sqrt{\pi}\Gamma\left(\frac{s}{2}\right)}{\Gamma\left(\frac{1+s}{2} \right)} \right] \\ &= \frac{\pi^3}{48}+ \pi \log^2(2) \end{aligned} The middle integral has already been evaluated. As for the rightmost integral, we have: \begin{aligned} \int_0^1 \frac{\log^2(x)}{1+x^2}dx &= \sum_{n=0}^\infty (-1)^{n}\int_0^1 x^{2n}\log^2(x)\; dx \\ &= 2\sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)^3} \\ &= \frac{\pi^3}{16} \end{aligned} This gives us $$\boxed{I_3 =-\frac{\pi^3}{64} -G \log(2) - \frac{\pi \log^2(2)}{16} +2 \text{ Im }\text{Li}_3\left(\frac{1+i}{2}\right)} \quad \color{blue}{\cdots (5)}$$

One can also evaluate $I_4 = \int_0^1\frac{\log(1+x^2)\arctan(x)}{x}dx$ by noting that $$I_4 = \text{Im}\int_0^1 \frac{\log^2(1+ix)}{x}dx = \text{Im}\int_0^{-i}\frac{\log^2(1-x)}{x}dx$$ and using equation (3) from (B).The end result is: $$\boxed{I_4 =-\frac{3\pi^3}{64}+G\log(2)-\frac{\pi \log^2(2)}{16}+2\text{ Im }\text{Li}_3\left(\frac{1+i}{2}\right) } \quad \color{blue}{\cdots (6)}$$ Using $I_3$ and $I_4$, we can evaluate $I_5 = \int_0^1 \frac{\log(x)\arctan(x)}{x(1+x^2)}dx$ as follows: \begin{aligned} I_5 &= \int_0^1 \log(x)\arctan(x)\left(\frac{1}{x}-\frac{x}{1+x^2} \right) dx \\ &= \int_0^1 \frac{\log(x)\arctan(x)}{x}dx - \int_0^1 \frac{x\log(x)\arctan(x)}{1+x^2}dx \\ &= -\frac{1}{2}\int_0^1 \frac{\log^2(x)}{1+x^2}dx + \frac{1}{2} \int_0^1 \frac{\log(x)\log(1+x^2)}{1+x^2} dx + \frac{1}{2}\int_0^1 \frac{\log(1+x^2)\arctan(x)}{x}dx \quad (\text{IBP}) \\ &= -\frac{\pi^3}{32} + \frac{I_3 + I_4}{2} \\ &= -\frac{\pi^3}{16} - \frac{\pi \log^2(2)}{16} + 2\text{ Im }\text{Li}_3\left(\frac{1+i}{2}\right) \end{aligned} On the other hand, we have: \begin{aligned} I_5 &= \int_0^1 \log(x) \left(\sum_{n=0}^\infty (-1)^n \tilde{H}_n x^{2n} \right) dx\\ &= \sum_{n=0}^\infty (-1)^n \tilde{H}_n \int_0^1 x^{2n}\log(x) \; dx \\ &= -\sum_{n=0}^\infty \frac{(-1)^n \tilde{H}_n}{(2n+1)^2} \end{aligned} where $\tilde{H}_n = \sum_{j=0}^n \frac{1}{2j+1}$. This gives us an interesting Euler sum: $$\boxed{\sum_{n=0}^\infty \frac{(-1)^n \tilde{H}_n}{(2n+1)^2} = \frac{\pi^3}{16} + \frac{\pi \log^2(2)}{16} - 2\text{ Im }\text{Li}_3\left(\frac{1+i}{2}\right)}\quad \color{blue}{\cdots (7)}$$ Of course, one can proceed in a similar manner to create more crazy integrals. The following problem is left as an exercise for the reader.

Exercise 1: Using the method of residues, show that $$\sum_{n=0}^\infty \frac{(-1)^n\tilde{H}_n}{2n+1} = \frac{G}{2}+\frac{\pi \log(2)}{8} \quad \color{blue}{\cdots (8)}$$

## Integral #4

Many years ago, I encountered the following integral: $$I_6 = \int_0^1 \frac{x \arctan(x)\log(1-x^2)}{1+x^2}dx$$ At that time, I couldn’t find a solution to this problem. Hence, I ended up asking it on math.stackexchange.com. The answers that I received there involved evaluating complex logarithmic integrals by brute force. Recently, I discovered a much simpler way to solve it using the method of residues.

Let’s start by breaking down $I_6$ into Euler sums. \begin{aligned} I_6 &= \int_0^1 x\log(1-x^2) \left(\sum_{n=0}^\infty (-1)^n \tilde{H}_n x^{2n+1} \right)dx \\ &= \sum_{n=0}^\infty (-1)^n \tilde{H}_n \int_0^1 x^{2n+2}\log(1-x^2) dx \\ &= \sum_{n=0}^\infty (-1)^{n+1} \tilde{H}_n \left(\frac{\psi_0\left(n+\frac{5}{2} \right)+\gamma}{2n+3} \right) \\ &= \sum_{n=0}^\infty (-1)^{n+1}\left(\tilde{H}_{n+1}-\frac{1}{2n+3} \right)\left(\frac{-2\log(2)+2\tilde{H}_{n+1}}{2n+3} \right) \\ &= \sum_{n=0}^\infty (-1)^n \left(\tilde{H}_{n}-\frac{1}{2n+1} \right)\left(\frac{-2\log(2)+2\tilde{H}_{n}}{2n+1} \right) \\ &= -2\log(2)\sum_{n=0}^\infty \frac{(-1)^n \tilde{H}_n}{2n+1}+2G\log(2) + 2\sum_{n=0}^\infty \frac{(-1)^n (\tilde{H}_n)^2}{2n+1} -2\sum_{n=0}^\infty \frac{(-1)^n \tilde{H}_n}{(2n+1)^2} \\ &= G\log(2) - \frac{\pi \log^2(2)}{4} + 2\sum_{n=0}^\infty \frac{(-1)^n (\tilde{H}_n)^2}{2n+1} -2\sum_{n=0}^\infty \frac{(-1)^n \tilde{H}_n}{(2n+1)^2} \quad \color{blue}{\cdots (9)} \end{aligned} The result of exercise 1 was used in the last step.

Now, integrate the function $f(z) = \pi\csc(\pi z) \frac{\left( \gamma + \psi_0 \left(-z+\frac{3}{2} \right)\right)^2}{-2z+1}$ over the positively oriented square, $C_N$, with vertices $\pm \left(N+\frac{1}{4}\right)\pm i\left(N+\frac{1}{4} \right)$. It takes a bit of effort to see that $$\lim_{N\to \infty}\int_{C_N} f(z)\; dz = 0$$ This implies that the sum of residues of $f(z)$ at it’s poles is equal to $0$. We have

\begin{aligned} \mathop{\text{Res}}\limits_{z=-n} f(z) &= (-1)^n \frac{\left(\gamma +\psi_0\left(n+\frac{3}{2}\right) \right)^2}{2n+1} = (-1)^n \frac{\left(-2\log(2)+2\tilde{H}_n \right)^2}{2n+1}, \quad n\in\{0,1,2,\cdots\} \\ \mathop{\text{Res}}\limits_{z=n} f(z) &= (-1)^{n-1} \frac{\left(\gamma+\psi_0\left(-n+\frac{3}{2} \right) \right)^2}{2n-1} = (-1)^{n-1} \frac{\left(-2\log(2)+2\tilde{H}_{n-1} -\frac{2}{2n-1}\right)^2}{2n-1}, \quad n\in\{1,2,3,\cdots\} \\ \mathop{\text{Res}}\limits_{z=\frac{2n+1}{2}} f(z) &= (-1)^{n-1} \frac{\pi H_n}{n} - (-1)^{n-1} \frac{3\pi}{2n^2}, \quad n\in\{1,2,3,\cdots\} \end{aligned}

Summing up the residues and performing some algebraic simplifications gives: \begin{aligned} &\; 8\sum_{n=0}^\infty \frac{(-1)^n (\tilde{H}_n)^2}{2n+1}-8\sum_{n=0}^\infty \frac{(-1)^n \tilde{H}_n}{(2n+1)^2}-16\log(2)\sum_{n=0}^\infty \frac{(-1)^n \tilde{H}_n}{2n+1}+ 4\sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)^3} \\ &\quad + 8\log(2)\sum_{n=0}^\infty \frac{(-1)^n }{(2n+1)^2} + \pi\sum_{n=1}^\infty \frac{(-1)^{n-1}H_n}{n} - \frac{3\pi}{2}\sum_{n=1}^\infty \frac{(-1)^{n-1}}{n^2} = 0 \\ &\implies 8\left(\sum_{n=0}^\infty \frac{(-1)^n (\tilde{H}_n)^2}{2n+1}-\sum_{n=0}^\infty \frac{(-1)^n \tilde{H}_n}{(2n+1)^2} \right) + \frac{\pi^3}{8} + \pi \left(\frac{\pi^2}{12}-\frac{\log^2(2)}{2}\right)-\frac{3\pi}{2}\left(\frac{\pi^2}{12} \right) = 0 \\ &\implies \sum_{n=0}^\infty \frac{(-1)^n (\tilde{H}_n)^2}{2n+1}-\sum_{n=0}^\infty \frac{(-1)^n \tilde{H}_n}{(2n+1)^2} = -\frac{\pi^3}{96}+\frac{\pi \log^2(2)}{16} \quad \color{blue}{\cdots (10)} \end{aligned} In the above calculation, we used the result of exercise 1 and that $$\sum_{n=1}^\infty \frac{(-1)^{n-1}H_n}{n} = \frac{\pi^2}{12}-\frac{\log^2(2)}{2}$$ This follows from (A). Finally, plugging equation (10) into (9), gives $$\boxed{I_6 = -\frac{\pi^3}{48}-\frac{\pi}{8}\log^2 (2) +G\log (2)} \quad \color{blue}{\cdots (11)}$$

## bookmark_borderEvaluating 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}