Question:
Evaluate: $\int \frac{1}{\cos ^{2} x(1-\tan x)^{2}} d x$
Solution:
Let $I=\int \frac{1}{\cos ^{2} x(1-\tan x)^{2}} d x$
$=\int \frac{1}{\cos ^{2} x(1-\tan x)^{2}} d x$
$=\int \frac{1}{\cos ^{2} x\left(1-\frac{\sin x}{\cos x}\right)^{2}} d x$
$=\int \frac{1}{(\cos x-\sin x)^{2}} d x$
$=\int \frac{1}{1-\sin 2 x} d x$
$=\int \frac{1}{1+\cos \left(\frac{\pi}{2}+2 x\right)} d x$
$=\int \frac{1}{2 \cos ^{2}\left(\frac{\pi}{4}+x\right)} d x$
$=\frac{1}{2} \int \sec ^{2}\left(\frac{\pi}{4}+x\right) d x$
Hence, $I=\frac{1}{8}\left[\tan \left(\frac{\pi}{4}+x\right)\right]+1+C$