# How can I solve $\int_0^1\frac{\arctan(x^2)}{1+x^2}\,\mathrm dx$?

This integral appears very similar to $\int\frac{\arctan x}{1+x^2}\,\mathrm dx$, but this question cannot be solved through the same simple substitution of $u=\arctan x$. WolframAlpha cannot find a symbolic solution to this problem, and this Quora answer is the only thing I can find that appears to have the exact answer of $\frac14\log^2(1+\sqrt2)$. I am not sure if there is some special trick to be used in solving this, but I have tried everything I know and nothing seems to work.

• You should first handle integrals as let's say $\int \frac{1}{(1+x^2)^2}$. If this has at all a solution which is expressible via elementary functions, the answer HAS to be something like that... – nikola Sep 2 '18 at 19:19

\begin{align} \displaystyle\int_0^1 \dfrac{\arctan(x^2)}{1+x^2}dx&=\Big[\arctan x\arctan(x^2)\Big]_0^1-\int_0^1 \dfrac{2x\arctan x}{1+x^4}dx\\ &=\dfrac{\pi^2}{16}-\int_0^1 \dfrac{2x\arctan x}{1+x^4}dx\\ \end{align}

Since,

$\displaystyle \arctan x=\int_0^1 \dfrac{x}{1+t^2x^2}dt$

then,

