<s>[INST] Evaluate $\int_{1}^{\sqrt{2}} \frac{x^4}{(x^2-1)^2+1}\,dx$ Evaluate the integral:
$$\int_{1}^{\sqrt{2}} \frac{x^4}{(x^2-1)^2+1}\,dx$$
The denominator is irreducible, if I want to factorize and use partial fractions, it has to be in complex numbers and then as an indefinite integral, we get
$$x + \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}}+C$$
But evaluating this from $1$ to $\sqrt{2}$ is another mess, keeping in mind the principal values. I also tried the substitution $x \mapsto \sqrt{x+1}$, which then becomes
$$\frac{1}{2}\int_{0}^1 \frac{(x+1)^{3/2}}{x^2+1}\,dx$$
I don't see where I can go from here. Another substitution of $x\mapsto \tan x$ also leads me nowhere.
Should I approach the problem in some other way?
 [/INST] 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}$$
</s>