Integral involving composition of Trig. and Inverse Trig. functions. For a minor class i am taking this year, I found the following integral in a problem set, and where i had no luck in evaluating it: $$\int \cos(2\cot^{-1}\sqrt{\frac{(1-x)}{(1+x)}})dx$$.
I proceeded as follows:
->first, let $x=\cos(2\theta)$ $\implies$ $dx=-2\sin2\theta d\theta$ so the integral becomes: $$\int \cos(2\cot^{-1}\sqrt{\frac{(1-\cos(2\theta))}{(1+\cos(2\theta))}}).-2\sin2\theta d\theta =\int \cos(2\cot^{-1}\sqrt{\frac{(\sin^2(\theta))}{(\cos^2\theta)}}).-2\sin2\theta d\theta\\=\int \cos(2\cot^{-1}(\tan\theta).-2\sin2\theta d\theta=\int \cos(\frac{2}{\theta}).-2\sin2\theta d\theta$$
After this i am stuck. How do i proceed? I cant seem to find any mistakes with my substitution and the succeeding lines. Where did i make a mistake(if any) though? Can i still use this substitution?. I tried looking this up for some guidance and in this online integral solver i found, https://www.integral-calculator.com/ , they used some other method to get to the right answer which i didn't quite understand(refer to image). I wanted to keep using a substitution method if possible.

 A: Remember cosine double angle identity tells us that
$$\cos 2\theta = \cos^2\theta-\sin^2\theta$$
Here $\theta = \tan^{-1}\sqrt{\frac{1+x}{1-x}}$. Drawing a triangle, this means the hypotenuse has to be $$\sqrt{(\sqrt{1+x})^2+(\sqrt{1-x})^2} = \sqrt{2}$$
which means we have that
$$\cos\theta = \sqrt{\frac{1-x}{2}}$$
$$\sin\theta = \sqrt{\frac{1+x}{2}}$$
$$\cos 2\theta = \frac{1-x}{2}-\frac{1+x}{2} = -x$$
and the integral is simply
$$\int-x dx = -\frac{1}{2}x^2 + C$$
A: You can proceed by noting that $\tan \theta = \cot \left(\dfrac \pi 2-\theta\right)$ (if you so wish).
Then:
$$\begin{align}&\int\cos(2\cot^{-1}(\tan \theta))\cdot -2\sin2\theta d\theta \\=& \int\cos(\pi-2\theta)\cdot -2\sin2\theta d\theta \\=& \int-\cos(2\theta)\cdot -2\sin2\theta d\theta\\=&\int -x dx\end{align}$$
but that is equivalent to the identity.
A: Have you considered just doing the trigonometry?
$\cos(2 \theta) = 2\cos^2(\theta) - 1$ (and there are other choices for the double-angle formula for cosine).  So \begin{align*}
\cos \left( 2 \cot^{-1} \frac{\sqrt{1-x}}{\sqrt{1+x}} \right) &= 2 \cos^2 \left( \cot^{-1} \frac{\sqrt{1-x}}{\sqrt{1+x}} \right) - 1  \\
   &= 2 \left(\frac{\sqrt{1-x}}{\sqrt{2}}\right)^2  - 1  \\
   &= -x  \text{,}
\end{align*}
where we use the fact that the cotangent is the adjacent over the opposite (with hypotenuse $\sqrt{(\sqrt{1+x})^2 + (\sqrt{1-x})^2} = \sqrt{2}$), and the cosine is the adjacent over the hypotenuse, so is $\sqrt{1-x} / \sqrt{2}$.
A: Hint:
WLOG let $x=-\cos2t,0\le2t\le\pi$
$$\text{arccot}\sqrt{\dfrac{1-x}{1+x}}=\text{arccot}(\cot t)=t\text{ as } 0\le t\le\dfrac\pi2$$
$$\cos\left(\text{arccot}\sqrt{\dfrac{1-x}{1+x}}\right)=\cos(2t)=-x$$
A: Totally off-topic
$$\sqrt{\frac{1-x}{1+x}}=1-x+\frac{x^2}{2}-\frac{x^3}{2}+\frac{3 x^4}{8}-\frac{3 x^5}{8}+\frac{5
   x^6}{16}-\frac{5 x^7}{16}+\frac{35 x^8}{128}-\frac{35 x^9}{128}+O\left(x^{10}\right)$$
$$\cot ^{-1}\left(\sqrt{\frac{1-x}{1+x}}\right)=\frac{\pi }{4}+\frac{x}{2}+\frac{x^3}{12}+\frac{3 x^5}{80}+\frac{5
   x^7}{224}+\frac{35 x^9}{2304}+O\left(x^{10}\right)$$
$$\cos \left(2 \cot ^{-1}\left(\sqrt{\frac{1-x}{1+x}}\right)\right)=-x+O\left(x^{10}\right)$$