\begin{align} \displaystyle K&=\int_0^1 \dfrac{2x\arctan x}{1+x^4}dx\\ \displaystyle &=\int_0^1\int_0^1 \dfrac{2x^2}{(1+t^2x^2)(1+x^4)}dtdx\\ \displaystyle &=\int_0^1\int_0^1 \left(\dfrac{2t^2}{(1+t^4)(1+x^4)}+\dfrac{2x^2}{(1+x^4)(1+t^4)}-\dfrac{2t^2}{(1+t^4)(1+t^2x^2}\right)dtdx\\ &=\displaystyle 4\left(\int_0^1 \dfrac{t^2}{1+t^4}dt\right)\left(\int_0^1 \dfrac{1}{1+x^4}dx\right)-K \end{align}

Therefore,

$\displaystyle K=2\left(\int_0^1 \dfrac{x^2}{1+x^4}dx\right)\left(\int_0^1 \dfrac{1}{1+x^4}dx\right)$

Since,

\begin{align}\displaystyle \int_0^1 \dfrac{x^2}{1+x^4}dx&=\left[\dfrac{1}{4\sqrt{2}}\ln\left(\dfrac{x^2-\sqrt{2}x+1}{x^2+\sqrt{2}x+1}\right)+\dfrac{1}{2\sqrt{2}}\arctan\left(\sqrt{2}x+1\right)+\dfrac{1}{2\sqrt{2}}\arctan\left(\sqrt{2}x-1\right)\right]_0^1\\ &=\dfrac{1}{4\sqrt{2}}\Big(\pi+\ln\left(3-2\sqrt{2}\right)\Big) \end{align}

and,

\begin{align}\displaystyle \int_0^1 \dfrac{1}{1+x^4}dx&=\left[\dfrac{1}{4\sqrt{2}}\ln\left(\dfrac{x^2+\sqrt{2}x+1}{x^2-\sqrt{2}x+1}\right)+\dfrac{1}{2\sqrt{2}}\arctan\left(\sqrt{2}x+1\right)+\dfrac{1}{2\sqrt{2}}\arctan\left(\sqrt{2}x-1\right)\right]_0^1\\ &=\dfrac{1}{4\sqrt{2}}\Big(\pi-\ln\left(3-2\sqrt{2}\right)\Big) \end{align}

Therefore,

$\boxed{K=\displaystyle \dfrac{\pi^2}{16}-\dfrac{1}{16}\Big(\ln\left(3-2\sqrt{2}\right)\Big)^2}$

Therefore,

$\boxed{\displaystyle\int_0^1 \dfrac{\arctan(x^2)}{1+x^2}dx=\dfrac{1}{16}\Big(\ln\left(3-2\sqrt{2}\right)\Big)^2}$

NB:

$\displaystyle \left(3-2\sqrt{2}\right)=\left(1-\sqrt{2}\right)^2=\frac{1}{\left(1+\sqrt{2}\right)^2}$

therefore,

$\displaystyle \ln^2\left(3-2\sqrt{2}\right)=4\ln^2\left(1+\sqrt{2}\right)$

• I have accepted this answer because it uses far more elementary techniques than the other approaches in order to reach the correct answer. Thank you! – StardustGogeta Sep 4 '18 at 21:40

The trick is to exploit a very well-hidden symmetry. The original integral equals $$\frac{1}{2}\int_{0}^{1}\frac{\arctan(x)}{\sqrt{x}(1+x)}\,dx \tag{1}$$ which by enforcing the substitution $x\mapsto\frac{1-z}{1+z}$ becomes $$\frac{1}{2}\int_{0}^{1}\frac{\frac{\pi}{4}-\arctan(z)}{\sqrt{1-z^2}}\,dz \tag{2}$$ so the problem boils down to evaluating $$\int_{0}^{\pi/2}\arctan(\sin\theta)\,d\theta = \sum_{n\geq 0}\frac{(-1)^n}{2n+1}\int_{0}^{\pi/2}\left(\sin\theta\right)^{2n+1}\,d\theta \tag{3}$$ or the hypergeometric series $$\sum_{n\geq 0}\frac{(-4)^n}{(2n+1)^2\binom{2n}{n}} = \phantom{}_3 F_2\left(\tfrac{1}{2},1,1;\tfrac{3}{2},\tfrac{3}{2};-1\right).\tag{4}$$ Plenty of techniques are available for such a task: in my recent works with Campbell, Cantarini and Sondow, I investigated Fourier-Legendre expansions, for instance: see 1 and 2. But the binomial transform is another perfectly viable approach. Mathematica is already able to express $\int_{0}^{\pi/2}\arctan\sin\theta\,d\theta=\int_{0}^{\pi/2}\arctan\cos\theta\,d\theta$ in terms of $\text{Li}_2$, even if my version is not able to simplify the outcome into a squared logarithm/$\text{arcsinh}$, via the usual functional equations.

The Maclaurin series of the squared (hyperbolic) arcsine is also pretty relevant here:

$$\sum_{n\geq 0}\frac{(-4)^n}{(2n+1)^2\binom{2n}{n}} = \int_{0}^{1}\frac{\text{arcsinh}(x)}{x\sqrt{1+x^2}}\,dx = \int_{0}^{\text{arcsinh}(1)}\frac{z}{\sinh z}\,dz\tag{5}$$ $$\int\frac{z}{\sinh z}\,dz = z \log\sinh\frac{z}{2}+\text{Li}_2(-e^{-z})-\text{Li}_2(e^{-z})+C.\tag{6}$$

Curiously enough, this is pretty much the same principle that I exploited in this very lucky contribution of mine. And I am glad that this kind of "Eulerian" Mathematics still is a state-of-the-art, better-than-CASs Mathematics.

• Amazing observation! I've been trying to come up with a solution that exploits differentiation under the integral sign, but with no luck. – MisterRiemann Sep 2 '18 at 19:42
• Thank you for showing all of these methods and uncovering some of the interesting features of this integral! – StardustGogeta Sep 4 '18 at 21:41

As @Jack D'Aurizio♦ provided a nice answer, let me simply add a bit of extra information:

1. A slightly different way of transforming the given integral can be made as follows:

\begin{align*} \int_{0}^{1}\frac{\arctan(x^2)}{1+x^2}\,dx &= \int_{0}^{\frac{\pi}{4}} \arctan(\tan^2 \theta) \, d\theta \tag{$x=\tan\theta$} \\ &= \int_{0}^{\frac{\pi}{4}} \arctan\left( \frac{1-\cos2\theta}{1+\cos2\theta} \right) \, d\theta \\ &= \int_{0}^{\frac{\pi}{4}} \left( \frac{\pi}{4} - \arctan(\cos2\theta) \right) \, d\theta \\ &= \frac{\pi^2}{16} - \frac{1}{2}\int_{0}^{\frac{\pi}{2}} \arctan(\sin\phi)\,d\phi. \tag{$\phi=\frac{\pi}{2}-2\theta$} \end{align*}

Here, we utilized double-angle identities and $\arctan\left(\frac{1-x}{1+x}\right) = \frac{\pi}{4} - \arctan x$ for $x \in (-1, \infty)$.

2. The last integral can also be computed in terms of Legendre chi function $\chi_2$:

$$\frac{1}{2} \int_{0}^{\frac{\pi}{2}} \arctan(\sin\phi)\,d\phi = \chi_2(\sqrt{2}-1) = \frac{\pi^2}{16} - \frac{1}{4}\log^2(\sqrt{2}+1).$$

You may check my previous answer for the detail of derivation. Alternative ways to compute this integral can also be found in this posting.

Let us first go the K-theoretical way first. The integral is related do (complex valued) integrals involving dilogarithms. To have the connection, here are two integrals, the given one, and an other one. We compare numerically (PARI/GP code):

? J  = intnum( x=0, 1, atan(x^2)/(1+x^2) );
? JC = intnum( x=0, 1, log(1+I*x^2)/(1+x^2) );
? J
%163 = 0.19420484997392399537514367752235472615
? imag(JC)
%164 = 0.19420484997392399537514367752235472615
? log(1+sqrt(2))^2 / 4
%165 = 0.19420484997392399537514367752235472615


We can now compute:

\begin{aligned} J &= \int_0^1\frac{\arctan x^2}{1+x^2}\; dx\ ,\\ J_{\Bbb C} &= \int_0^1\frac{\log(1+i x^2)}{1+x^2}\; dx\\ &= \int_0^1\frac{\log(1+\alpha x)+\log(1-\alpha x)} {(x+i)(x-i)}\; dx\\ &\qquad\text{where $\alpha=(-1+i)/\sqrt2$ is a square root of $-i$}\\ &= \sum_{a\in A} \int_0^1\frac{\log(1+a x)}{(x+i)(x-i)}\; dx\\ &\qquad\text{where $A$ is $\{\ \alpha,\ -\alpha\ \}$}\\ &= \sum_{a\in A} \int_0^1\log(1+a x) \frac 1{2i}\left[\ \frac 1{x-i}-\frac 1{x+i}\ \right]\; dx\\ &= \sum_{a\in A} \int_0^1\log(1+a x) \frac 12\left[\ \frac {-i}{x-i}+\frac {+i}{x+i}\ \right]\; dx\\ &= \frac 12\sum_{\substack{a\in A\\j\in\pm i}} \int_0^1\log(1+a x) \frac j{x+j}\; dx\\ &\qquad\text{Substitution $y=x+j$}\\ &= \frac 12\sum_{a,j} j\int_{0+j}^{1+j}\log(1+a (y-j)) \frac {dy}y \\ &= \frac 12\sum_{a,j} j\int_{0+j}^{1+j}\log\left(\ (1-aj)\left(1+\frac a{1-aj} y\right)\ \right) \frac {dy}y \\ &= \frac 12\sum_{a,j} j\int_{0+j}^{1+j}\log(1-aj) \frac {dy}y + \frac 12\sum_{a,j} j\int_{0+j}^{1+j}\log\Bigg(\ 1+\underbrace{\frac a{1-aj} y}_{=-z}\ \Bigg) \frac {dy}y \\ &= \frac 12\sum_{a,j} j\log(1-aj)\cdot\log\Bigg|_{0+j}^{1+j} - \frac 12\sum_{a,j} j\operatorname{Li}_2\Bigg| _{-(0+j)a/(1-aj)}^{-(1+j)a/(1-aj)} \ , \end{aligned} where $\operatorname{Li}_2(Z)=\int_0^Z-\log(1-z)\frac{dz}z$ is the dilog(arithm) function. Above, the notation $F\Big|_s^t$ stays for $F(t)-F(s)$. Let us compute the logarithmic part, it is simpler. The $a$-sum is for a fixed $j$ first $$\log(1-\alpha j)+\log(1+\alpha j) = \log(1-\alpha^2j^2) = \log(1-i) = \frac 12\log 2-i\frac\pi4\ .$$ So the first sum is $$\frac 12\sum_{a,j} j\log(1-aj)\cdot\log\Big|_{0+j}^{1+j} = \frac 12\sum_{j} j\log(1-i)\cdot\log\frac{1+j}{0+j} =\frac 12\log(1-i) \sum_{j} j\log(1-j) =\frac 12\log(1-i)\cdot i\log\frac{1-i}{1+i} = \frac 12 i\left(\frac 12\log 2-i\frac\pi4\right)\left(-i\frac\pi2\right)\ .$$ We need only the imaginary part to calculate $J$ from $J_{\Bbb C}$ above, this is the "period" $-\pi^2/16$.

Now we pass to the dilogarithmic part. I will use the notation $a$ for $(-1+i)/\sqrt 2$ from now on. Then we have a sum over $\pm a$ and $\pm i$. Here are the limits of the dilog:

• for $a,i$ - lower $(1-i)(1+a)/2$, and upper $-i(1+a)$,
• for $a,-i$ - lower $(1-i)(1-a)/2$, and upper $(1-a)$,
• for $-a,i$ - lower $(1-i)(1-a)/2$, and upper $-i(1-a)$,
• for $-a,-i$ - lower $(1-i)(1+a)/2$, and upper $(1+a)$.

So the contribution of the lower limits cancel each other. (First and fourth are the same, but in the sum we have the coefficients $j=$ and respectively $j=-i$. Same for the second and third.) So we only have to compute $$\boxed{\qquad S= -\frac i2\Big( \ \operatorname{Li}_2(-i(1+a)) -\operatorname{Li}_2(1-a) +\operatorname{Li}_2(-i(1-a)) -\operatorname{Li}_2(1+a) \ \Big)\ .\qquad}$$ The above "scissors" show now maybe what kind of relations we need. The "dezaggregation" of the given integral was almost algorithmic. Now we have to use functional relations of the dilogarithm function. Recall the relations

\begin{aligned} \operatorname{Li}_2(1-z) + \operatorname{Li}_2(z) &= +\frac 16\pi^2 -\log(z)\log(1-z)\ , \\ \operatorname{Li}_2(1/z) + \operatorname{Li}_2(z) &= -\frac 16\pi^2 -\frac 12\log^2(-z)\ , \\ \frac 12\operatorname{Li}_2(z^2) &= \operatorname{Li}_2(z) + \operatorname{Li}_2(-z)\ , \\ 0 &= \operatorname{Li}_2(A) + \operatorname{Li}_2(1-AB) + \operatorname{Li}_2(B) \\ &\qquad+ \operatorname{Li}_2\left(\frac{1-A}{1-AB}\right) + \operatorname{Li}_2\left(\frac{1-B}{1-AB}\right) \\ &\qquad +\frac {\Bbb Z}2\pi^2 \text{ monodromy} \\ &\qquad +\log(A)\log(1-A)+\log(B)\log(1-B) \\ &\qquad +\log\left(\frac{1-A}{1-AB}\right)\log\left(\frac{1-B}{1-AB}\right) , \ . \end{aligned} The last relation is my corrected version. (See note below.)

Then in our case we may try... \begin{aligned} &\operatorname{Li}_2(1+a) + \operatorname{Li}_2(1-a) \\ &\qquad = -\operatorname{Li}_2(a) - \operatorname{Li}_2(-a) + \frac 26\pi^2 - \log(a)\log(1-a) - \log(-a)\log(1+a) \\ &\qquad= \frac 12\operatorname{Li}_2(a^2) -\frac 13\pi^2 - \log(a)\log(1-a) - \log(-a)\log(1+a)\ , \end{aligned} and the complicated term is in $\operatorname{Li}_2(a^2)= \operatorname{Li}_2(-i)$,

sage: dilog(-I)
-I*catalan - 1/48*pi^2


but we fortunately need only the real part, thus getting rid of the Catalan constant! The above manages in a simple way the simple terms. But the complicated terms remain.

So let us better apply the five term(s) relation for $A=\pm a=\pm (-1+i)/\sqrt 2$ and correspondingly $B=\mp\sqrt 2$, so that $AB=-(-1+i)=(1-i)$ in both cases. (We have a better use for the simple terms.) Then $1-AB=i$, and we write: \begin{aligned} 0 &= \boxed{\operatorname{Li}_2(+a)} + \operatorname{Li}_2(i) + \operatorname{Li}_2(-\sqrt 2) + \boxed{\operatorname{Li}_2\left(\frac{1-a}{i}\right)} + \operatorname{Li}_2\left(\frac{1+\sqrt 2}{i}\right) \\ &\qquad +\frac 12\Bbb Z\pi^2 \\ &\qquad +\frac 16\pi^2+ \boxed{-\frac 16\pi^2 +\log(a)\log(1-a)}+\log(-\sqrt 2)\log(1+\sqrt 2) \\ &\qquad\qquad +\log\left(\frac{1-a}i\right)\log\left(\frac{1+\sqrt 2}i\right) \\ &\qquad\text{and} \\ 0 &= \boxed{\operatorname{Li}_2(-a)} + \operatorname{Li}_2(i) + \operatorname{Li}_2(+\sqrt 2) + \boxed{\operatorname{Li}_2\left(\frac{1+a}{i}\right)} + \operatorname{Li}_2\left(\frac{1-\sqrt 2}{i}\right) \\ &\qquad \frac 12\Bbb Z\pi^2 \\ &\qquad +\frac 16\pi^2+\boxed{-\frac 16\pi^2 +\log(-a)\log(1+a)}+\log(+\sqrt 2)\log(1-\sqrt 2) \\ &\qquad\qquad +\log\left(\frac{1+a}i\right)\log\left(\frac{1-\sqrt 2}i\right) \ . \end{aligned} The boxed terms are related to the four terms of the sum $S$, namely $-\boxed{\operatorname{Li}_2(1-a)}+ \boxed{\operatorname{Li}_2(-i(1-a)}$, and respectively $-\boxed{\operatorname{Li}_2(1+a)}+ \boxed{\operatorname{Li}_2(-i(1+a)}$, so we add the above two relations and get \begin{aligned} S&=+\frac i2\Bigg[\ 2\operatorname{Li}_2(i) + \underbrace{\operatorname{Li}_2(-\sqrt 2) + \operatorname{Li}_2(+\sqrt 2)}_{\frac 12\operatorname{Li}_2(2)} + \underbrace{ \operatorname{Li}_2(-i(1-\sqrt 2)) + \operatorname{Li}_2(-i(1+\sqrt 2))} _{-\frac 16\pi^2-\frac 12\log^2(i(1+\sqrt 2))} \\ &\qquad +\left(\frac 16+\frac 16\right)\pi^2 +\frac 12\Bbb Z\pi^2 \\ &\qquad +\log(+\sqrt 2)\log(1-\sqrt 2) +\log(-\sqrt 2)\log(1+\sqrt 2) \\ &\qquad +\log\left(\frac{1-a}i\right)\log\left(\frac{1+\sqrt 2}i\right) +\log\left(\frac{1+a}i\right)\log\left(\frac{1-\sqrt 2}i\right) \ \Bigg] \ . \end{aligned} Now we extract only the imaginary part of $S$. So we need the real part of the expression in the bracket. We thus can forget about the Catalan constant involved in the dilog of $i$, only $\pi^2/48$ survives. Then $\operatorname{Li}_2(2) = -\operatorname{Li}_2(1-2)+\frac 16\pi^2 -\log(2)\log(1-2) = -\left(-\frac 1{12}\pi^2\right)+\frac 16\pi^2 -\log(2)\cdot i\pi$, then we take from $\log^2(i(1+\sqrt 2))$, after splitting products inside logarithme, only the terms $\log^2(i)$, and $\boxed{}\log^2(1+\sqrt 2)$, then the real part of $\log(+\sqrt 2)\log(1-\sqrt 2) +\log(-\sqrt 2)\log(1+\sqrt 2)$ is $\log(+\sqrt 2)\log(\sqrt 2-1) +\log(\sqrt 2)\log(\sqrt 2+1)=0$, because $(\sqrt 2-1)(\sqrt 2+1)=1$, and it remains to examine the last two terms. We write $\log\left(\frac{1+\sqrt 2}i\right)= \log(1+\sqrt 2)-i\pi/2=-\log\left(\frac{1-\sqrt 2}i\right)$, and the needed real part has two terms, obtained form the log of the division $\left(\frac{1+a}i\right): \left(\frac{1-a}i\right) =\frac{1+a}{1-a}$, and we need its modulus and angle. The modulus is $\sqrt 2-1=\frac 1{\sqrt 2+1}$, which follows from $|1\pm a|^2 =\left(1\mp\frac 1{\sqrt2}\right)^2+\frac 12=2\mp\sqrt 2$. This is introducing again finally a term $\log^2(1+\sqrt 2)$. It turns out that $(1+a)/(1-a)$ is purely imaginary, equal to $i(\sqrt 2-1)$. Now we can conclude for $S$, \begin{aligned} S&=\frac i2\Bigg[\ 2\cdot\left(-\frac 1{48}\pi^2\right) + \frac 12\cdot\frac 14\pi^2 -\frac 16\pi^2 -\frac 12\log^2(1+\sqrt 2) -\frac 12\cdot\left(-\frac 14\pi^2\right) \\ &\qquad+\frac 16\pi^2+\frac 16\pi^2+\frac 12\Bbb Z\pi^2 \\ &\qquad+0 \\ &\qquad +\log^2(1+\sqrt 2)+\left( -\frac 14\pi^2\right) \ \Bigg] + \text{some complicated real part} \\ &=\frac i2\Bigg[\ \left(-\frac 1{24}+\frac 18-\frac 16+\frac 18 +\frac 16+\frac 16+\frac 12\Bbb Z-\frac 14\right)\pi^2 +\frac 12\log^2(1+\sqrt 2)\ \Bigg] + \text{real part} \ . \end{aligned} Now we can put all together. \begin{aligned} J &= \text{Imaginary part in } J_{\Bbb C} \\ &= \text{Imaginary part in } \frac 12\sum_{a,j}j\log\Big|_{\dots}^{\dots} - \underbrace{ \text{Imaginary part in } \frac 12\sum_{a,j}j\operatorname{Li}_2\Big|_{\dots}^{\dots}}_S \\ &= -\frac 1{16}\pi^2 + \underbrace{\frac 12\left(\frac 16-\frac 1{24}\right)\pi^2 +\frac 14\Bbb Z\pi^2 +\frac 14\log^2(1+\sqrt2)}_S \\ &=\frac 14\Bbb Z\pi^2 +\frac 14\log^2(1+\sqrt2)\ . \end{aligned} The monodromy term is there since i did not want to take care all the time... It can contribute only discretely. A numerical check shows it is zero in this case.

%272 = 0.19420484997392399537514367752235472615
? log( 1+sqrt(2) )^2 / 4
%273 = 0.19420484997392399537514367752235472615


So the term in $\frac 14\Bbb Z\pi^2$ in the above equality is zero, and we have $$J = \log^2(1+\sqrt2)\ .$$ This finishes the computation.

$\square$

Note: There was nothing special on the road, a simple exercise having always in mind the symbolic part in the Bloch $K_2$ group of the cyclotomic field of order eight over $\Bbb Q$.

The computation was typed in detail, trying to respect the Galois symmetry of this field. (In the hope that the used relations may be traced back in a more classical set up.)

Here are some further "naive" thoughts, trials to proceed using a reduction of the arctangent of $x^2$ in terms of the arctangents of $1\pm x\sqrt 2$. (Knowing the K-theoretical solution, we may want to make calculus in a plain world, but implement somehow the "same relation". I could not bring this to a simple end, but the computations are written here.) For this we introduce \begin{aligned} J &= \int_0^1\frac{\arctan x^2}{1+x^2}\; dx\ ,\\ K &= \int_{-1}^1\frac{\arctan(1+ x\sqrt 2)}{1+x^2}\; dx\\ &= \int_{-1}^1\frac{\arctan(1- x\sqrt 2)}{1+x^2}\; dx\\ &= \frac 12 \int_{-1}^1 \frac {\arctan(1+ x\sqrt 2)+\arctan(1-x\sqrt 2)} {1+x^2}\; dx\\ &= \frac 12 \int_{-1}^1 \frac {\displaystyle\arctan \frac {(1+ x\sqrt 2)+(1- x\sqrt 2)} {1-(1+ x\sqrt 2)(1- x\sqrt 2)}} {1+x^2}\; dx \\ &= \frac 12 \int_{-1}^1\frac{\arctan(1/x^2)}{1+x^2}\; dx \\ &= \frac 12 \int_{-1}^1\frac{\pi/2-\arctan(x^2)}{1+x^2}\; dx \\ &= \int_0^1\frac{\pi/2-\arctan(x^2)}{1+x^2}\; dx \\ &=\frac{\pi^2}8-J\ . \end{aligned} So it is enough to compute $K$. We substitute as in the OP with $u$ the arctangent of the linear function in $x$, note that $\arctan(1-\sqrt 2)=-\pi/8$, and $\arctan(1+\sqrt 2)=3\pi/8$, so we get \begin{aligned} K &= \int_{-1}^1\frac{\arctan(1+ x\sqrt 2)}{1+x^2}\; dx\\ &= \int_{-\pi/8}^{3\pi/8}\frac u{1+\frac 12(\tan u-1)^2}\cdot \frac 1{\sqrt 2\cos ^2 u}\; du\\ &= \int_{-\pi/8}^{3\pi/8} \frac u{\frac {\sqrt 2}2(1+\cos(2u))+\frac {\sqrt 2}2(1-\sin(2u))}\; du \\ &= \int_{-\pi/8}^{3\pi/8} \frac u{\sqrt 2+\sin(\pi/4-2u)}\; du \\ &= \int_{-\pi/8}^{3\pi/8} \frac {\pi/8}{\sqrt 2+\sin(\pi/4-2u)}\; du + \int_{-\pi/8}^{3\pi/8} \frac {u-\pi/8}{\sqrt 2+\sin(\pi/4-2u)}\; du \\ &= \frac {\pi^2}{16} + \frac 14 \underbrace{ \int_{-\pi/2}^{\pi/2} \frac {v}{\sqrt 2-\sin v}\; dv}_{=:L}\ . \end{aligned} (So in a final, $J,K$ will be $\pi^2/16\mp L/4$.) Let us now compute $L$.

Then we further have \begin{aligned} L &= \int_{-\pi/2}^{\pi/2} \frac {v}{\sqrt 2-\sin v}\; dv = -\int_{-\pi/2}^{\pi/2} \frac {v}{\sqrt 2+\sin v}\; dv \\ &=\frac 12 \int_{-\pi/2}^{\pi/2}v\left[ \frac 1{\sqrt 2-\sin v}- \frac 1{\sqrt 2+\sin v} \right]\;dv \\ &=\frac 12 \int_{-\pi/2}^{\pi/2}v\cdot \frac {2\sin v}{ 2-\sin^2 v}\;dv \\ &=\int_{-\pi/2}^{\pi/2}v\cdot \frac {\sin v}{ 1+\cos^2 v} \;dv =2\int_0^{\pi/2}v\cdot \frac {\sin v}{ 1+\cos^2 v} \;dv \\ &=2\int_0^{\pi/2}\arctan\cos v\; dv \ . \end{aligned} (There are many other ideas. For instance, write $\arctan x^2$ in the expression $\arctan 1-\arctan x^2=\arctan(\ (1-x^2)/(1+x^2)\ )$ and use the trigonometric substitution $x=\tan (v/2)$...)

I have to stop here and submit.