<s>[INST] Which solution of this integral $\int{\frac{x^2+1}{x^4-x^2+1}}dx$ is correct? $$\begin{align}
\int{\frac{x^2+1}{x^4-x^2+1}}dx&=\int{\frac{1+\frac{1}{x^2}}{x^2-1+\frac{1}{x^2}}}dx\\
&=\int{\frac{1+\frac{1}{x^2}}{(x-\frac{1}{x})^2+1}}dx\\
&=\int{\frac{1}{u^2+1}}du \quad(u=x-\frac{1}{x})\\
&=\arctan(u)+C\\
&=\arctan(x-\frac{1}{x})+C
\end{align}$$
The image of the integral is:

When I check it using wolfram, the result is $\arctan(\frac{x}{1-x^2})+C$
https://www.wolframalpha.com/input/?i2d=true&i=%5Cint%5C%28%7B%29Divide%5BPower%5Bx%2C2%5D%2B1%2CPower%5Bx%2C4%5D-Power%5Bx%2C2%5D%2B1%5D%5C%28%7D%29
It seems Wolfram calculates this integral like this:
$$\begin{align}
\int{\frac{x^2+1}{x^4-x^2+1}}dx&=\int\frac{x^2+1}{(x^2-1)^2+x^2}dx\\
&=\int\frac{\frac{x^2+1}{(x^2-1)^2}}{1+\frac{x^2}{(x^2-1)^2}}dx\\
&=\int{\frac{1}{1+u^2}}du \quad(u=\frac{x}{1-x^2})\\
&=\arctan(u)+C\\
&=\arctan(\frac{x}{1-x^2})+C
\end{align}$$
Which solution is correct?
 [/INST] Both are. Remember that antiderivatives may differ by a constant (hence the $+ C$).
</s>