$$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.

  1. 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?

  • $\begingroup$ To avoid any confusion, the proposed solution with arctan is $\arctan\left(\frac{\tan(x)-1}{\sqrt{2 \tan(x)}}\right)$. $\endgroup$
    – Ted
    Jan 26, 2020 at 19:23
  • $\begingroup$ Could you be a bit more explicit with your first computation? It's not obvious to me where that $t$-sub is coming from. So I can't vouch for or against it. $\endgroup$
    – Jose27
    Jan 26, 2020 at 19:24

2 Answers 2


The domain of the integrand $\sqrt{\tan x}+\sqrt{\cot x}$ is the first and third quadrants, while $\sqrt2\arcsin(\sin x- \cos x)$ is only valid for the first quadrant. The anti-derivative for both quadrants is instead

$$\sqrt2\arcsin(|\sin x|- |\cos x|)$$

that is

$$ \arctan\frac{\tan x-1}{\sqrt{2 \tan x}}=\arcsin(|\sin x|- |\cos x|) $$


If you plot both of your answers, you see that the one with arctan is increasing everywhere, but the one with arcsin alternates between increasing and decreasing. Since the original function is the sum of two square roots, it is positive everywhere it is defined, so an antiderivative must be increasing everywhere. So the arctan one is correct, and the arcsin one is not correct.

The two versions agree on half the intervals but are negatives of each other on the other half.

I haven't looked at the solutions in detail but the issue must be related to either the domain of the inverse trig functions or the sign of the square root in the original function.

  • $\begingroup$ @almagest This is correct based on the current edit. $\endgroup$
    – Ted
    Jan 26, 2020 at 19:40
  • $\begingroup$ +1 You are right. The problem is that $t=\sin x-\cos x$ is decreasing from $\pi$ to $3\pi/2$, so $dt$ has the wrong sign or something similar. Anyway you did sterling work in sorting out the question! $\endgroup$
    – almagest
    Jan 26, 2020 at 19:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .