$\int \frac{\sqrt{1+x^2}}{1-x^2}dx$ Problem : 
$\int \frac{\sqrt{1+x^2}}{1-x^2}dx$
My approach : 
Put $x = \tan\theta$ 
we get $$\int \frac{\sqrt{1+x^2}}{1-x^2}dx  = \frac{\frac{\sin^2\theta + \cos^2\theta}{\cos^2\theta \cos\theta}}{\frac{\cos^2\theta -\sin^2\theta}{\cos^2\theta}} d\theta $$
$$= \frac{1}{(\cos^2\theta -\sin^2\theta)\cos\theta}d\theta$$ 
But is it the right approach please guide will be of great help thanks. 
 A: HINT:
$$\int\dfrac{dy}{(\cos^2y-\sin^2y)\cos y} =\int\dfrac{\cos y\ dy}{(1-2\sin^2y)(1-\sin^2y)}$$
Set $\sin y=u$
Use Partial Fraction Decomposition,
$$\dfrac1{(1-2u^2)(1-u^2)}=\dfrac A{(\sqrt2)^2-u^2}+\dfrac B{1-u^2}$$
A: Let $$\displaystyle I = \int\frac{\sqrt{1+x^2}}{1-x^2}dx = \int\frac{(1+x^2)}{(1-x^2)\sqrt{1+x^2}}dx = -\int\frac{(x^2+1)}{(x^2-1)\sqrt{1+x^2}}dx$$
So $$\displaystyle I =-\int\frac{(x^2-1)+2}{(x^2-1)\sqrt{x^2+1}}dx = -\underbrace{\int\frac{1}{\sqrt{x^2+1}}dx}_{J}+2\underbrace{\int\frac{1}{(1-x^2)\sqrt{1+x^2}}dx}_{K}$$
So Here $$\displaystyle J = \int\frac{1}{\sqrt{x^2+1}}dx = \ln|x+\sqrt{x^2+1}|+\mathcal{C_{1}}$$
Now $$\displaystyle K = \int\frac{1}{(1-x^2)\sqrt{1+x^2}}dx\;,$$ Now Put $\displaystyle x=\frac{1}{t}\;,$ Then $\displaystyle dx = -\frac{1}{t^2}dt$
So we get $$\displaystyle K = -\int\frac{t}{(t^2-1)\sqrt{t^2+1}}dt\;,$$ Now Put $(t^2+1) = u^2\;,$ Then $tdt=udu$
So Integral $$\displaystyle K = -\int\frac{1}{u^2-\left(\sqrt{2}\right)^2}du = -\frac{1}{\sqrt{2}}\ln\left|\frac{u-\sqrt{2}}{u+\sqrt{2}}\right|+\mathcal{C_{2}}$$
So we get $$\displaystyle K=-\frac{1}{\sqrt{2}}\ln\left|\frac{\sqrt{t^2+1}-\sqrt{2}}{\sqrt{t^2+1}+\sqrt{2}}\right|+\mathcal{C_{2}}$$
So we get $$\displaystyle I = -\ln|x+\sqrt{x^2+1}|-\sqrt{2}\ln\left|\frac{\sqrt{x^2+1}-\sqrt{2}x}{\sqrt{x^2+1}+\sqrt{2}x}\right|+\mathcal{C}$$
A: Letting $t=\frac{x}{\sqrt{x^{2}+1}}$, then $$
x^{2}=\frac{t^{2}}{1-t^{2}}=\frac{1}{1-t^{2}}-1 \Rightarrow  2 x d x=\frac{2 t d t}{1-t^{2}} \Rightarrow\sqrt{x^{2}+1} d x=\frac{d t}{1-t^2}$$
Plugging them into the integral yields
\begin{aligned}
I &=\int \frac{1}{1-\frac{t^2}{1-t^{2}}} \cdot \frac{d t}{1-t^{2}} \\
&=\int \frac{d t}{1-2 t^{2}} \\
&=\frac{1}{2\sqrt{2}} \ln \left|\frac{\sqrt{2} t+1}{\sqrt{2} t-1}\right|+C\\& =\frac{1}{2\sqrt{2}} \ln \left|\frac{\sqrt{2} x+\sqrt{x^{2}+1}}{\sqrt{2} x-\sqrt{x^{2}+1}}\right|+C
\end{aligned}
