Evaluate $\int_{1}^{\sqrt{2}} \frac{x^4}{(x^2-1)^2+1}\,dx$

Note \begin{align} I=&\int_{1}^{\sqrt{2}} \frac{x^4}{(x^2-1)^2+1}\,dx\\ = &\int_{1}^{\sqrt{2}} \left(1+\frac{2x^2-2}{x^4-2x^2+2}\right)\,dx\\ = &\sqrt2-1+\int_{1}^{\sqrt{2}} \frac{2-\frac2{x^2}}{x^2+\frac2{x^2}-2}dx\\ =& \sqrt2-1 + (1+\frac1{\sqrt2})I_1 + (1-\frac1{\sqrt2})I_2\tag1\\ \end{align}

where

\begin{align} I_1= \int_{1}^{\sqrt{2}} \frac{1-\frac{\sqrt2}{x^2}}{x^2+\frac2{x^2}-2}dx &=\int_{1}^{\sqrt{2}} \frac{d(1+\frac{\sqrt2}{x})}{(x+\frac{\sqrt2}x)^2-2(1+\sqrt2)}=0 \\ I_2= \int_{1}^{\sqrt{2}} \frac{1+\frac{\sqrt2}{x^2}}{x^2+\frac2{x^2}-2}dx &=\int_{1}^{\sqrt{2}} \frac{d(1-\frac{\sqrt2}{x})}{(x-\frac{\sqrt2}x)^2+2(\sqrt2-1)}\\ &=\sqrt{\frac2{\sqrt2-1}} \tan^{-1}\sqrt{\frac{\sqrt2-1}2} \end{align}

Plug $I_1$ and $I_2$ into (1) to obtain

$$I = \sqrt2-1 + \sqrt{\sqrt2-1}\tan^{-1}\sqrt{\frac{\sqrt2-1}2} $$


Start by writing $x^4 = (x^2 - 1 + 1)^2$ $\implies x^4 = (x^2-1)^2 + 1 + 2(x^2-1)$

So the our integral becomes:

$$\int_1^{\sqrt2}\frac{(x^2-1)^2 + 1 + 2(x^2-1)}{(x^2-1)^2 + 1}\,dx$$ $$ = \int_1^{\sqrt2}\frac{(x^2-1)^2 + 1}{(x^2-1)^2 + 1}\,dx + 2\int_1^{\sqrt2}\frac{(x^2-1)}{(x^2-1)^2 + 1}\,dx$$ $$ = \sqrt2 - 1 + 2\int_1^{\sqrt2}\frac{(x^2-\sqrt2 + 1-\sqrt2)}{(x^4 - 2x^2 + 2)}\,dx$$ $$ = \sqrt2 - 1 + 2\int_1^{\sqrt2}\frac{(1-\sqrt2/x^2 )}{((x + \sqrt2/x)^2 - 2 - 2\sqrt2)}\,dx + 2(1-\sqrt2)\int_1^{\sqrt2}\frac{1}{(x^2-1)^2 + 1}\,dx$$ Here, I've split the integral so I can use the fact that after dividing the numerator and denominator by $x^2$, I can complete a square (The square of $(x + \sqrt2/x))$ and I'll have its derivative in the numerator for an easy substitution.

Put $(x + \sqrt2/x) \rightarrow t$ in the first integral, you can see that the upper and lower limits become the same $(1+ \sqrt2)$ So the first integral becomes $0$ and you're left with: $$\sqrt2 - 1 + 2(1-\sqrt2)\int_1^{\sqrt2}\frac{1}{(x^2-1)^2 + 1}\,dx$$ I was trying to avoid using complex numbers, but this integral becomes so much easier if you write: $(x^2-1)^2 + 1 = (x^2 - 1 + i)(x^2 - 1 + i)$ and use partial fractions. $$ =\sqrt2 - 1 + \frac{1 - \sqrt2}{i}\int_1^{\sqrt2}\left(\frac{1}{x^2-1-i} + \frac{1}{x^2-1+i}\right)\,dx$$

$$=\sqrt2 - 1 + \frac{1 - \sqrt2}{i}\left(\frac{\tan^{-1}\left(\displaystyle\frac{x}{\sqrt{-1 - i}}\right)}{\sqrt{-1 - i}} + \frac{\tan^{-1}\left(\displaystyle\frac{x}{\sqrt{-1 + i}}\right)}{\sqrt{-1 + i}}\right)\Bigg|_{x=1}^{x=\sqrt2}$$