<s>[INST] Indefinite integral of trignometric function What is the trick to integrate the following
$$\int \frac{1-\cos x}{(1+\cos x)\cos x}\ dx$$
 [/INST] Hint :
\begin{align}
\int\frac{1-\cos x}{\cos(1+\cos x)}\ dx&=\int\frac{\color{red}{1+\cos x}-2\cos x}{\cos(\color{red}{1+\cos x})}\ dx\\
&=\int\frac1{\cos x}\ dx-\int\frac{2}{1+\cos x}\ dx\\
&=\int\frac{\cos x}{\cos^2 x}\ dx-\int\frac{2}{1+\cos x}\cdot\frac{1-\cos x}{1-\cos x}\ dx\\
&=\int\frac{d(\sin x)}{1-\sin^2 x}-\int\frac{2-2\cos x}{1-\cos^2 x}\ dx\\
&=\int\frac{d(\sin x)}{2(1-\sin x)}-\int\frac{d(\sin x)}{2(1+\sin x)}-\int\frac{2-2\cos x}{\sin^2 x}\ dx\\
&=\int\frac{d(\sin x)}{2(1-\sin x)}-\int\frac{d(\sin x)}{2(1+\sin x)}-\int\frac{2}{\sin^2 x}\ dx+2\int\frac{\cos x}{\sin^2 x}\ dx\\
&=\int\frac{d(\sin x)}{2(1-\sin x)}-\int\frac{d(\sin x)}{2(1+\sin x)}-2\int\csc^2x\ dx+2\int\frac{d(\sin x)}{\sin^2 x}\\
&=\int\frac{d(\sin x)}{2(1-\sin x)}-\int\frac{d(\sin x)}{2(1+\sin x)}+2\int\ d(\cot x)+2\int\frac{d(\sin x)}{\sin^2 x}.
\end{align}
</s>