Evaluate $\displaystyle \int \dfrac{dx}{3 + 2 \sin x + \cos x}$
Let $I = \displaystyle \int \dfrac{dx}{3 + 2 \sin x + \cos x}$ $\;\;\; \cdots$ (1)
Put $\tan \left(\dfrac{x}{2}\right) = t$ $\;\;\; \cdots$ (2a)
Then, $\dfrac{1}{2} \sec^2 \left(\dfrac{x}{2}\right) \; dx = dt$
$\implies$ $dx = \dfrac{2 \; dt}{\sec^2 \left(\dfrac{x}{2}\right)} = \dfrac{2 \; dt}{1 + \tan^2 \left(\dfrac{x}{2}\right)} = \dfrac{2 \; dt}{1 + t^2}$ $\;\;\; \cdots$ (2b)
Also, $\sin x = \dfrac{2 \; \tan \left(\dfrac{x}{2}\right)}{1 + \tan^2 \left(\dfrac{x}{2}\right)} = \dfrac{2 \; t}{1 + t^2}$ $\;\;\; \cdots$ (2c)
and $\cos x = \dfrac{1 - \tan^2 \left(\dfrac{x}{2}\right)}{1 + \tan^2 \left(\dfrac{x}{2}\right)} = \dfrac{1 - t^2}{1 + t^2}$ $\;\;\; \cdots$ (2d)
$\therefore$ $\;$ In view of equations (2b), (2c) and (2d), equation (1) becomes
$\begin{aligned}
I & = 2 \displaystyle \int \dfrac{dt}{\left(1 + t^2\right) \left(3 + \dfrac{4t}{1 + t^2} + \dfrac{1 - t^2}{1 + t^2}\right)} \\\\
& = 2 \int \dfrac{dt}{3 + 3 t^2 + 4 t + 1 - t^2} \\\\
& = 2 \int \dfrac{dt}{2 t^2 + 4 t + 4} \\\\
& = \int \dfrac{dt}{t^2 + 2 t + 2} \\\\
& = \int \dfrac{dt}{\left(t^2 + 2 t + 1\right) + 1} \\\\
& = \int \dfrac{dt}{\left(t + 1\right)^2 + \left(1\right)^2} \\\\
& = \tan^{-1} \left(t + 1\right) + c \;\;\; \cdots (3) \;\; \left[\text{Note: } \int \dfrac{dx}{x ^2 + a^2} = \dfrac{1}{a} \tan^{-1} \left(\dfrac{x}{a} + c\right) \right]
\end{aligned}$
Substituting the value of t from equation (2a) in equation (3) gives
$I = \tan^{-1} \left[\tan \left(\dfrac{x}{2}\right) + 1 \right] + c$