$\int_0^{\frac{\pi}{2}}(\sqrt{\tan x}+\sqrt{\cot x})\mathrm dx $

calculusdefinite integralsintegration

$$\int_0^{\frac{\pi}{2}}(\sqrt{\tan x}+\sqrt{\cot x})\mathrm dx $$
my attempt :multiply and divide the $\sqrt{\tan(x)}$ term by $\sec^2(x)$ and similarly the $\sqrt{\cot(x)}$ by $\csc^2(x)$
and say $\tan x=u^2$ and $\cot x=y^2$
so we get
$$\int_0^\frac{{\pi}}{2} (\frac{2u^2}{1+u^4}\mathrm du- \frac{2y^2}{1+y^4}\mathrm dy)$$

which is $0$.

and that is obviously wrong
I have seen this answer here that effectively uses the same sub I did , but in a different way. Hence the question.

What am I doing wrong?

Best Answer

$$\int_0^{\frac{\pi}{2}}(\sqrt{\tan x}+\sqrt{\cot x})\mathrm dx=\int_0^{+\infty}\frac{2u^2}{1+u^4}\mathrm du+\int_{+\infty}^0\frac{-2y^2}{1+y^4}\mathrm dy.$$