Evaluate the following integrals:
$\int \frac{1}{\sin ^{2} x+\sin 2 x} d x$
Given $I=\int \frac{1}{\sin ^{2} x+\sin 2 x} d x$
We know that $\sin 2 x=2 \sin x \cos x$
$\Rightarrow I=\int \frac{1}{\sin ^{2} x+2 \sin x \cos x} d x$
Dividing numerator and denominator by $\cos ^{2} x$,
$\Rightarrow \int \frac{1}{\sin ^{2} x+2 \sin x \cos x} d x=\int \frac{\sec ^{2} x}{\tan ^{2} x+2 \tan x} d x$
Putting $\tan x=t$ so that $\sec ^{2} x d x=d t$,
$\Rightarrow \int \frac{\sec ^{2} x}{\tan ^{2} x+2 \tan x} d x=\int \frac{d t}{t^{2}+2 t}$
$=\int \frac{1}{t^{2}+2 t+1^{2}-1^{2}} d t$
$=\int \frac{1}{(t+1)^{2}-1^{2}} d t$
We know that $\int \frac{1}{x^{2}-a^{2}} d x=\frac{1}{2 a} \log \left|\frac{x-a}{x+a}\right|+c$
$\Rightarrow \int \frac{1}{(t+1)^{2}-1^{2}} d t=\frac{1}{2} \log \left|\frac{t+1-1}{t+1+1}\right|+c$
$=\frac{1}{2} \log \left|\frac{\mathrm{t}}{\mathrm{t}+2}\right|+\mathrm{c}$
$=\frac{1}{2} \log \left|\frac{\tan \mathrm{x}}{\tan \mathrm{x}+2}\right|+\mathrm{c}$
$\therefore \mathrm{I}=\int \frac{1}{\sin ^{2} \mathrm{x}+\sin 2 \mathrm{x}} \mathrm{dx}=\frac{1}{2} \log \left|\frac{\tan \mathrm{x}}{\tan \mathrm{x}+2}\right|+\mathrm{c}$