Step 1: Key Idea:
Write $\sqrt{\tan x}+\sqrt{\cot x}$ as a single expression in $\sqrt{\tan x}$ only.
$\sqrt{\tan x}+\sqrt{\cot x}=\sqrt{\tan x}+\dfrac{1}{\sqrt{\tan x}}=\dfrac{\tan x+1}{\sqrt{\tan x}}$.
Step 2: Substitute $u=\sqrt{\tan x}$:
Then $\tan x=u^2$, and differentiating $x=\tan^{-1}(u^2)$ gives $dx=\dfrac{2u}{1+u^4}du$.
The integrand becomes:
\[ \frac{u^2+1}{u}\cdot\frac{2u}{1+u^4}\,du=\frac{2(u^2+1)}{1+u^4}\,du \]
Step 3: Divide by $u^2$ and use a new substitution:
Divide numerator and denominator by $u^2$: $\dfrac{2(1+1/u^2)}{u^2+1/u^2}du$.
Let $w=u-\dfrac1u$, so $dw=\left(1+\dfrac1{u^2}\right)du$ and $u^2+\dfrac1{u^2}=w^2+2$.
The integral becomes $\displaystyle\int\dfrac{2\,dw}{w^2+2}$.
Step 4: Integrate and go back to x:
Use $\displaystyle\int\dfrac{dw}{w^2+a^2}=\dfrac1a\tan^{-1}\dfrac wa+C$ with $a=\sqrt2$.
\[ \int\frac{2\,dw}{w^2+2}=\sqrt2\tan^{-1}\frac{w}{\sqrt2}+C \]
Now put back $w=u-\dfrac1u=\sqrt{\tan x}-\dfrac{1}{\sqrt{\tan x}}=\dfrac{\tan x-1}{\sqrt{\tan x}}$.
Final Answer:
This gives an equivalent closed form of the same integral.
\[ \boxed{\int\left[\sqrt{\tan x}+\sqrt{\cot x}\right]dx=\sqrt2\tan^{-1}\left(\frac{\tan x-1}{\sqrt2\,\sqrt{\tan x}}\right)+C} \]