Help with $\int\frac{1+\sin x}{(1+2\cos x)\sin x}\;dx$ $$\int\frac{1+\sin x}{(1+2\cos x)\sin x}\;dx$$
I tried to solve this question of integral many times but I don't understand. How do I solve it?
 A: Trigonometric functions can be expressed as rational functions of $t=\tan\frac x2$. Explicitly, here, we need
$$\sin x=\frac{2t}{1+t^2}, \quad\cos x=\frac{1-t^2}{1+t^2}.$$
So we proceed by substitution: if $t=\tan\frac x2$, we have
$$\mathrm dt=\tfrac12\Bigl(1+\tan^2\frac x2\Bigr)\mathrm d x\iff\mathrm d x=\frac{2\,\mathrm dt}{1+\tan^2x} \qquad\text{and}$$
\begin{align}
\int\frac{1+\sin x}{(1+2\cos x)\sin x}\,\mathrm dx&=\int\frac{1+\dfrac{2t}{1+t^2}}{\biggl(1+\cfrac{2(1-t^2)}{1+t^2}\biggr)\dfrac{2t}{1+t^2}}\frac{2\,\mathrm dt}{1+t^2} \\
&=\int\frac{(1+t^2+2t)2\,\mathrm dt}{\bigl(1+t^2+ 2(1-t^2)\bigr)t}=\int\frac{2(1+t)^2}{t(3-t^2)}\,\mathrm dt.
\end{align}
You've come down to the integral of a rational function, which you have to decompose into partial fractions as:
$$\frac{2(1+t)^2}{t(3-t^2)}=\frac At+\frac{Bt}{3-t^2}\quad(A, B\in\mathbf R).$$
A: This calls for the hyperbolic Kepler angle! We make the substitution
$$\begin{align}\sinh\theta=\frac{\sqrt{e^2-1}\sin x}{1+e\cos x},&&\cosh\theta=\frac{\cos x+e}{1+e\cos x},&&d\theta=\frac{\sqrt{e^2-1}}{1+e\cos x}dx\end{align}$$
With $e=2$ for us. We will also need the inverse relation:
$$\sin x=\frac{\sqrt{e^2-1}\sinh\theta}{e\cosh\theta-1}$$
Then
$$\begin{align}\int\frac{\csc x+1}{1+e\cos x}dx&=\int\left(\frac{e\cosh\theta-1}{\sqrt{e^2-1}\sinh\theta}+1\right)\frac{d\theta}{\sqrt{e^2-1}}\\
&=\frac{-1}{e^2-1}\int\text{csch}\,\theta\,d\theta+\frac e{e^2-1}\int\coth\theta\,d\theta+\frac1{\sqrt{e^2-1}}d\theta\\
&=\frac1{e^2-1}\ln\left(\text{csch}\,\theta+\coth\theta\right)+\frac e{e^2-1}\ln\sinh\theta+\frac1{\sqrt{e^2-1}}\theta+C_1\\
&=\frac1{e^2-1}\ln\left\{\frac{1+e\cos x}{\sqrt{e^2-1}\sin x}\left(1+\frac{\cos x+e}{1+e\cos x}\right)\right\}\\
&\quad+\frac e{e^2-1}\ln\left(\frac{\sqrt{e^2-1}\sin x}{1+e\cos x}\right)+\frac1{\sqrt{e^2-1}}\sinh^{-1}\left(\frac{\sqrt{e^2-1}\sin x}{1+e\cos x}\right)+C_1\\
&=\frac1{e^2-1}\ln\left(\frac{(1+e)(1+\cos x)}{\sqrt{e^2-1}\sin x}\right)+\frac e{e^2-1}\ln\left(\frac{\sqrt{e^2-1}\sin x}{1+e\cos x}\right)\\
&\quad+\frac1{\sqrt{e^2-1}}\ln\left(\frac{\sqrt{e^2-1}\sin x}{1+e\cos x}+\frac{\sqrt{(e^2-1)\sin^2x+(1+e\cos x)^2}}{(1+e\cos x)^2}\right)+C_1\\
&=\frac1{e^2-1}\ln(1+\cos x)-\frac1{e^2-1}\ln\sin x+\frac e{e^2-1}\ln\sin x\\
&\quad-\frac e{e^2-1}\ln(1+e\cos x)+\frac1{\sqrt{e^2-1}}\ln\left(\sqrt{e^2-1}\sin x+e+\cos x\right)\\
&\quad-\frac1{\sqrt{e^2-1}}\ln(1+e\cos x)+C\\
&=\frac1{e^2-1}\ln(1+\cos x)+\frac1{e+1}\ln\sin x-\frac{e+\sqrt{e^2-1}}{e^2-1}\ln(1+e\cos x)\\
&\quad+\frac1{\sqrt{e^2-1}}\ln\left(\sqrt{e^2-1}\sin x+e+\cos x\right)+C\end{align}$$
Of course I leave it up to the interseted reader to change all those $e$'s back to $2$'s.
