Help with integrating $\int \frac{dx}{1+\sqrt{\tan(x)}}$ Starting off with subbing $u^2 = \tan(x)$ to remove the square root, I got:

*

*$$\int \frac{2u}{(1+u)(1+u^4)} du$$ (Deriving that $\sec^2(x) = 1+u^4$)

Then by applying the partial fractions method, I get:


*$$\int \frac{-1}{1+u} du + \int \frac{u^3-u^2+u+1}{1+u^4} du$$
The first integral is manageable but for the second one I had to split the individual terms in the numerator into their own fractions to further obtain:


*$$\int \frac{u^3}{1+u^4}du +\int \frac{u}{1+u^4}du + \int \frac{1-u^2}{1+u^4}du $$
Now, the first two I could solve however it is the last one that I am unable to move forward with;
$$ \int \frac{1-u^2}{1+u^4}du $$
 A: Since the other parts of your integrand are simple, we look at the remaining part as requested.  Note that
$$\frac{1-z^2}{1+z^4} = \frac{z^2(z^{-2} - 1)}{z^2(z^{-2} + z^2)} = \frac{-(1 - z^{-2})}{(z + z^{-1})^2 - 2}. \tag{1}$$
Hence the substitution $$v = z + z^{-1}, \quad dv = 1 - z^{-2} \, dz, \tag{2}$$ yields
$$\begin{align}
\int \frac{1-z^2}{1+z^4} \, dz &= -\int \frac{dv}{v^2 - 2} \\
&= \frac{1}{2\sqrt{2}} \int \frac{1}{v + \sqrt{2}} - \frac{1}{v - \sqrt{2}} \, dv \\
&= \frac{1}{2\sqrt{2}} \log \left| \frac{v + \sqrt{2}}{v - \sqrt{2}} \right| + C \\
&= \frac{1}{2\sqrt{2}} \log \left| \frac{z^2 + \sqrt{2}z + 1}{z^2 - \sqrt{2}z + 1} \right| + C.
\tag{3} \end{align}$$
A: Here there is slightly  alternative way using a bit of brute force, pushing the decomposition into partial fractions. We can prepare the way for partial fractions by trying to factor the denominator in difference of squares; we can force this like
\begin{align*}1+u^4&=u^4+2u^2-2u^2+1\\
&=(u^4+2u^2+1)-(2u^2)\\
&=(u^2+1)^2-(\sqrt{2}u)^2\\
&=(u^2+1+\sqrt{2}u)(u^2+1-\sqrt{2}u)\\
&=(u^2+\sqrt{2}u+1)(u^2-\sqrt{2}u+1)
\end{align*}
Then we can use partial fraction in order to write
\begin{align*}\frac{1-u^2}{1+u^4}&=\frac{Au+B}{u^2+\sqrt{2}u+1}+\frac{Cu+D}{u^2-\sqrt{2}u+1}\\
&=\frac{\frac{1}{2\sqrt{2}}(2u+\sqrt{2})}{u^2+\sqrt{2}u+1}+\frac{-\frac{1}{2\sqrt{2}}(2u-\sqrt{2})}{u^2-\sqrt{2}u+1}.
\end{align*}
Substitution in each denominator reduce calculus to know $\int \frac{1}{t}dt=\ln|t|+K$. Substitution back give the answer
$$\frac{1}{2\sqrt{2}}\ln \left|\frac{u^2+\sqrt{2}u+1}{u^2-\sqrt{2}u+1} \right|+K$$
