Simplifying the integral $\int\frac{dx}{(3 + 2\sin x - \cos x)}$ by an easy approach $$I=\displaystyle\int\frac{dx}{(3 + 2\sin x - \cos x)}$$
If $$\tan\left(\frac{x}{2}\right)=u$$
or $$x=2\cdot\tan^{-1}(u)$$
Then,
$$\sin{x}=\dfrac{2u}{1+u^2}$$
$$\cos{x}=\dfrac{1-u^2}{1+u^2}$$
$$dx=\dfrac{2}{1+u^2}$$
Substitute $$\tan\left(\dfrac{x}{2}\right)=u$$
Let us simplify the integrand before integrating
$$\dfrac{1}{3+2\sin{x}-\cos{x}}$$
$$=\dfrac{1}{3+2\frac{2u}{1+u^2}-\frac{1-u^2}{1+u^2}}$$
$$=\dfrac{1}{3+\frac{4u-1+u^2}{1+u^2}}$$
$$=\dfrac{1}{\frac{4u-1+u^2+3+3u^2}{1+u^2}}$$
$$=\dfrac{1+u^2}{4u^2+4u+2}$$
$$=\dfrac{1+u^2}{(2u+1)^2+1}$$
$$I=\displaystyle\int\dfrac{1+u^2}{(2u+1)^2+1}\cdot\dfrac{2}{1+u^2}\ du$$
$$=\displaystyle\int\dfrac{1}{(2u+1)^2+1}\ 2\,du$$
Now,
Take :  $$v=2u+1$$
Therefore, $$dv=2\,du$$
$$I=\displaystyle\int\dfrac{1}{v^2+1}\ dv$$
$$I=\tan^{-1}(v)$$
Substitute everything back
$$I=\tan^{-1}(2u+1)$$
$$I=\tan^{-1}\left(2\tan\left(\frac{x}{2}\right)+1\right)$$
$$\boxed{\displaystyle\int\frac{dx}{(3 + 2\sin x - \cos x)} = \tan^{-1}\left(2\tan\left(\frac{x}{2}\right)+1\right)+C}$$
I know that my approach is also not so difficult but still I think there must be an relatively easy approach to this integral. I have tried many different things using trigonometric identities but nothing seems to bring to the solution easily. Kindly help me out.
 A: Generally, consider the real function
$$f(x)=\frac{1}{a+b\cos x+c\sin x}$$
With $a^2>b^2+c^2$ so that $f$ is defined on $\mathbb{R}$.
It is not hard to check that the derivative of 
$$F(x)=\frac{x}{d}+\frac{2}{d}\arctan\left(\frac{c\cos x-b\sin x}{d+a+b\cos x+c\sin x}\right)$$
with $d=\sqrt{a^2-b^2-c^2}$, is $f(x)$. So $\int f(x)dx=F(x)+k$. The advantage
of this expression of $F$ is that it is also defined on $\mathbb{R}$. In particular,
$$\int \frac{1}{3-\cos x+2\sin x}=\frac{x}{2}+\arctan\left(\frac{2\cos x+\sin x}{5-\cos x+2\sin x}\right)$$
A: Remember the following trigonometric equations, which are always very helpful to solve integrals:
$$
\begin{matrix}
2\cos(u)^2 = 1 + \cos(2u) & & & \left(\cos(u) + \sin(u)\right)^2 = 1 + \sin(2u) \\
2\sin(u)^2 = 1 - \cos(2u) & & & \left(\cos(u) - \sin(u)\right)^2 = 1 - \sin(2u)  \\
\end{matrix}
$$
Note that you can make a mnemonic to remember these equations.

With them, you can solve the integral:
$$
I = \int \dfrac{dx}{3+2\sin(x)-\cos(x)}
$$
Using the following procedure:


*

*Replace with $\;\;u=\frac{x}{2} \;\;\Rightarrow\;\; dx = 2 du$:
$$
\begin{align}
I &= 2 \int \dfrac{du}{3+2\sin(2u)-\cos(2u)}
\end{align}
$$

*Rewrite the expression to a known trigonometric expression:
$$
\begin{align}
I&= 2 \int \dfrac{du}{2\left(1+\sin(2u)\right) + \left(1-\cos(2u)\right)}
\end{align}
$$

*Replace with the corresponding trigonometric equations:
$$
\begin{align}
I&= 2 \int \dfrac{du}{2\left(\cos(u) + \sin(u)\right)^2 + 2\sin(u)^2}
\end{align}
$$


*Extract common factor by non-binomial term:
$$
\begin{align}
I&= 2 \int \dfrac{1}{\left(\dfrac{\cos(u)}{\sin(u)} + 1\right)^2 + 1 } \cdot\dfrac{1}{2\sin(u)^2} du = \int \dfrac{1}{\left(\cot(u) + 1\right)^2 + 1 } \cdot \csc(u)^2 du
\end{align}
$$


*Replace with $\;\;\omega=\cot(u) + 1 \;\;\Rightarrow\;\; d\omega = -\csc(u)^2 du$:
$$
\begin{align}
I&= \int \dfrac{-d\omega}{\omega^2 + 1 } = \mbox{arccot}(\omega) + C
\end{align}
$$

*Returning to the variable x:
$$
\omega =\cot(u) + 1 = \cot\left(\dfrac{x}{2}\right) + 1 \quad\Rightarrow\quad I = \mbox{arccot}\left(\cot\left(\dfrac{x}{2}\right) + 1\right) + C
$$

With a little more effort and using the same procedure, you could solve the following generic integral:
$$
I = \int \dfrac{dx}{A+B\sin(x)+C\cos(x)}
$$
The secret to this is:


*

*In Step 2: choose the correct "known trigonometric expression" according to the signs of sine and cosine. 

*In Step 4: don't forget to remove the non-binomial term to reduce it to a simple expression.
A: You could write $2\sin(x)-\cos(x) = \sqrt{5} (\frac{2}{\sqrt{5}} \sin x - \frac{1}{\sqrt{5}} \cos x) = \sqrt{5} \sin (x - \alpha)$, with $\tan \alpha = \frac{1}{2}$, so that the required integral becomes $\int \dfrac{dx}{3 + \sqrt{5} \sin(x-\alpha)}$ and then change the integration variable from $x$ to $y = x - \alpha$. Your integral is then of the form $\int \dfrac{dy}{A + B\sin y}$ which is a bit easier to solve using standard methods.
A: With $a=\tan^{-1}\frac1{\sqrt5}$ and $t=\frac12(x+a)$
\begin{align}
\int\frac{dx}{3 + 2\sin x - \cos x}
& = \int \frac{dx}{3-\sqrt5\cos(x+a)}\\
&= \int \frac{2d(\tan^2t)}{(3-\sqrt5)+(3+\sqrt5)\tan^2t}=\tan^{-1} \frac{2\tan t}{3-\sqrt5} +C
\end{align}
