Evaluate $\int \frac{1-x^2}{(1+x^2)\sqrt {1+x^4}} dx$ $$\int \frac{\frac{1}{x^2}-1}{(x+\frac 1x)\sqrt{\frac{1}{x^2} + x^2}}dx$$
Let $x+\frac 1x = t$
$$-\int \frac{dt}{t\sqrt {t^2-2}}$$
Let $\sqrt{t^2-2} =u$
$$-\int \frac{du}{t^2}$$
$$-\int \frac{du}{u^2+2}$$
$$-\frac{1}{\sqrt 2} \arctan (\frac{u}{\sqrt 2})$$
$$-\frac{1}{\sqrt 2} \arctan (\frac{1}{\sqrt 2} \sqrt { x^2 +\frac{1}{x^2}}$$
But the given answer is$ \frac {1}{\sqrt 2} \arcsin (\frac{\sqrt {2 x}}{x^2+1})$
Where am I going wrong?
 A: You need to take care of the sign in your approach. The result you derived is valid only for $x>0$. The full result valid for all domain is, instead
$$\int \frac{1-x^2}{(1+x^2)\sqrt {1+x^4}} dx
=-\frac{\text{sgn}(x)}{\sqrt 2} \arctan \frac{\sqrt { x^2+\frac{1}{x^2}}}{\sqrt 2} 
=-\frac{1}{\sqrt 2} \arctan \frac{ \sqrt { x^4 +1}}{{\sqrt 2}x}
$$
which, as expected, differs from the given answer by a constant, i.e.
$$-\frac{1}{\sqrt 2} \arctan \frac{ \sqrt { x^4 +1}}{{\sqrt 2}x}- \frac {1}{\sqrt 2} \arcsin \frac{\sqrt {2}x}{x^2+1}=-\frac{\pi}{2\sqrt2}$$
Note
$$-\int \frac{dt}{t\sqrt {t^2-2}}
= \int \frac{d(\frac1t)}{\sqrt {1-\frac2{t^2}}}= \frac1{\sqrt2}\arcsin\frac{\sqrt2}t= \frac {1}{\sqrt 2} \arcsin \frac{\sqrt {2}x}{x^2+1}
$$
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\bbox[5px,#ffd]{-\int{\dd t \over
t\root{t^{2} - 2}}}\qquad
\pars{~\mbox{Set}\,\,\, t\ =\ \root{2}\sec\pars{\theta}~}
\\[5mm] = &\
-\int{\root{2}\sec\pars{\theta}\tan\pars{\theta} \over \root{2}\sec\pars{\theta}
\bracks{\root{2}\tan\pars{\theta}}}\,\dd\theta
\\[5mm] = &\
-\,{\root{2} \over 2}\int\dd\theta =
-\,{\root{2} \over 2}\,\theta + \mbox{a constant}
\\[5mm] = &\
-\,{\root{2} \over 2}\,
\arccos\pars{\root{2} \over t} + \mbox{a constant}
\\[5mm] = &\
\bbx{-\,{\root{2} \over 2}
\arccos\pars{\root{2}\,{x \over x^{2} + 1}} + \mbox{a constant}}
\\ &
\end{align}
