Let $I = \int \tan ^{-1} \sqrt{\frac{1-x}{1+x}} \, dx$.
Substitute $x = \cos \theta$,so $dx = -\sin \theta \, d\theta$.
Then $I = \int \tan ^{-1} \sqrt{\frac{1-\cos \theta}{1+\cos \theta}} \cdot (-\sin \theta) \, d\theta$.
Using trigonometric identities $\frac{1-\cos \theta}{1+\cos \theta} = \tan^2 \frac{\theta}{2}$,we get:
$I = -\int \tan ^{-1} \left( \tan \frac{\theta}{2} \right) \sin \theta \, d\theta = -\int \frac{\theta}{2} \sin \theta \, d\theta$.
Using integration by parts:
$I = -\frac{1}{2} \left[ \theta \int \sin \theta \, d\theta - \int \left( \frac{d}{d\theta} \theta \cdot \int \sin \theta \, d\theta \right) d\theta \right]$.
$I = -\frac{1}{2} [-\theta \cos \theta + \int \cos \theta \, d\theta] = -\frac{1}{2} [-\theta \cos \theta + \sin \theta] + C$.
$I = \frac{1}{2} \theta \cos \theta - \frac{1}{2} \sin \theta + C$.
Since $\cos \theta = x$,then $\theta = \cos ^{-1} x$ and $\sin \theta = \sqrt{1-x^2}$.
Thus,$I = \frac{1}{2} x \cos ^{-1} x - \frac{1}{2} \sqrt{1-x^2} + C = \frac{1}{2} (x \cos ^{-1} x - \sqrt{1-x^2}) + C$.