Evaluate the integral $\int \frac{dx}{2 \sin x - \cos x + 5}$ I'm trying to evaluate the following integral:
$$ \int \frac{dx}{2 \sin x - \cos x + 5}.$$
This is in a set of exercises following a chapter on partial fractions, so I imagine there is a substitution we can make to get this into a rational function where we can use partial fraction decomposition.  I can't seem to figure out what substitution to make in such a situation though.
 A: The standard substitution is $t=\tan\frac{x}{2}$, because
$$
\sin x=\frac{2t}{1+t^2},\quad
\cos x=\frac{1-t^2}{1+t^2},\quad
dx=\frac{2}{1+t^2}\,dt
$$
so your integral becomes
$$
\int\frac{1+t^2}{4t-1+t^2+5+5t^2}\frac{2}{1+t^2}\,dt=
\int\frac{1}{3t^2+2t+2}\,dt=
\int\frac{3}{(3t+1)^2+5}\,dt
$$
that you can compute with the further substitution $3t+1=u\sqrt{5}$.
A: Notice, $$\int \frac{1}{2\sin x-\cos x+5}\ dx$$
$$=\int \frac{1}{2\frac{2\tan\frac{x}{2}}{1+\tan^2\frac{x}{2}}-\frac{1-\tan^2\frac{x}{2}}{1+\tan^2\frac{x}{2}}+5}\ dx$$
$$=\int \frac{1+\tan^2\frac{x}{2}}{6\left(\tan^2\frac{x}{2}+\frac{2}{3}\tan\frac{x}{2}+\frac{2}{3}\right)}\ dx$$
$$=\int \frac{\sec^2\frac{x}{2}}{6\left(\left(\tan\frac{x}{2}+\frac{1}{3}\right)^2+\frac{5}{9}\right)}\ dx$$
$$=\frac{2}{6}\int \frac{d\left(\tan\frac{x}{2}+\frac{3}{2}\right)}{\left(\tan\frac{x}{2}+\frac{1}{3}\right)^2+\left(\frac{\sqrt 5}{3}\right)^2}$$
$$=\frac{1}{3}\frac{3}{\sqrt 5}\tan^{-1}\left(\frac{\tan\frac{x}{2}+\frac{1}{3}}{\frac{\sqrt 5}{3}}\right)+C$$
$$\bbox[5px, border:2px solid #C0A000]{\color{blue}{\int \frac{1}{2\sin x-\cos x+5}\ dx=\frac{1}{\sqrt 5}\tan^{-1}\left(\frac{3\tan\frac{x}{2}+1}{\sqrt 5}\right)+C}}$$
