Is this a valid method for $\int \frac {1}{x^4 +1} dx$ I've seen other methods for integrating this on StackExchange yet I'm wondering if what I'm doing is valid as well.
$$\int \frac {1}{x^4 + 1} dx$$
$$\int \frac {1}{(x^2 + 1)(x^2-1)+2} dx$$
Using the trigonometric substitution: $x = \tan(u), \,dx = \sec^2(u)\, du$
$$\int \frac {\sec^2u}{((\tan^2(u) +1)(\tan^2(u)-1)+2) } du$$
Using trigonometric identities: $ \tan^2(u) +1= \sec^2(u)$, and completing the trigonometric substitution the integral becomes:
edit: removed brackets around variable for readability
$$\int \frac {\sec^2u}{(\,(\sec^2u)\ ((\,(\sec^2u-1)-1)+2) } du$$
$$\int \frac {\sec^2u}{(\,(\sec^2u\,)(\sec^2u-2)+2) } du$$
Proceeding into the unknown:
$$\int \frac {\sec^2u}{((\sec^4u-2\sec^2u)+2) } du$$
$$\int \frac {\sec^2u}{(\sec^4u-2\sec^2u + 2) } du$$
Making a substitution $ v=\sec^2u$ would not simplify this any further as far as I can see since: $ dv = 2(\sec^2u)( \tan u)\, du$

Previous working:
$$\int \cos^2(u)\, du$$
$$\frac{1}{4}(2u+\sin(2u))$$
Using $\sin(2u) = 2\sin(u)\cos(u)$ & back substitution of: $u = \arctan(x)$
$$\frac{1}{4}(2\arctan(x)) * 2\sin(\arctan(x))\cos(\arctan(x))$$


NOTE:
The solution herein addressed the Originally Posted Question the OP edited the question.

Your mistake starts at the third line,
$$\int \frac {1}{x^4 + 1} dx$$
$$\int \frac {1}{(x^2 + 1)(x^2-1)+2} dx$$
Using the trigonometric substitution: $x = \tan(u), \,dx = \sec^2(u)\, du$
$$\int \frac {\color{red}{\sec^2 u }}{((\tan^2(u) +1)(\tan^2(u)-1)+2) } \color{red}{du}$$
See more at the duplicate
