<s>[INST] Tips for integrating $\int \frac{dx}{1+\cos(x)}$ I tried the following
$$ 
\int \frac{dx}{1+\cos(x)}=\int \frac{1-\cos(x)}{1-\cos^2(x)}\,dx=
\int \frac{1-\cos(x)}{\sin^2(x)}\,dx\\
=\int \frac{1}{\sin^2(x)}\,dx-\int \frac{\cos(x)}{\sin^2(x)}\,dx=\int \csc^2x\,dx-\int \cot(x)\csc(x)\,dx
$$
Which I looked up and found to be equal to 
$$
\csc(x)-\cot(x)+c
$$
Do I need to memorize the final identity, or is there a more elegant way to evaluate this integral?
 [/INST] Here is a method similar to C. Dubussy's solution except no substitution needs to be made.
Recalling $1 = \cos^2 \frac{x}{2} + \sin^2 \frac{x}{2}$ and $\cos x = \cos^2 \frac{x}{2} - \sin^2 \frac{x}{2}$, the integral may be written as
\begin{align*}
\int \frac{dx}{1 + \cos x} &= \int \frac{dx}{\left (\cos^2 \frac{x}{2} + \sin^2 \frac{x}{2}\right ) + \left (\cos^2 \frac{x}{2} - \sin^2 \frac{x}{2} \right )}\\
&= \int \frac{dx}{2 \cos^2 \frac{x}{2}}\\
&= \frac{1}{2} \int \sec^2 \frac{x}{2} \, dx\\
&= \tan \frac{x}{2} + \cal{C}
\end{align*}
</s>