# Integral $\int_0^1 \left(\arctan x \right)^2\,dx$

Evaluate

$$\int_0^1 \left(\arctan x \right)^2\,dx$$

$${\pi^2\over16} + \frac{\pi\ln(2)}{4} -C$$

where $C$ is Catalan's constant.

How do I proceed?

I tried doing integration by parts twice and got stuck at $$\int_0^1{\frac{\log\left(\frac1{x}+x\right)}{1+x^2}}\,dx$$

• The fact that this involves Catalan's constant tells you that the antiderivative will not be an elementary function. However, $C = -\int_0^1 \dfrac{\ln(t)}{1+t^2}$ according to that page you referenced... Commented Mar 16, 2014 at 7:58
• Did you mean $\arctan(x^2)$ or $(\arctan x)^2\text{ ?}$ Either of those expressions is unambiguous. Commented Jun 7, 2014 at 3:48

Integrating by parts twice,

\begin{align} \int_{0}^{1} (\arctan x)^{2} \ dx &= x (\arctan x)^{2} \Big|^{1}_{0} - 2 \int_{0}^{1} \frac{x \arctan x}{1+x^{2}} \ dx \\ &= \frac{\pi^{2}}{16} - 2 \int_{0}^{1} \frac{x \arctan x}{1+x^{2}} \ dx \\ &= \frac{\pi^{2}}{16} - \arctan(x) \ln(1+x^{2}) \Big|^{1}_{0} + \int_{0}^{1} \frac{\ln (1+x^{2})}{1+x^{2}} \ dx \\ &= \frac{\pi^{2}}{16} - \frac{\pi}{4} \ln 2 + \int_{0}^{1} \frac{\ln(1+x^{2})}{1+x^{2}} \ dx \end{align}

Let $x = \tan t$.

Then

\begin{align}\int_{0}^{1} (\arctan x)^{2} \ dx &=\frac{\pi^{2}}{16} - \frac{\pi}{4} \ln 2 - 2 \int_{0}^{\pi /4} \ln (\cos t) \ dt \\ &= \frac{\pi^{2}}{16} - \frac{\pi}{4} \ln 2 -2 \int_{0}^{\pi /4} \left( \sum_{n=1}^{\infty} \frac{(-1)^{n-1}}{n} \cos (2nt) - \ln 2 \right) \ dt \\ &= \frac{\pi^{2}}{16} - \frac{\pi}{4} \ln 2 - 2 \sum_{n=1}^{\infty} \frac{(-1)^{n-1}}{n}\int_{0}^{\pi /4} \cos (2nt) \ dt + \frac{\pi}{2} \ln 2 \\ &= \frac{\pi^{2}}{16} + \frac{\pi}{4} \ln 2 - \sum_{n=1}^{\infty} \frac{\sin \left(\frac{\pi n}{2} \right)}{n^{2}} \\ &= \frac{\pi^{2}}{16} + \frac{\pi}{4} \ln 2 - \sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2n+1)^{2}} \\ &= \frac{\pi^{2}}{16} + \frac{\pi}{4} \ln 2 - C \end{align}

Fourier series of Log sine and Log cos

