Evaluating $\int\sqrt{\frac{1-x^2}{1+x^2}}\mathrm dx$

I had read the similar problem, but it doesn't work.

Of course it doesn't ! The integral you posted is nothing else than the formula for the arc length

of the $($co$)$sine function, which is rather famous for giving rise historically to the study of elliptic

integrals ! In particular, $\displaystyle\int_0^\tfrac\pi2\sqrt{1+\sin^2x}~dx~=~\int_0^\tfrac\pi2\sqrt{1+\cos^2x}~dx~=~\int_0^1\sqrt{\frac{1~{\color{red}+}~x^2}{1~{\color{red}-}~x^2}}~dx$

$=~\dfrac{\Gamma^2\bigg(\dfrac14\bigg)}{4\sqrt{2\pi}}~{\color{red}+}~\dfrac{\pi\sqrt{2\pi}}{\Gamma^2\bigg(\dfrac14\bigg)}$ . Of course, you will immediately object that this is not the integral you
posted; but this is only half-true, since we have $\displaystyle\int_0^1\sqrt{\frac{1~{\color{red}-}~x^2}{1~{\color{red}+}~x^2}}~dx~=~\dfrac{\Gamma^2\bigg(\dfrac14\bigg)}{4\sqrt{2\pi}}~{\color{red}-}~\dfrac{\pi\sqrt{2\pi}}{\Gamma^2\bigg(\dfrac14\bigg)}$ .

The reason for this lies in the fact that, in general, $\displaystyle\int_0^1\sqrt{\frac{1+x^n}{1-x^n}}~dx~=~a\cdot2^{a-1}~\bigg[\frac12~B\bigg(\frac a2,\frac a2\bigg)$

${\color{red}+}~B\bigg(\dfrac{a+1}2,\dfrac {a+1}2\bigg)\bigg]$, where $a={\color{red}+}~\dfrac1n$ , and $\displaystyle\int_0^1\sqrt[n]{\frac{1+x^2}{1-x^2}}~dx~=~a\cdot2^{a-1}~\bigg[\frac12~B\bigg(\frac a2,\frac a2\bigg)~{\color{red}-}$

${\color{red}-}~B\bigg(\dfrac{a+1}2,\dfrac {a+1}2\bigg)\bigg]$, where $a={\color{red}-}~\dfrac1n$ . See the beta and $\Gamma$ functions for more information.