Why Doesn't my Integration to Square Root Tan(x) Work?

What is wrong with this solution? https://www.mathcha.io/editor/egPXHEXSj3CD1ip1

$$I=\int \sqrt{\tan x}dx$$ $$u=\sqrt{\tan x}\Rightarrow \frac{2u}{u^2+1}du=dx$$: $$I=2\int\frac{u^2}{u^2+1}du$$ $$I=2\int\frac{u^2+1-1}{u^2+1}du$$ $$I=2\bigg(\int 1du-\int\frac1{u^2+1}du\bigg)$$ $$I=2\big(u-\arctan u\big)+C$$ $$I=2\sqrt{\tan x}-2\arctan\sqrt{\tan x}+C$$

Thanks!

Please do not link other solutions of this integral, I just want to know why the one I did is incorrect, thanks!

• Figuring out LaTeX is pretty much a requirement for using this site. Plus, you'll gain a great skill if you ever have to write-up math in the future. – JonathanZ Nov 24 '18 at 1:09
• I added the LaTex as an edit. Take a look at it so you can see how it's done. – clathratus Nov 24 '18 at 1:16

2 Answers

$$\cos^2 x \neq \frac{1}{1+(\sqrt{\tan{x}})^2}$$. $$\cos^2 x = \frac{1}{1+(\sqrt{\tan{x}})^4} = \frac{1}{1+u^4}$$.

$$u=\sqrt{\tan x}\implies x= \tan ^{-1}\left(u^2\right)\implies dx=\frac{2 u}{u^4+1}\,du$$ $$I=\int \sqrt{\tan x}\,dx=2\int \frac{ u^2}{u^4+1}\,du=\int \frac{ u^2}{\left(u^2-\sqrt{2} u+1\right) \left(u^2+\sqrt{2} u+1\right)}\,du$$ Now, partial fraction decomposition $$I=\frac 1 {\sqrt 2}\left(\int \frac{u}{u^2-\sqrt{2} u+1} \,du-\int \frac{u}{u^2+\sqrt{2} u+1}\,du \right)$$ which becomes to be quite easy.