Evaluation of $\int\frac{1}{1-\tan^2 x}dx$ Evaluation of $\displaystyle \int\frac{1}{1-\tan^2 x}dx$
$\bf{My\; Try::}$ We can write $$\displaystyle \int\frac{1}{(1-\tan x)\cdot (1+\tan x)}dx = \frac{1}{2}\int\frac{(1+\tan x)+(1-\tan x)}{(1-\tan x)\cdot (1+\tan x)}dx$$
So We get $$\displaystyle = \frac{1}{2}\int\frac{1}{1-\tan x}dx+\frac{1}{2}\int\frac{1}{1+\tan x}dx = \frac{1}{2}I + \frac{1}{2}J$$
Now Let $$\displaystyle I = \int\frac{1}{1-\tan x}dx  = \frac{1}{2}\int\frac{2\cos x}{\cos x-\sin x}dx = \frac{1}{2}\int\frac{(\cos x+\sin x)+(\cos x-\sin x)}{\cos x-\sin x}dx$$
So we get $$\displaystyle = \frac{1}{2}\int\frac{(\cos x+\sin x)}{(\cos x-\sin x)}dx+\frac{1}{2}x = -\frac{1}{2}\ln\left|\cos x-\sin x\right|+\frac{1}{2}x$$
Now Let $$\displaystyle I = \int\frac{1}{1+\tan x}dx  = \frac{1}{2}\int\frac{2\cos x}{\cos x+\sin x}dx = \frac{1}{2}\int\frac{(\cos x+\sin x)+(\cos x-\sin x)}{\cos x+\sin x}dx$$
So we get $$\displaystyle = \frac{1}{2}\int\frac{(\cos x+\sin x)}{(\cos x-\sin x)}dx-\frac{1}{2}x = +\frac{1}{2}\ln\left|\cos x+\sin x\right|+\frac{1}{2}x$$
So $$\displaystyle \int\frac{1}{1-\tan^2 x}dx = -\frac{1}{2}\ln\left|\cos x-\sin x\right|+\frac{1}{2}\ln\left|\cos x+\sin x\right|+x+\mathcal{C}$$
Can we solve it any short method, If yes then plz explain here, Thanks

Perhaps this might be a bit shorter
\begin{align*}
\frac{1}{1-\tan^2 x} & = \frac{\cos^2x}{\cos^2x-\sin^2x}\\
& = \frac{1+\cos2x}{2\cos2x}\\
& = \frac{1}{2}\sec 2x+\frac{1}{2}.
\end{align*}
Now you just have to integrate $\sec 2x$. This is a routine problem (multiply numerator and denominator by $\sec 2x + \tan 2x$).
