How to evaluate the following integral ? What substitution will be helpful? $$\int\frac{cotx }{(1-sinx)(secx+1)}dx $$
we can write this as
$$\int \frac {cosecx.cotx}{(cosecx-1)(secx+1)}dx $$
Now $cosecx=t$ gives $cosecx.cotx=-dt $ which appears in the numerator, what to do about  $secx+1$ ?
 A: $$\frac{\cot x}{(1-\sin x)(1+\sec x)}=\frac{1+\sin x}{\sin x(1+\cos x)}=\frac{1}{\sin x(1+\cos x)}+\frac{1}{1+\cos x}$$
Enforcing the Wiereatrass Substitution $\tan(x/2)=u$ and $dx=\frac{2}{u^2+1}\,du$ reveals
$$\begin{align}
\int \frac{\cot x}{(1-\sin x)(1+\sec x)}\,dx&=\int \left(\frac{(u^2+1)^2}{4u}+\frac{u^2+1}{2}\right)\,\frac{2}{u^2+1}du\\\\
&=\int \left(\frac12 u +\frac12 u^{-1}+1\right)\,du\\\\
&=\frac14 \tan^2\left(\frac{x}{2}\right)+\frac12 \log\left(\tan \left(\frac{x}{2}\right)\right)+\tan\left(\frac{x}{2}\right)+C
\end{align}$$
A: $\displaystyle\int\frac{cotx }{(1-sinx)(secx+1)}dx =\int\frac{cos^2x }{sinx(1-sinx)(1+cosx)}dx =\int\frac{1+sinx}{sinx(cosx+1)}dx$
$\displaystyle\int\frac{1+sinx}{sinx(cosx+1)}dx=\int\frac{1}{sinx(cosx+1)}dx+\int\frac{1}{(cosx+1)}dx$
$\displaystyle\int\frac{1}{4sin(x/2)cos^3(x/2)}dx+\int\frac{sec^2(x/2)}{2}dx$
$\displaystyle cos(x/2)=t \Rightarrow dx=\frac{2dt}{-sin(x/2)}$
$\displaystyle -\int\frac{1}{2(1-t^2)\cdot t^3}dt+\int\frac{sec^2(x/2)}{2}dx$
Now usig partial fractions we get ,
$\displaystyle \int\frac{1}{2(1-t^2)\cdot t^3}dt= \frac{-1}{4 t^2} + \frac{ln[t]}{2} - \frac{ln[1 - t^2]}{4}$
$\displaystyle -\int\frac{1}{2(1-t^2)\cdot t^3}dt+\int\frac{sec^2(x/2)}{2}dx=$$\displaystyle  \frac{1}{4 cos^2(x/2)} - \frac{ln[cos(x/2)]}{2}+ \frac{ln[sin^2(x/2)]}{4}+tan^2(x/2)+C$
A: The function can be simplified to
$$
\frac{1}{1+\cos x}+\frac{\csc x}{1+\cos x}.
$$
Since
$$
\int\frac{1}{1+\cos x}\,dx=\frac{\sin x}{1+\cos x}+C,
$$
we only need to take care of the second term. Write it as
$$
\frac{\sin x}{(1-\cos^2x)(1+\cos x)}
$$
and let $u=\cos x$ which will give you
$$
-\int\frac{1}{(1-u^2)(1+u)}\,du
$$
which I'm sure you can handle with partial fraction decomposition. You can compare the final result (of your whole thing) with what I get:
$$
\frac{\sin x}{1+\cos x}+\frac{1}{2(1+\cos x)}+\frac{1}{4}\log\frac{1-\cos x}{1+\cos x}+C.
$$
