Consider
$$I = \int(\sqrt{\tan x} + \sqrt{\cot x}) dx$$
If we convert everything to $\sin x$ and $\cos x$, and try the substitution $t = \sin x - \cos x$ , we get
$$I= \sqrt2 \int \frac{dt}{\sqrt{1-t^2}} = \sqrt{2} \arcsin(\sin x-\cos x) + C$$
However, if we originally substitute $ \tan x = t^2$, and proceed as how ron gordon did here: Calculate $\int\left( \sqrt{\tan x}+\sqrt{\cot x}\right)dx$, we get a seemingly different answer, which my textbook happens to offer:
$$I=\sqrt{2} \arctan\left(\frac{\tan x-1}{\sqrt{2 \tan x}}\right)+C$$
Wolfram confirms that these two functions are indeed different.
What went wrong?
If we draw a right triangle with an angle $\theta$,with the opposite side as $\tan x-1$ and the adjacent side as $\sqrt{2 \tan x}$, then the hypotenuse becomes $\sec x$.Thus, $\theta=\arctan\left(\frac{\tan x-1}{\sqrt{2 \tan x}}\right) = \arcsin(\sin x - \cos x)$, which should mean the functions are equivalent.
Does it have something to do with the domain of the inverse trig functions?