Integrate $\int\tan^{-1}\sqrt{\frac{1-x}{1+x}}dx$ 
Integrate $\int\tan^{-1}\sqrt{\frac{1-x}{1+x}}dx$

My Attempt
Put $x=\cos2a\implies dx=-2\sin2a.da$
$$
\int\tan^{-1}\sqrt{\frac{1-x}{1+x}}dx=\int\tan^{-1}\sqrt{\frac{1-\cos2a}{1+\cos2a}}.-2\sin2a.da\\
=-2\int\tan^{-1}\sqrt{\frac{2\sin^2a}{2\cos^2a}}.\sin2a.da=-2\int\tan^{-1}(\tan a)\sin2a.da
$$
We have $y=\tan^{-1}(\tan a)\implies\tan y=\tan a\implies y=n\pi+a$
$$
\begin{align}
&\int\tan^{-1}\sqrt{\frac{1-x}{1+x}}dx=-2\int(n\pi+a)\sin2a.da=-2n\pi a-2\int a.\sin2a.da\\
&=-2n\pi a-2\bigg[a\frac{-\cos2a}{2}-\int\frac{-\cos2a}{2}da\bigg]\\
&=-2n\pi a+a.\cos2a+\frac{\sin2a}{2}+C\\
&=-2n\pi.\frac{1}{2}\cos^{-1}x+\frac{1}{2}\cos^{-1}x.x+\frac{\sqrt{1-x^2}}{2}+C\\
&\color{red}{=\frac{1}{2}\bigg[-2n\pi\cos^{-1}x+x\cos^{-1}x-\sqrt{1-x^2}\bigg]}
\end{align}
$$
My reference has the solution $\frac{1}{2}\bigg[x\cos^{-1}x-\sqrt{1-x^2}\bigg]$. But, why am I getting the solution as above ?

You need to notice that you just substituted $$a=\frac {\arccos x}{2}$$ whose range is itself $$\left[0,\frac {\pi}{2 }\right]$$.
And as you might know that for $\alpha \in \left(\frac {-\pi}{2},\frac {\pi}{2}\right)$ ,   $$\arctan (\tan \alpha) =\alpha$$
Hence $$\arctan (\tan a) =a$$ Therefore you won't get an $n\pi$ term
