Integrate $\int\frac{x^2-1}{(x^2+1)\sqrt{x^4+1}}dx$ I have tried parts which ended up into a more complex form, any suggestions?
$$\int\frac{x^2-1}{(x^2+1)\sqrt{x^4+1}}dx$$
 A: Edit:  I decided that the previous solution admits a minor but nice generalization, so here goes.
Let $$t = \dfrac{x}{\sqrt{x^4+1}}, \quad dt = \frac{1-x^4}{(x^4+1)^{3/2}} \, dx.$$  Then $$\frac{1}{1 \pm 2t^2} = \frac{x^4+1}{x^4 + 1 \pm 2x^2} = \frac{x^4+1}{(1 \pm x^2)^2},$$ so that
$$ \begin{align*} \int \frac{x^2 \mp 1}{(x^2 \pm 1)\sqrt{x^4+1}} \, dx &= \int \frac{(x^2 \mp 1)(x^2 \pm 1)(x^4+1)}{(x^2 \pm 1)^2 (x^4+1)^{3/2}} \, dx \\ &= \int \frac{1}{1 \pm 2t^2 } \cdot \frac{x^4-1}{(x^4+1)^{3/2}} \, dx \\ &= - \int \frac{dt}{1 \pm 2t^2}.\end{align*}$$  In the positive case, we get $$- \frac{1}{\sqrt{2}} \tan^{-1} \sqrt{2}t + C = - \frac{1}{\sqrt{2}} \tan^{-1} \frac{x \sqrt{2}}{\sqrt{x^4+1}} + C.$$  In the negative case, we get $$\frac{1}{2\sqrt{2}} \log \left| \frac{1 - \sqrt{2}t}{1 + \sqrt{2}t} \right| + C = \frac{1}{2 \sqrt{2}} \log \left| \frac{\sqrt{x^4+1} - x \sqrt{2}}{\sqrt{x^4+1} + x \sqrt{2}} \right| + C.$$
A: Divide numerator and denominator by $x^2$. numerator will become $1-\frac1{x^2}$.
Denominator will become $(x+\frac1x)\sqrt{(x^2+\frac1{x^2})}$. But the part inside the root can be replaced by $(x+\frac1x)^2-2$.
Put $x+\frac1x$ as $t$. You will get $\frac{dt}t(\sqrt{(t^2-2)})$.
Solve it in any way u want.
A: put $$x^2=tan(t) , dx= \frac{cot(t)}{2\sqrt{tan(t)}}dt$$
then you have 
$$\int\frac{tan-1}{(tan+1)\sqrt{tan^2+1}}dx$$ =
$$\int\cos(t)tan(t-pi/4)dx = \int\ -cos(t)\frac{cot(t)}{2\sqrt{tan(t)}}dt=-1/2\int\ cos(t){cot^{3/2}(t)}dt$$
