TITLE: Evaluation of $\int \frac{1-\sin x}{(1+\sin x)\cos x}dx$
QUESTION [5 upvotes]: Evaluate $$I=\int \frac{(1-\sin x) dx}{(1+\sin x)\cos x}$$
I tried in the following way:
$$1-\sin x=1-\cos\left(\frac{\pi}{2}-x\right)=2 \sin^2\left(\frac{\pi}{4}-\frac{x}{2}\right)$$ 
Similarly $$1+\sin x=2 \cos^2\left(\frac{\pi}{4}-\frac{x}{2}\right)$$ 
So
$$I=\int \tan^2\left(\frac{\pi}{4}-\frac{x}{2}\right) \sec x \: dx=\int \sec^2\left(\frac{\pi}{4}-\frac{x}{2}\right) \sec x \: dx-\int \sec x \:dx$$ 
If $$J=\int \sec^2\left(\frac{\pi}{4}-\frac{x}{2}\right) \sec x \: dx$$ Applying parts for $J$ we get
$$J=-2\sec x \tan\left(\frac{\pi}{4}-\frac{x}{2}\right)+2\int \sec x \tan x \tan\left(\frac{\pi}{4}-\frac{x}{2}\right)dx  $$
But i am clueless from here

REPLY [6 votes]: Multiply both numerator and denominator by $\;1+\sin x\;$ , so you get ( observe that $\;\cos x=(1+\sin x)'\;$):
$$\int\frac{\cos x}{(1+\sin x)^2}dx=-\frac1{1+\sin x}+K$$