<s>[INST] Integrate $\int\frac{2\cos x-\sin x}{3\sin x+5\cos x }\,dx$ How can I evaluate this integral $$\int\dfrac{2\cos x-\sin x}{3\sin x+5\cos x } \mathop{dx}$$
I tried using the half angle formula
$$\sin x=\dfrac{2\tan\dfrac x2}{1+\tan^2\dfrac x2}, \cos x=\dfrac{1-\tan^2\dfrac x2}{1+\tan^2\dfrac x2}$$
substituted and simplified I got
$$\int\dfrac{2-2\tan^2\dfrac{x}{2}-2\tan\dfrac{x}{2}}{5\tan^2\dfrac{x}{2}+6\tan\dfrac{x}{2}-5}dx$$
substituted $\tan^2\dfrac x2=\sec^2\dfrac x2-1$
$$\int\dfrac{4-2\sec^2\dfrac{x}{2}-2\tan\dfrac{x}{2}}{5\left(\tan\dfrac{x}{2}+\dfrac{3}{5}\right)^2-\dfrac{34}{5}}dx$$
I can't eliminate $\tan\frac x2$ term in numerator. I think I am not in right direction. your help to solve this integral is appreciated. thank in advance
 [/INST] The trick that I use for solving integrals with $\sin{x}$ and $\cos{x}$ with varying coefficients in the numerator and denominator as follows.
For your integral, consider the two easy integrals:
\begin{align*}
\int \frac{3\sin{x}+5\cos{x}}{3\sin{x}+5\cos{x}} \; \mathrm{d}x&=x+\mathrm{C}\\
\int \frac{ 3\cos{x}-5\sin{x}}{3\sin{x}+5\cos{x}} \; \mathrm{d}x&=\ln{\big | 3\sin{x}+5\cos{x} \big |}+\mathrm{C}\\ \end{align*}
Now, set up a system of equations as the following:
$$\int \frac{2\cos{x}-\sin{x}}{3\sin{x}+5\cos{x}} \; \mathrm{d}x=\int \mathrm{A}\left(\frac{3\sin{x}+5\cos{x}}{3\sin{x}+5\cos{x}}\right) +\mathrm{B} \left(\frac{ 3\cos{x}-5\sin{x}}{3\sin{x}+5\cos{x}}\right)\; \mathrm{d}x$$
Such that,
$$2\cos{x}=5\mathrm{A}\cos{x}+3\mathrm{B}\cos{x}$$
$$-\sin{x}=3\mathrm{A}\sin{x}-5\mathrm{B}\sin{x}$$
$$ \mathrm{A}=\frac{7}{34}  \; \text{and} \; \mathrm{B}=\frac{11}{34}$$
$$\int \frac{2\cos{x}-\sin{x}}{3\sin{x}+5\cos{x}} \; dx=\int \frac{7}{34}\left(\frac{3\sin{x}+5\cos{x}}{3\sin{x}+5\cos{x}}\right) +\frac{11}{34} \left(\frac{ 3\cos{x}-5\sin{x}}{3\sin{x}+5\cos{x}}\right)\; \mathrm{d}x$$
$$\boxed{\int \frac{2\cos{x}-\sin{x}}{3\sin{x}+5\cos{x}} \; dx=\frac{7x}{34}+\frac{11\ln{\big | 3\sin{x}+5\cos{x} \big |}}{34}+\mathrm{C}}$$
</s>