<s>[INST] 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.
 [/INST] 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}}$$
</s>