# What is up with the antiderivative of $\arctan^2(x)$?

Integrating $\arctan^2(x)$ has been a mystery to me since I first learned to compute indefinite integrals. When I plug it into integral calculator or WolframAlpha, I get a primitive written in terms of complex numbers and polylogarythms; but $\arctan^2(x)$ is continuous and defined $\forall\space x\in\mathbb{R}$, the area under the curve $(x,\arctan^2(x))$ is well-defined and obvioulsy real. In fact, I can integrate that function numerically and get the area without using Barrow's Rule at all.

I thought maybe the complex part of that expression is constant, therefore applying Barrow's Rule always yields a real number anyway, but then I could subtract a constant equal to its imaginary part times $i$ and get a real and still valid antiderivative. Anyway, I have no idea of how to compute that antiderivative in the first place, so I can't check for myself.

Can a real, continuous function have a complex primitive but not a real primitive? And, can anyone give me a hint to help me compute its antiderivative by myself?

• This integral Can be expressed by the Poly-Log function. – Dr. Sonnhard Graubner Apr 30 '18 at 9:49
• @Dr.SonnhardGraubner The OP knows this already: "When I plug it into integral calculator or WolframAlpha, I get a primitive written in terms of complex numbers and polylogarythms" – projectilemotion Apr 30 '18 at 10:01
• This post (math.stackexchange.com/questions/713971) asks for a definite integral of $\arctan^2(x)$. However, please check the answers which give answers for the indefinite integration without going into complex variables. This will reduce your question to easier real integrals which again cannot be solved in closed form, but which are standardised in the literature. In conclusion, there is no closed solution to your question in real terms. – Andreas Apr 30 '18 at 10:14
• As the previous comment hints at, perhaps studying the integral $\int \log \cos y \; dy$ is more enlightening. This can be obtained using the substitution $x=\tan y$ and integrating by parts twice. There are two different real infinite series for $\log \cos y$ which can be separately integrated term by term and equated. – James Arathoon Apr 30 '18 at 13:00

You are totally correct.

Using the result, compute it for $x=0$ and you will get $\frac{i \pi ^2}{12}$; do it for any arbitrary value of $x$ and you will get the decimal representation of this number.

What you could also do is to perform a Taylor expansion of the result around $0$ and get $$\frac{i \pi ^2}{12}+\frac{x^3}{3}-\frac{2 x^5}{15}+\frac{23 x^7}{315}-\frac{44 x^9}{945}+O\left(x^{11}\right)$$

Compute its derivative to get $$x^2-\frac{2 x^4}{3}+\frac{23 x^6}{45}-\frac{44 x^8}{105}+O\left(x^{10}\right)$$ while $$\tan^{-1}(x)=x-\frac{x^3}{3}+\frac{x^5}{5}-\frac{x^7}{7}+\frac{x^9}{9}+O\left(x^{10}\right)$$ from which $$\left[\tan ^{-1}(x)\right]^2=x^2-\frac{2 x^4}{3}+\frac{23 x^6}{45}-\frac{44 x^8}{105}+O\left(x^{10}\right)$$

$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

You can see an integration of $\ds{\arctan^{2}\pars{x}}$ over $\ds{\pars{0,1}}$ in this link which I guess it's simpler than the present one.

