<s>[INST] 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.
 [/INST] 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.
</s>