Tips for integrating $\int \frac{dx}{1+\cos(x)}$

Do the substitution $x=2u$. $$\int \frac{dx}{1+\cos(x)} = 2\int \frac{du}{1+\cos(2u)} = \int \frac{du}{\cos^2(u)} = \tan(u)+C = \tan(x/2)+C.$$


Here are two methodologies that provide a way forward.

METHODOLOGY $1$ Classical Weierstrass Substitution

In this classical and systematic approach, we enforce the substitution $u=\tan(x/2)$.

Then, using $\cos(x)=\frac{1-u^2}{1+u^2}$ and $dx=\frac{2}{1+u^2}\,du$ we find

$$\begin{align} \int \frac{1}{1+\cos(x)}\,dx&=\int \frac{2}{(1+u^2)+(1-u^2)}\,du\\\\ &=u+C\\\\ &=\tan(x/2)+C \end{align}$$

as expected!


METHODOLOGY $2$ Use of Complex Analysis

Note that we can express the cosine function as $\cos(x)=\frac12(e^{ix}+e^{-ix})$. Then, we can write

$$\begin{align} \int \frac{1}{1+\cos(x)}\,dx&=\int \frac{2}{(e^{ix/2}+e^{-ix/2})^2}\,du\\\\ &=\int \frac{2e^{ix}}{(e^{ix}+1)^2}\\\\ &=\frac{2i}{(e^{ix}+1)}+C\\\\ &=\frac{2ie^{-ix/2}}{e^{ix/2}+e^{-ix/2}}+C\\\\ &=\tan(x/2)+i+C\\\\ &=\tan(x/2)+C' \end{align}$$

As was to be shown!


EXTRA

Here we show that $\csc(x)-\cot(x)=\tan(x/2)$. We proceed by writing

$$\csc(x)-\cot(x)=\frac{1-\cos(x)}{\sin(x)}$$

Next, we invoke the identities $1-\cos(x)=2\sin^2(x/2)$ and $\sin(x)=2\sin(x/2)\cos(x/2)$. Therefore, we have

$$\frac{1-\cos(x)}{\sin(x)}=\frac{2\sin^2(x/2)}{2\sin(x/2)\cos(x/2)}=\tan(x/2)$$

as was to be shown!


The usual tables of derivatives tell you that $$ \frac d {dx} \csc x = -\csc x \cot x $$ and $$ \frac d {dx} \cot x = -\csc^2 x $$ so if you've got those, then you're almost done.