# Indefinite integral $\int \arctan^2 x dx$ in terms of the dilogarithm function

I read about the integral $$\int \arctan^2 x dx$$ in this old post: Evaluation of $\int (\arctan x)^2 dx$

By replacing $$\arctan x = -\frac{i}{2}\left[\log(1+ix) - \log(i-ix)\right],$$ as suggested there, I ended up with this solution $$\int\arctan^2 x dx = x\arctan^2x - \frac{1}{2}\log(1+x^2)\arctan x -\log 2 \arctan x + \mbox{Im}\left\{\mbox{Li}_2\left(\frac{1+ix}{2}\right)\right\} + K, \tag{1}\label{uno}$$ where, as usual, $\mbox{Li}_2(z)$ is the dilogarithm function $$\mbox{Li}_2(z) = -\int_0^z \frac{\log(1-u)}{u}du=\sum_{k=1}^{+\infty}\frac{z^k}{k^2}.$$ Is this a correct development?

In that case, if I determine, using \eqref{uno}, the definite integral $\int_0^1 \arctan^2xdx$ I get the result $$\int_0^1 \arctan^2xdx=\frac{\pi^2}{16}-\frac{3\pi}{8}\log 2 + \mbox{Im}\left\{\mbox{Li}_2\left(\frac{1+i}{2}\right)\right\}.$$ If I now compare this result with the one given in Definite Integral of $\arctan(x)^2$, i.e. $$\int_0^1 \arctan^2xdx=\frac{\pi^2}{16}+\frac{\pi}{4}\log 2 - C,$$ where $C$ is the Catalan constant $$C = \sum_{k=0}^{+\infty} \frac{(-1)^k}{(2k+1)^2},$$ I get the following expression: $$\mbox{Im}\left\{\mbox{Li}_2\left(\frac{1+i}{2}\right)\right\} = \frac{5\pi}{8}\log 2 - C.$$ Is that reasonable?

• According to Wolfram Alpha, $\text{Im} \, \text{Li}_{2} \left(\frac{1+i}{2} \right) = C- \frac{\pi}{8} \log 2$. This is the negative of what you had earlier. To check if this is indeed the correct value, you could use the inversion formula for the dilogarithm to find the value of $\text{Li}_{2} \left(\frac{1+i}{2} \right) + \text{Li}_{2} (1-i)$, the reflection formula to find the value of $\text{Li}_{2}(i) + \text{Li}_{2}(1-i)$, and the series definition to find the value of $\text{Li}_{2}(i)$. – Random Variable Sep 14 '17 at 16:58
• @RandomVariable thanks, I'll do the checks you suggested. I probably made same mistake in my development. Do you have any idea where I can find similar expressions for the $\int \arctan^2 x dx$ integral? Thanks again! – dfnu Sep 14 '17 at 17:18
• @RandomVariable: Thanks again, I made the check and as a matter of fact there was a sign error in my steps. Now everything turns out fine! I'll will post an answer with the correction as soon as possible. – dfnu Sep 15 '17 at 11:35

Landen's identity states that if $z \notin (1,\infty)$, then $$\operatorname{Li}_2(z) = -\operatorname{Li}_2\left(\frac{z}{z-1}\right)-\frac12\ln^2(1-z).$$ For $z:=(1+i)/2$, we have $z/(z-1) = -i$, thus $$\operatorname{Li}_2\left(\frac{i+1}{2}\right) = -\operatorname{Li}_2(-i)-\frac12\ln^2\left(\frac{1-i}{2}\right).$$ It is well known that $$\operatorname{Li}_2(-i) = -iC -\frac{\pi^2}{48},$$ where $C$ is Catalan's constant. For the logarithmic term we have \begin{align} \frac12\ln^2\left(\frac{1-i}{2}\right) &= -\frac{1}{32}\left(\pi - 2\ln(2)\cdot i\right)^2 \\ &= \frac{\ln^2 2}{8} - \frac{\pi^2}{32} + \frac{\pi}{8}\ln(2) \cdot i. \end{align} Finally $$\operatorname{Li}_2\left(\frac{i+1}{2}\right) = \frac{5\pi^2}{96} - \frac{\ln^2 2}{8} + \left(C - \frac{\pi}{8}\ln 2\right)\cdot i.$$ You could find a more general approach in this answer, where there is a solution for all $z \in \mathbb{C}$, such that $\left|z/(z-1)\right|=1$.

Ok, thanks for the help in giving me $\mbox{Li}_2\left(\frac{1+i}{2}\right)=C-\pi(\log 2)/8$. I checked my result and found out a mistake. The correct form of the integral in terms of the dilogarithm function should be \begin{align} \int \arctan^2xdx=&x\arctan^2x -\frac{1}{2}\log(1+x^2)\arctan x+ \log2\arctan x+\\ &-\mbox{Im}\left\{\mbox{Li}_2\left(\frac{1+ix}{2}\right)\right\}+K.\end{align} I checked derivating back to $\arctan^2x$. Also the result is now compatible with definite integral $\int_0^1 \arctan^2x dx = \pi^2/16+\pi/4\log2 -C.$

When $x\in\mathbb{R}^+$ we can write:

$$\arctan\left(x\right)=\frac{i}{2}\cdot\ln\left(\frac{1-xi}{1+xi}\right)\tag1$$

So, when we square both sides we get:

$$\arctan^2\left(x\right)=\left(\frac{i}{2}\cdot\ln\left(\frac{1-xi}{1+xi}\right)\right)^2=-\frac{1}{4}\cdot\ln^2\left(\frac{1-xi}{1+xi}\right)\tag2$$

For the integral we get, then:

$$\mathscr{I}:=\int\arctan^2\left(x\right)\space\text{d}x=-\frac{1}{4}\cdot\int\ln^2\left(\frac{1-xi}{1+xi}\right)\space\text{d}x\tag3$$

Let $\text{u}:=\frac{1-xi}{1+xi}$:

$$\mathscr{I}=-\frac{2i}{4}\cdot\int\frac{\ln^2\left(\text{u}\right)}{\text{u}^2+2\text{u}+1}\space\text{d}\text{u}=-\frac{i}{2}\cdot\int\frac{\ln^2\left(\text{u}\right)}{\left(1+\text{u}\right)^2}\space\text{d}\text{u}\tag4$$

Let $\text{v}:=1+\text{u}$:

$$\mathscr{I}=-\frac{i}{2}\cdot\int\frac{\ln^2\left(\text{v}-1\right)}{\text{v}^2}\space\text{d}\text{v}\tag5$$

Using integration by parts:

$$\mathscr{I}=-\frac{i}{2}\cdot\left\{-\frac{\ln^2\left(\text{v}-1\right)}{\text{v}}+2\cdot\int\frac{\ln\left(\text{v}-1\right)}{\text{v}\cdot\left(\text{v}-1\right)}\space\text{d}\text{v}\right\}=$$ $$-\frac{i}{2}\cdot\left\{-\frac{\ln^2\left(\text{v}-1\right)}{\text{v}}+2\cdot\left\{\int\frac{\ln\left(\text{v}-1\right)}{\text{v}-1}\space\text{d}\text{v}-\int\frac{\ln\left(\text{v}-1\right)}{\text{v}}\space\text{d}\text{v}\right\}\right\}\tag6$$

• $\text{u}:=\frac{1-xi}{1+xi}$ is a complex function. What is $\int_0^u (...)du$? – FDP Sep 14 '17 at 20:59
• I'm not quite following where you're heading to – dfnu Sep 15 '17 at 11:32