<s>[INST] Integration of $\int\frac{x^2-1}{\sqrt{x^4+1}} \, dx$ Integration of $\displaystyle \int\frac{x^2-1}{\sqrt{x^4+1}} \,dx$
$\bf{My\; Try}$:: Let $x^2=\tan \theta$ and $\displaystyle 2xdx = \sec^2 \theta \, d\theta\Rightarrow dx = \frac{\sec^2 \theta}{2\sqrt{\tan \theta}} \, d\theta$
$$
\begin{align}
& = \int\frac{\tan \theta - 1}{\sec \theta}\cdot \frac{\sec^2 \theta}{2\sqrt{\tan \theta}} \, d\theta = \frac{1}{2}\int \frac{\left(\tan \theta - 1\right)\cdot \sec \theta}{\sqrt{\tan \theta}} \, d\theta \\
& = \frac{1}{2}\int \left(\sqrt{\tan \theta}-\sqrt{\cot \theta}\right)\cdot \sec \theta  \, d\theta
\end{align}
$$
Now i did not understand how can i solve it
Help me
Thanks
 [/INST] For any real number of $x$ ,
When $|x|\leq1$ ,
$\int\dfrac{x^2-1}{\sqrt{x^4+1}}dx$
$=\int(x^2-1)\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!x^{4n}}{4^n(n!)^2}dx$
$=\int\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!x^{4n+2}}{4^n(n!)^2}dx-\int\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!x^{4n}}{4^n(n!)^2}dx$
$=\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!x^{4n+3}}{4^n(n!)^2(4n+3)}-\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!x^{4n+1}}{4^n(n!)^2(4n+1)}+C$
When $|x|\geq1$ ,
$\int\dfrac{x^2-1}{\sqrt{x^4+1}}dx$
$=\int\dfrac{x^2-1}{x^2\sqrt{1+\dfrac{1}{x^4}}}dx$
$=\int\left(1-\dfrac{1}{x^2}\right)\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!x^{-4n}}{4^n(n!)^2}dx$
$=\int\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!x^{-4n}}{4^n(n!)^2}dx-\int\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!x^{-4n-2}}{4^n(n!)^2}dx$
$=\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!x^{1-4n}}{4^n(n!)^2(1-4n)}-\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!x^{-4n-1}}{4^n(n!)^2(-4n-1)}+C$
$=\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!}{4^n(n!)^2(4n+1)x^{4n+1}}-\sum\limits_{n=0}^\infty\dfrac{(-1)^n(2n)!}{4^n(n!)^2(4n-1)x^{4n-1}}+C$
</s>