Integral evaluation (step-by-step) I'm trying to evaluate the integral by exponent. Could you help me with following steps?
Integral: $$\int \frac{1}{4+\sin(x)} dx$$
$$\sin x=\frac{e^{ix}-e^{-ix}}{2i}$$
$$\int \frac{1}{4+sin(x)} dx = \int \frac{1}{4+\frac{e^{ix}-e^{-ix}}{2i}} dx = \int \frac{2i}{8i+e^{ix}-e^{-ix}} dx$$
Is it possible? Or any ways exist?
Thanks in advance.
 A: with $$\sin(x)=\frac{2t}{1+t^2}$$ and $$dx=\frac{2}{1+t^2}dt$$ we get $$\int\frac{1}{2t^2+t+2}dt$$ a rational intagral hint: the result is $$\frac{2 \tan ^{-1}\left(\frac{4 t+1}{\sqrt{15}}\right)}{\sqrt{15}}$$
A: Let be $t = \tan(\frac{x}{2})$ so that $$\sin x=\frac{2t}{1+t^2},\quad\cos x=\frac{1-t^2}{1+t^2},\quad\operatorname{d}\!x=\frac{2 \operatorname{d}\!t}{1 + t^2}$$
and the integral becomes
$$
\int \frac{\operatorname{d}\!t}{2t^2+t+2}=\frac{1}{2}\int \frac{\operatorname{d}\!t}{\left(t+\frac{1}{4}\right)^2+\frac{15}{16}}=8\int \frac{\operatorname{d}\!t}{\left(\frac{4t+1}{\sqrt{15}}\right)^2+1}
$$
Then putting $u=\frac{4t+1}{\sqrt{15}},\,\operatorname{d}\!u=\frac{4}{\sqrt{15}}\operatorname{d}\!t$ we obtain 
$$
\frac{2}{\sqrt{15}}\int \frac{\operatorname{d}\!t}{u^2+1}=\frac{2}{\sqrt{15}}\arctan u+\text{constant}.
$$
Finally we have $u=\frac{4t+1}{\sqrt{15}}=\frac{4\tan(\frac{x}{2})+1}{\sqrt{15}}$ and the integral is
$$
\int\frac{\operatorname{d}\!x}{4+\sin x}=\frac{2}{\sqrt{15}}\arctan\left(\frac{4\tan(\frac{x}{2})+1}{\sqrt{15}}\right)+\text{constant}
$$
A: you can use:
$u = \tan \frac{x}{2} \Leftrightarrow \left\{ \begin{array}{l}
 \sin x = \frac{{2u}}{{1 + u^2 }} \\ 
 dx = \frac{{2du}}{{1 + u^2 }} \\ 
 x = 2\arctan u \\ 
 \end{array} \right.$
A: We can rewrite your integral as
$$
\int \frac{2i\, e^{ix}}{e^{2ix} + 8i \, e^{ix} - 1}dx
$$
We can make the substitution $u = e^{ix}$ to rewrite this as
$$
\int \frac{2}{u^2 + 8i\,u - 1}\,du
$$
This is now the integral of a rational expression, which can be evaluated using partial frations.
A: $$a > \left| b \right|;\frac{{2\pi }}{{\sqrt {a^2  - b^2 } }} = \int\limits_0^{2\pi } {\frac{{d\theta }}{{a + b\sin \theta }}} $$
A: To make it more general, let us consider the case of $$I=\int \frac{dx}{a+b\sin(x)+c\cos(x)}$$ and, as other answers proposed, use the tangent half-angle substitution (Weierstrass substitution) $$t = \tan(\frac{x}{2}),\quad\sin x=\frac{2t}{1+t^2},\quad\cos x=\frac{1-t^2}{1+t^2},\quad\operatorname{d}\!x=\frac{2 \operatorname{d}\!t}{1 + t^2}$$  This will lead to $$I=2\int \frac{dt}{(a-c)t^2+2bt+(a+c)}$$ Completing the square $$(a-c)t^2+2bt+(a+c)=(a-c)\Big((t+\frac{b}{a+c})^2+\frac{a^2-b^2-c^2}{(a-c)^2}\Big)$$ $$I=\frac{2}{a-c}\int  \frac{dt}{\left(t+\frac{b}{a-c}\right)^2+\frac{a^2-b^2-c^2}{(a-c)^2}}$$ where you recognize some standard antiderivatives.
A: $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,{\rm Li}_{#1}}
 \newcommand{\norm}[1]{\left\vert\left\vert\, #1\,\right\vert\right\vert}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
\begin{align}&\color{#66f}{\large\int{\dd x \over 4 + \sin\pars{x}}}
=\int{4 - \sin\pars{x} \over 16 - \sin^{2}\pars{x}}\,\dd x
=\int{4 - \sin\pars{x} \over 15 + \cos^{2}\pars{x}}\,\dd x
\\[5mm]&=\int{4 \over 15 + \cos^{2}\pars{x}}\,\dd x
-\int{\sin\pars{x} \over 15 + \cos^{2}\pars{x}}\,\dd x
\\[5mm]&=4\int{\sec^{2}\pars{x} \over 15\sec^{2}\pars{x} + 1}\,\dd x
-\int{\sin\pars{x} \over 15 + \cos^{2}\pars{x}}\,\dd x
\\[5mm]&={4 \over \root{15}}\int{\root{15}\sec^{2}\pars{x}/4 \over \bracks{\root{15}\tan\pars{x}/4}^{2} + 1}\,\dd x
-{1 \over \root{15}}\int{\sin\pars{x}/\root{15} \over
\bracks{\cos\pars{x}/\root{15}}^{2} + 1}\,\dd x
\\[1cm]&={4\root{15} \over 15}
\int{1 \over \bracks{\root{15}\tan\pars{x}/4}^{2} + 1}
\,\dd\bracks{\root{15}\tan\pars{x} \over 4}
\\[5mm]&+{\root{15} \over 15}\int{\dd\bracks{\cos\pars{x}/\root{15}} \over  \bracks{\cos\pars{x}/\root{15}}^{2} + 1}
\\[1cm]&=\color{#66f}{\large{4\root{15} \over 15}\,\arctan\pars{{\root{15} \over 4}\,\tan\pars{x}}
+{\root{15} \over 15}\,\arctan\pars{{\root{15} \over 15}\,\cos\pars{x}}}
\\[5mm]&+\mbox{a constant}
\end{align}
