Find $\int \frac{{\rm d}x}{1+e\cos x}$ 
Find $$\int \frac{{\rm d}x}{1+e\cos x}$$

*

*When $e$ lies between $0$ and $1$

*When $e$ is greater than $1$


I got $\int \frac{dx}{1+e\cos x}$ when $e$ lies between $0$ and $1$, by substituting $\tan\frac{x}{2} =t$.
$$\int \frac{dx}{1+e\cos x} = \frac{2}{\sqrt{1-e^2}} \tan^{-1}\left( \frac{\sqrt{1-e}}{\sqrt{1+e}}\tan \frac{x}{2} \right) +C,$$
which will not be valid for $e >1.$
What different attempt we can do for $e>1$?
 A: Substituting $t=\tan(\frac{x}{2})$ we obtain for $e\neq1$ (and the case $e=1$ gives $\int \frac{dx}{1+\cos x}=\tan(\frac{x}{2})+c_1$)
$$\int \frac{dx}{1+e\cos x}=\int \frac{2}{1+t^2+e(1-t^2)}dt$$
$$=\int\frac{2}{t^2(1-e)+(1+e)}dt=\int\frac{2}{(1-e)\left(t^2+\frac{1+e}{1-e}\right)}dt=\frac{2}{1-e}\int\frac{1}{t^2+\frac{1+e}{1-e}}dt$$
$\bullet$ Then for $0<e<1$ you can use the $\tan$ substitution to obtain $\arctan$ function (as you did).
$\bullet$ For $e>1$, you can use partial fractions decomposition to obtain logarithms. To make the calculations simpler, you can let $c^2=-\frac{1+e}{1-e}$, then you have $\int\frac{1}{t^2-c^2}dt$
A: \begin{align}
& \int \frac{dx}{1+e\cos x} = \int \frac{\frac{2\,dt}{1+t^2}}{1+e\cdot\frac{1-t^2}{1+t^2}} \\[8pt]
= {} & \int \frac{2\,dt}{(1+t^2) + e(1-t^2)} \\[8pt]
= {} & \int \frac{2\,dt}{(1+e) + (1-e)t^2} \\[8pt]
= {} & \frac 1 {1+e} \int \frac{dt}{1 + \frac{1-e}{1+e}\cdot t^2} \\[8pt]
& \text{Then if } e<1 \text{ we get this:} \\
= {} & \frac 1 {(1+e)\sqrt A} \int \frac{\sqrt A\,dt}{1+At^2}
\text{ where } A = \frac{1-e}{1+e} \\[8pt]
= {} & \frac 1 {(1+e)\sqrt A} \int \frac{du}{1+u^2} \text{ and so on.} \\[8pt]
& \text{If } e>1 \text{ then we have} \\[8pt]
& \frac 1 {1+e} \int \frac{dt}{1 - Bt^2} \text{ where } B=-A \\[8pt]
= {} & \frac 1 {1+e} \int \frac{dt}{(1 - t\sqrt B)(1 + t\sqrt B)} \\[8pt]
= {} & \frac 1 {1+e} \int \left( \frac C {1-t\sqrt B} + \frac D{1+t\sqrt B} \right) \, dt \\
& \text{and then you have to do} \\
& \text{some algebra to find $C$ and $D$.}
\end{align}
