<s>[INST] Integral $\int \frac{\tan^4 \theta \,d \theta}{1-\tan^2 \theta}$? I have to evaluate this indefinite integral $$\int \frac{\tan^4 \theta\, d \theta}{1-\tan^2 \theta}$$
I tried it as follows $$I=\int\frac{(\sec^2 \theta-1)\tan^2 \theta\, d \theta}{1-\tan^2 \theta}=\int\frac{\sec^2 \theta \tan^2 \theta\, d \theta}{1-\tan^2 \theta}-\int\frac{\tan^2 \theta \,d \theta}{1-\tan^2 \theta}$$
First part of integration can be easily solved by substitution but how to solve the second part? Help to solve it by other method if you have. Thanks!
 [/INST] Here is another way to proceed:
$\displaystyle\int\frac{\tan^4\theta}{1-\tan^2\theta}d\theta=\int\frac{\tan^4\theta-1}{1-\tan^2\theta}d\theta+\int\frac{1}{1-\tan^2\theta}d\theta=-\int(\tan^2\theta+1)d\theta+\int\frac{\cos^2\theta}{\cos^2\theta-\sin^2\theta}d\theta$
$=\displaystyle-\int\sec^2\theta \;d\theta+\int\frac{\frac{1}{2}(1+\cos 2\theta)}{\cos 2\theta}d\theta= -\tan\theta+\int\left(\frac{1}{2}\sec2\theta+\frac{1}{2}\right)d\theta$
$=\displaystyle-\tan\theta+\frac{1}{4}\ln\big|\sec2\theta+\tan2\theta\big|+\frac{1}{2}\theta+C$
</s>