$\newcommand{\+}{^{\dagger}} \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert} \newcommand{\wt}[1]{\widetilde{#1}}$ $\ds{\int_{0}^{1}\arctan^{2}\pars{x}\,\dd x ={\pi^{2} \over 16} + {\pi\ln\pars{2} \over 4} - C:\ {\large ?}.\quad}$ $\ds{C}$ is the Catalan Constant.

Set $\ds{\quad x \equiv \tan\pars{\theta}\quad\imp\quad\theta = \arctan\pars{x}}$: \begin{align}&\color{#c00000}{\int_{0}^{1}\arctan^{2}\pars{x}\,\dd x} =\int_{0}^{\pi/4}\theta^{2}\sec^{2}\pars{\theta}\,\dd\theta ={\pi^{2} \over 16} - \int_{0}^{\pi/4}\tan\pars{\theta}\pars{2\theta}\,\dd\theta \\[3mm]&={\pi^{2} \over 16} + \ln\pars{1 \over \root{2}}2\,{\pi \over 4} -2\int_{0}^{\pi/4}\ln\pars{\cos\pars{\theta}}\,\dd\theta \\[3mm]&={\pi^{2} \over 16} - {1 \over 4}\,\pi\ln\pars{2} - \int_{0}^{\pi/4} \ln\pars{\half\bracks{2\sin\pars{\theta}\cos\pars{\theta}}\cot\pars{\theta}} \,\dd\theta \\[3mm]&={\pi^{2} \over 16} - {1 \over 4}\,\pi\ln\pars{2} + {1 \over 4}\,\pi\ln\pars{2} - \int_{0}^{\pi/4}\ln\pars{\cot\pars{\theta}}\,\dd\theta -\int_{0}^{\pi/4}\ln\pars{\sin\pars{2\theta}}\,\dd\theta \end{align}

However, a integral representation of $\ds{C}$ is given by: $$C = \int_{0}^{\pi/4}\ln\pars{\cot\pars{\theta}}\,\dd\theta$$ such that $$\color{#c00000}{\int_{0}^{1}\arctan^{2}\pars{x}\,\dd x} ={\pi^{2} \over 16} - C -\half\color{#00f}{\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta}\tag{1}$$

Also, \begin{align}&\color{#00f}{\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta} =\half\bracks{\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta +\int_{0}^{\pi/2}\ln\pars{\cos\pars{\theta}}\,\dd\theta} \\[3mm]&=\half\int_{0}^{\pi/2}\ln\pars{\sin\pars{2\theta} \over 2}\,\dd\theta =-\,{1 \over 4}\,\pi\ln\pars{2} +{1 \over 4}\int_{0}^{\pi}\ln\pars{\sin\pars{\theta}}\,\dd\theta \\[3mm]&=-\,{1 \over 4}\,\pi\ln\pars{2} +{1 \over 4}\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta +{1 \over 4}\int_{\pi/2}^{\pi}\ln\pars{\sin\pars{\theta}}\,\dd\theta \\[3mm]&=-\,{1 \over 4}\,\pi\ln\pars{2} +\half\color{#00f}{\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta} \end{align}

$$\imp\quad\color{#00f}{\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta} = -\,\half\,\pi\ln\pars{2}$$

Replace this result in $\pars{1}$: $$\color{#66f}{\large% \int_{0}^{1}\arctan^{2}\pars{x}\,\dd x ={\pi^{2} \over 16} + {\pi\ln\pars{2} \over 4} - C} \approx 0.2453$$

I believe it is interesting to look at your definite integral in terms of the more general result \begin{align} \int (\arctan x)^2dx=&x(\arctan x)^2 -\frac{1}{2}\log(1+x^2)\arctan x+ \log2\arctan x+\tag{1}\label{eq:main}\\ &-\Im\left\{\mbox{Li}_2\left(\frac{1+ix}{2}\right)\right\}+K.\end{align} where $\mbox{Li}_2(z)$ is dilogarithm function. The above expression can be calculated by letting $$\omega = \frac{1+ix}{2}=|\omega|\mbox{e}^{i\arctan x}\tag{2}\label{eq:omega}$$ and then noting that $$|\omega|^2 = \omega \cdot (1-\omega).\tag{3}\label{eq:mod}$$ Thus, from \eqref{eq:omega}, \begin{align} \log \omega &= \log|\omega|+i\arctan x=\\ &=\frac{1}{2}\log|\omega|^2+i\arctan x=\\ &\stackrel{\eqref{eq:mod}}=\frac{1}{2}\log\omega + \frac{1}{2}\log(1-\omega)+ i\arctan x.\end{align} This finally gives the following expression for the inverse tangent function: $$\arctan x = -\frac{i}{2}[\log \omega + \mbox{Li}_1(\omega)],\tag{4}\label{eq:arctan}$$ where $$\mbox{Li}_1(z) = -\log(1-z).$$ Using \eqref{eq:arctan} to calculate the integral, \begin{align}\int(\arctan x)^2dx &= -\frac{1}{4}\int[\log\omega + \mbox{Li}_1(\omega)]^2 dx=\\ &=\frac{i}{2}\int[\log\omega +\mbox{Li}_1(\omega)]^2d\omega,\end{align} and recalling that the integral definition of the dilogarithm is $$\mbox{Li}_2(z) = -\int_0^z\frac{\log(1-u)}{u}du = \int_0^z\frac{\mbox{Li}_1(u)}{u}du$$ easily leads to \eqref{eq:main}. So the definite integral is $$\int_0^1 (\arctan x)^2 dx = \frac{\pi^2}{16} + \frac{(\log 2) \pi}{8}- \Im\left\{\mbox{Li}_2\left(\frac{1+i}{2}\right)\right\}.$$ The value of the dilogarithm in $\frac{1+i}{2}$ can be determined using Landen's identity, as detailed here, which was pointed out to me by user153012: $$\mbox{Li}_2\left(\frac{1+i}{2}\right) = \frac{5\pi^2}{96} - \frac{(\log 2)^2}{8} + i\left[C - \frac{(\log 2)\pi}{8}\right],$$ $C$ being Catalan's constant. This confirms the result obtained in the previous answers, i.e. $$\int_0^1 (\arctan x)^2 dx = \frac{\pi^2}{16} + \frac{(\log 2) \pi}{4} - C$$

If one know that $$\displaystyle \int_0^{\dfrac{\pi}{2}}\log (\sin (x))dx=-\dfrac{\pi}{2}\log(2)$$

so then :

$$\displaystyle \int_0^\dfrac{\pi}{2}\dfrac{x}{\tan x }dx=\dfrac{\pi}{2}\log(2)$$ (by integration by parts)

Let $$I=\displaystyle \int_0^\dfrac{\pi}{2}\dfrac{x}{\tan x }dx$$

Change of variable $$u=\tan x$$ :

$$I=\displaystyle \int_0^{+\infty} \dfrac{\arctan x}{x(1+x^2)}dx$$

$$I=\displaystyle \int_0^1 \dfrac{\arctan x}{x(1+x^2)}dx+\int_1^{+\infty} \dfrac{\arctan x}{x(1+x^2)}dx$$

in the second integral, in the right member make the change of variable $$u=\dfrac{1}{x }$$ $$I= \displaystyle\int_0^1 \dfrac{\arctan x}{x(1+x^2)}dx+ \int_0^1 \dfrac{x\arctan \Big(\dfrac{1}{x}\Big) }{1+x^2}dx$$

For $$x>0$$ one have $$\arctan\Big(\dfrac{1}{x}\Big)+\arctan x=\dfrac{\pi}{2}$$

$$I= \displaystyle\int_0^1 \dfrac{\arctan x}{x(1+x^2)}dx+\dfrac{\pi}{2}\int_0^1\dfrac{x}{1+x^2}dx-\int_0^1\dfrac{x\arctan x}{1+x^2}dx$$

But: $$\dfrac{1}{x(1+x^2)}=\dfrac{1}{x}-\dfrac{x}{1+x^2}$$

So then:

$$I=\displaystyle\int_0^1 \dfrac{\arctan x}{x}dx-\displaystyle\int_0^1 \dfrac{x\arctan x}{1+x^2}dx+\dfrac{\pi}{2}\int_0^1\dfrac{x}{1+x^2}dx-\int_0^1\dfrac{x\arctan x}{1+x^2}dx$$

Hence: $$I=\displaystyle\int_0^1 \dfrac{\arctan x}{x}dx-2\displaystyle\int_0^1 \dfrac{x\arctan x}{1+x^2}dx+\dfrac{\pi}{4}\Big[\log(1+x^2)\Big]_0^1$$

and so:

$$I=\displaystyle\int_0^1 \dfrac{\arctan x}{x}dx-2\displaystyle\int_0^1 \dfrac{x\arctan x }{1+x^2}dx+\dfrac{\pi}{4}\log(2)$$

But: the derivative of $$x\rightarrow(\arctan x)^2$$ is $$x\rightarrow\dfrac{2\arctan x }{1+x^2}$$

So then:

$$I=\displaystyle\int_0^1 \dfrac{\arctan x}{x}dx-\Big(\big[ x(\arctan x)^2\big]_0^1-\int_0^1(\arctan x)^2 dx\Big)+\dfrac{\pi}{4}\log(2)$$ $$I=\displaystyle\int_0^1\dfrac{\arctan x }{x}dx-\dfrac{\pi^2}{16}+\int_0^1(\arctan x)^2 dx$$

But $$I=\dfrac{\pi}{2}\log(2)$$ so then:

$$\displaystyle\int_0^1 (\arctan x)^2 dx=\dfrac{\pi^2}{16}-G+\dfrac{\pi}{4}\log(2)$$

where $$\displaystyle G=\int_0^1 \dfrac{\arctan x}{x}dx$$ is the Catalan's constant.

\begin{align} \int_0^1 \arctan^2x dx\overset{x=\tan t}= &\int_0^{\frac\pi4}t^2\sec^2tdt \overset {IBP}= {\pi^2\over16} - \int_0^{\frac\pi4}2 t\tan t dt\\ =& {\pi^2\over16} + \int_0^{\frac\pi4}t \>d[\ln(2\cos^2t)] dt = {\pi^2\over16} - \int_0^{\frac\pi4}\ln(2\cos^2t) dt\\ =& {\pi^2\over16} - \int_0^{\frac\pi4}\ln\sin2t dt + \int_0^{\frac\pi4}\ln\tan t dt \\ =&{\pi^2\over16} + \frac{\pi}{4} \ln2-C \end{align}

\begin{aligned}\int_0^1{\frac{\log\left(\frac1{x}+x\right)}{1+x^2}}dx & =\underbrace{ \int_{0}^{1} \frac{\ln \left(1+x^{2}\right)}{1+x^{2}} d x}_{J} - \underbrace{\int_{0}^{1} \frac{\ln x}{1+x^{2}} d x}_{K}\end{aligned} For the integral $$J$$, letting $$x=\tan x$$ gives \begin{aligned} J =\int_{0}^{\frac{\pi}{4}} \ln \left(\sec ^{2} \theta\right) d \theta &=-2 \int_{0}^{\frac{\pi}{4}} \ln (\cos \theta) d \theta =\frac{\pi}{2} \ln 2-G \end{aligned}

where the last integral comes from my post 1.

For the integral $$K$$, we consider the integral

\begin{aligned} K(a) &=\int_{0}^{1} \frac{x^{a}}{1+x^{2}} d x =\int_{0}^{1} \sum_{k=0}^{\infty}(-1)^{k} x^{2 k+a} d x =\sum_{k=0}^{\infty} \frac{(-1)^{k}}{2k+1+a} \end{aligned} Then differentiating $$K(a)$$ w.r.t. $$a$$ at $$a=0$$ yields \begin{aligned} K &=K^{\prime}(0) =\sum_{k=0}^{\infty} \frac{(-1)^{k+1}}{(2 k+1)^{2}} =-G \end{aligned}

Therefore we can conclude that $$\boxed{I=\left(\frac{\pi}{2} \ln 2-G\right)+G=\frac{\pi}{2} \ln 2}$$

First Approach - Using Euler sums

We begin by finding the Maclaurin series expansion for $$\arctan^2 x$$.

Since $$\arctan x = \sum_{n = 0}^\infty \frac{(-1)^n x^{2n + 1}}{2n + 1}, \qquad |x| < 1,$$ applying the Cauchy product to the product between two inverse tangent functions leads to: \begin{align} \arctan^2 x &= \arctan x \cdot \arctan x\\ &= \left (\sum_{n = 0}^\infty \frac{(-1)^n x^{2n + 1}}{2n + 1} \right ) \cdot \left (\sum_{n = 0}^\infty \frac{(-1)^n x^{2n + 1}}{2n + 1} \right )\\ &= \sum_{n = 1} \frac{(-1)^{n + 1}}{n} \left (H_{2n} - \frac{1}{2} H_n \right ) x^{2n}, \qquad |x| \leqslant 1. \end{align} Here $$H_n$$ is the $$n$$th harmonic number.

Making use of this result, the integral becomes \begin{align} I &= \int_0^1 \arctan^2 x \, dx\\ &= \sum_{n = 1}^\infty \frac{(-1)^{n + 1}}{n} \left (H_{2n} - \frac{1}{2} H_n \right ) \int_0^1 x^{2n} \, dx\\ &= \sum_{n = 1}^\infty \frac{(-1)^{n + 1}}{n (2n + 1)} \left (H_{2n} - \frac{1}{2} H_n \right )\\ &= \sum_{n = 1}^\infty (-1)^{n + 1} \left (\frac{1}{n} - \frac{2}{2n + 1} \right ) \left (H_{2n} - \frac{1}{2} H_n \right )\\ &= \frac{1}{2} \sum_{n = 1}^\infty \frac{(-1)^n H_n}{n} - \sum_{n = 1}^\infty \frac{(-1)^n H_n}{2n + 1} - \sum_{n = 1}^\infty \frac{(-1)^n H_{2n}}{n} + 2 \sum_{n = 1}^\infty \frac{(-1)^n H_{2n}}{2n+1}.\tag1 \end{align}

Values for each of the above four alternating Euler sums can be found here. Theirs values are:

$$\sum_{n = 1}^\infty \frac{(-1)^n H_n}{n} = \frac{1}{2} \ln^2 2 - \frac{\pi^2}{12}, \qquad \sum_{n = 1}^\infty \frac{(-1)^n H_n}{2n + 1} = \mathbf{G} - \frac{\pi}{2} \ln 2,$$ $$\sum_{n = 1}^\infty \frac{(-1)^n H_{2n}}{n} = \frac{1}{4} \ln^2 2 - \frac{5\pi^2}{48}, \qquad \sum_{n = 1}^\infty \frac{(-1)^n H_{2n}}{2n + 1} = -\frac{\pi}{8} \ln 2.$$

On substituting into (1) one obtains $$\int_0^1 \arctan^2 x \, dx = \frac{\pi^2}{16} + \frac{\pi}{4} \ln 2 - \mathbf{G},$$ as desired.

Second Approach - Integral of a function and its inverse

Let $$f(x) = \arctan^2 x$$. As $$f$$ is a monotonically increasing function on the interval $$[0,1]$$ an inverse given by $$f^{-1} (x) = \tan (\sqrt{x})$$ exists on the interval $$[0,\frac{\pi^2}{4})$$. Making use of the result: $$\int_a^b f(x) \, dx + \int_{f(a)}^{f(b)} f^{-1} (x) \, dx = b \cdot f(b) - a \cdot f(a),$$ noting that for our $$f$$ we have $$f(a) = f(0) = 0$$ and $$f(b) = f(1) = \frac{\pi^2}{16}$$, one sees that $$\int_0^1 \arctan^2 x \, dx + \int_0^{\frac{\pi^2}{16}} \tan (\sqrt{x}) \, dx = \frac{\pi^2}{16}.$$ Thus \begin{align} \int_0^1 \arctan^2 x \, dx &= \frac{\pi^2}{16} - \underbrace{\int_0^{\frac{\pi^2}{16}} \tan (\sqrt{x}) \, dx}_{x \, \mapsto \, x^2}\\ &= \frac{\pi^2}{16} - 2 \int_0^{\frac{\pi}{4}} x \tan x \, dx\\ &= \frac{\pi^2}{16} - 2 \left (-x \ln (\cos x) \Big{|}_0^{\frac{\pi}{4}} + \int_0^{\frac{\pi}{4}} \ln (\cos x) \, dx \right ) \qquad (\text{by parts})\\ &= \frac{\pi^2}{16} - \frac{\pi}{4} \ln 2 - 2 \int_0^{\frac{\pi}{4}} \ln (\cos x) \, dx\\ &= \frac{\pi^2}{16} - \frac{\pi}{4} \ln 2 - 2 \left (\frac{\mathbf{G}}{2} - \frac{\pi}{4} \ln 2 \right )\tag1\\ &= \frac{\pi^2}{16} + \frac{\pi}{4} \ln 2 - \mathbf{G}, \end{align} as expected. Note that in ($$1$$) we have made use of the result $$\int_0^{\frac{\pi}{4}} \ln (\cos x) \, dx = \frac{\mathbf{G}}{2} - \frac{\pi}{4} \ln 2,$$ several proofs for which can be found here.

To get rid of the inverse, we let $$y=\arctan x$$ and transform the integral into \begin{aligned} I &=\int_{0}^{\frac{\pi}{4}} y^{2} \sec ^{2} y d y \\ &=\int_{0}^{\frac{\pi}{4}} y^{2} d(\tan y) \\ & \stackrel{IBP}{=} \left[y^{2} \tan y\right]_{0}^{\frac{\pi}{4}}-2 \int_{0}^{\frac{\pi}{4}} y \tan y d y \\ &=\frac{\pi^{2}}{16}+2 \int_{0}^{\frac{\pi}{4}} y d(\ln (\cos y)) \\ & \stackrel{IBP}{=}\frac{\pi^{2}}{16}+2[y \ln (\cos y)]_{0}^{\frac{\pi}{4}}-2 \int_{0}^{\frac{\pi}{4}} \ln (\cos y) d y \\ &=\frac{\pi^{2}}{16}+2\left[\frac{\pi}{4} \ln \left(\frac{1}{\sqrt{2}}\right)\right]-2\left(\frac{G}{2}-\frac{\pi}{4} \ln 2\right) \\ &=\frac{\pi^{2}}{16}+\frac{\pi}{4} \ln 2-G \end{aligned} where the last integral comes from my post.