Evaluate the following integrals:
Question:

Evaluate the following integrals:

$\int \frac{1}{3+2 \sin x+\cos x} d x$

Solution:

Given $I=\int \frac{1}{3+2 \sin x+\cos x} d x$

We know that $\sin x=\frac{2 \tan \frac{x}{2}}{1+\tan ^{2} \frac{x}{2}}$ and $\cos x=\frac{1-\tan \frac{2}{2}}{1+\tan \frac{2}{2}}$

$\Rightarrow \int \frac{1}{3+2 \sin x+\cos x} d x=\int \frac{1}{3+2\left(\frac{2 \tan \frac{x}{2}}{1+\tan ^{2} \frac{x}{2}}\right)+\frac{1-\tan ^{2} \frac{x}{2}}{1+\tan ^{2} \frac{x}{2}}} d x$

$=\int \frac{1+\tan ^{2} \frac{x}{2}}{3+3 \tan ^{2} \frac{x}{2}+4 \tan \frac{x}{2}+1-\tan ^{2} \frac{x}{2}} d x$

Replacing $1+\tan ^{2} x / 2$ in numerator by $\sec ^{2} x / 2$ and putting $\tan x / 2=t$ and $\sec ^{2} x / 2 d x=2 d t$,

$\Rightarrow \int \frac{1+\tan ^{2} \frac{x}{2}}{3+3 \tan ^{2} \frac{x}{2}+4 \tan \frac{x}{2}+1-\tan ^{2} \frac{x}{2}} d x=\int \frac{\sec ^{2} \frac{x}{2}}{2 \tan ^{2} \frac{x}{2}+4 \tan \frac{x}{2}+4} d x$

$=\int \frac{2 d t}{2 t^{2}+4 t+4}$

$=\int \frac{1}{t^{2}+2 t+2} d t$

$=\int \frac{1}{(t+1)^{2}+1^{2}} d t$

We know that $\int \frac{1}{1+x^{2}} d x=\tan ^{-1} x+c$

$\Rightarrow \int \frac{1}{(\mathrm{t}+1)^{2}+1^{2}} \mathrm{dt}=\tan ^{-1}(\mathrm{t}+1)+\mathrm{c}$

$=\tan ^{-1}\left(\tan \frac{\mathrm{x}}{2}+1\right)+\mathrm{c}$

$\therefore I=\int \frac{1}{3+2 \sin x+\cos x} d x=\tan ^{-1}\left(\tan \frac{x}{2}+1\right)+c$