Evaluate the following integrals:
$\int \frac{\cos x}{\sqrt{\sin ^{2} x-2 \sin x-3}} d x$
Let $\sin x=t$
$\cos x d x=d t$
$\int \frac{\cos x}{\sqrt{\sin ^{2} x-2 \sin x-3}} d x=\int \frac{d t}{\sqrt{t^{2}-2 t-3}}$
Add and subtract $1^{2}$ in denominator
$=\int \frac{d t}{\sqrt{t^{2}-2 t-3}}=\int \frac{d t}{\sqrt{t^{2}-2 t+1^{2}-1^{2}-3}}=\int \frac{d t}{\sqrt{\left((t-1)^{2}-2^{2}\right)}}$
Let $t-1=u$
$\mathrm{dt}=\mathrm{du}$
$=\int \frac{d t}{\sqrt{\left((t-1)^{2}-2^{2}\right)}}=\int \frac{d t}{\sqrt{\left(u^{2}-2^{2}\right)}}$
Since, $\int \frac{1}{\sqrt{\left(x^{2}-a^{2}\right)}} d x=\log \left[x+\sqrt{\left(x^{2}-a^{2}\right)}\right]+c$
$=\int \frac{\mathrm{dt}}{\sqrt{\left(\mathrm{u}^{2}-2^{2}\right)}}=\log \left[\mathrm{u}+\sqrt{\mathrm{u}^{2}-4}\right]+\mathrm{c}$
Put $u=t-1$
$=\log \left[t-1+\sqrt{(t-1)^{2}-4}\right]+c$
Put $t=\sin x$'
$\begin{aligned}=\log [\mathrm{t}-1&\left.+\sqrt{(\mathrm{t}-1)^{2}-4}\right]+\mathrm{c} \\ &=\log \left[\sin \mathrm{x}-1+\sqrt{(\sin \mathrm{x}-1)^{2}-4}\right]+\mathrm{c} \end{aligned}$
$=\log \left[\sin x-1+\sqrt{\sin ^{2} x-2 \sin x-3}\right]+c$