What is the correct way to approach $\int\frac{\cos x}{6+2\sin x-\cos^2x}dx$? I have $$\int\frac{\cos x}{6+2\sin x-\cos^2x}dx .$$
Online solvers have problems with it so what I need are some general guidelines on how to proceed with such as to whether do I need to apply some goniometric identity, or do I need to split it to partial fractions or such. Thanks very much for any help.
 A: $$\int \frac{\cos x}{6+2\sin x-\cos^2 x}\, dx=\int \frac{1}{6+2\sin x-\left(1-\sin^2 x\right)}\, d(\sin x)$$
Let $u=\sin x$.
$$=\int \frac{1}{u^2+2u+5}\, du=\int \frac{1}{(u+1)^2+4}\, d(u+1)$$
Let $2t=u+1$. Then $d(u+1)=2\, dt$.
$$=\frac{1}{2}\int \frac{1}{t^2+1}\, dt=\frac{1}{2}\arctan t+C=\frac{1}{2}\arctan \frac{\sin x+1}{2}+C$$
A: Hint : all integrals of the form $$\int\frac{P(\cos x,\sin x)}{Q(\cos x,\sin x)}\mathrm dx,$$
where $P$ and $Q$ are polynomials, can be computed using the change of variables
$t=\tan\frac x2$ that yields
$$\cos x=\frac{1-t^2}{1+t^2},\qquad\sin x=\frac{2t}{1+t^2},\qquad\mathrm dx=\frac{2}{1+t^2}\mathrm dt.$$
A: $$\int\frac{\cos(x)}{6+2\sin(x)-\cos^2(x)}\space\text{d}x=$$

Use $\cos^2(x)=1-\sin^2(x)$:

$$\int\frac{\cos(x)}{5+2\sin(x)+\sin^2(x)}\space\text{d}x=$$

Substitute $u=\sin(x)$ and $\text{d}u=\cos(x)\space\text{d}x$:

$$\int\frac{1}{u^2+2u+5}\space\text{d}u=$$
$$\int\frac{1}{(u+1)^2+4}\space\text{d}u=$$

Substitute $s=u+1$ and $\text{d}s=\text{d}u$:

$$\int\frac{1}{s^2+4}\space\text{d}s=$$
$$\int\frac{1}{4\left(\frac{s^2}{4}+1\right)}\space\text{d}s=$$
$$\frac{1}{4}\int\frac{1}{\frac{s^2}{4}+1}\space\text{d}s=$$

Substitute $p=\frac{s}{2}$ and $\text{d}p=\frac{1}{2}\space\text{d}s$:

$$\frac{1}{2}\int\frac{1}{p^2+1}\space\text{d}p=$$
$$\frac{\arctan\left(p\right)}{2}+\text{C}=$$
$$\frac{\arctan\left(\frac{s}{2}\right)}{2}+\text{C}=$$
$$\frac{\arctan\left(\frac{u+1}{2}\right)}{2}+\text{C}=$$
$$\frac{\arctan\left(\frac{\sin(x)+1}{2}\right)}{2}+\text{C}$$