\begin{align} \int\arctan^{2}\pars{x}\,\dd x & = x\arctan^{2}\pars{x} - \int x\bracks{2\arctan\pars{x}\,{1 \over x^{2} + 1}} \dd x \\[5mm] & = x\arctan^{2}\pars{x} - \ln\pars{x^{2} + 1}\arctan\pars{x} + \int{\ln\pars{x^{2} + 1} \over x^{2} + 1}\,\dd x \end{align}
\begin{align} \int{\ln\pars{x^{2} + 1} \over x^{2} + 1}\,\dd x & = 2\,\Re\int\ln\pars{x + \ic}\pars{{1 \over x - \ic} - {1 \over x + \ic}}{1 \over 2\ic}\,\dd x \\[5mm] & = \Im\ \underbrace{\int{\ln\pars{x + \ic} \over x - \ic}\,\dd x} _{\ds{\mbox{Set}\,\,\, t = x + \ic}}\ -\ \Im\ \underbrace{\int{\ln\pars{x + \ic} \over x + \ic}\,\dd x} _{\ds{=\ {1 \over 2}\,\ln^{2}\pars{x + \ic}}} \\ & = -\,\Im\int{\ln\pars{t} \over 2\ic - t}\,\dd t - {1 \over 2}\,\Im\ln^{2}\pars{x + \ic} \\[5mm] & = -\,\Im\ \underbrace{\int{\ln\pars{2\ic\braces{t/\bracks{2\ic}}} \over 1 - t/\pars{2\ic}}\,{\dd t \over 2\ic}} _{\ds{\mbox{Set}\,\,\, z = {t \over 2\ic}}}\ -\ {1 \over 2}\,\Im\ln^{2}\pars{x + \ic} \\[5mm] & = -\,\Im\int{\ln\pars{2\ic z} \over 1 - z}\,\dd z - {1 \over 2}\,\Im\ln^{2}\pars{x + \ic} \\[5mm] & = \Im\braces{\ln\pars{1 - z}\ln\pars{2\ic z} - \int{\ln\pars{1 - z} \over z}} - {1 \over 2}\,\Im\ln^{2}\pars{x + \ic} \\[5mm] & = \Im\bracks{\ln\pars{1 - z}\ln\pars{2\ic z} + \,\mrm{Li}_{2}\pars{z}} - {1 \over 2}\,\Im\ln^{2}\pars{x + \ic} \\[5mm] & = \Im\bracks{\ln\pars{1 - {t \over 2\ic}}\ln\pars{t} + \,\mrm{Li}_{2}\pars{t \over 2\ic}} - {1 \over 2}\,\Im\ln^{2}\pars{x + \ic} \\[5mm] & = \Im\bracks{\ln\pars{{\ic \over 2}\bracks{x - \ic}}\ln\pars{x + \ic} + \,\mrm{Li}_{2}\pars{1 - x\ic \over 2}} - {1 \over 2}\,\Im\ln^{2}\pars{x + \ic} \\[5mm] & = \Im\bracks{\bracks{{\pi \over 2}\,\ic - \ln\pars{2}}\ln\pars{x + \ic} + \,\mrm{Li}_{2}\pars{1 - x\ic \over 2}} - {1 \over 2}\,\Im\ln^{2}\pars{x + \ic} \\[5mm] & = {\pi \over 2}\,\Re\ln\pars{x + \ic} - \ln\pars{2}\Im\ln\pars{x + \ic} + \Im\mrm{Li}_{2}\pars{1 - x\ic \over 2} - {1 \over 2}\,\Im\ln^{2}\pars{x + \ic} \\[5mm] & = {\pi \over 4}\ln\pars{x^{2} + 1} + \ln\pars{2}\arctan\pars{x} + \Im\mrm{Li}_{2}\pars{1 - x\ic \over 2} - {1 \over 2}\,\Im\ln^{2}\pars{x + \ic} \end{align}

WA assumes complex functions by default and provides answers more general than you expect.

But when plugging a real variable, the given antiderivative should simplify to a real function (plus a possibly complex constant).

• I thought so, too, but with this particular function this seems not to be the case. No integral calculator on the internet will be able to give an answer without using complex numbers. – TeicDaun Apr 30 '18 at 16:10
• Could you show it ? I have not be able to do anything. Cheers. – Claude Leibovici Apr 30 '18 at 16:21
• @ClaudeLeibovici: we are in a technical dead-end because the answer requires a special function such as the real part of the polylogarithm of a specific complex function of $x$, which is not a "standard" function. – Yves Daoust May 1 '18 at 19:33