Indefinite Integral with "sin" and "cos": $\int\frac{3\sin(x) + 2\cos(x)}{2\sin(x) + 3\cos(x)} \; dx $

Solution 1:

It is a pity you did not have a minus-sign in the numerator, since $$ D\ln(3\cos x+2\sin x)=\frac{2\cos x-3\sin x}{3\cos x+2\sin x}, $$ but let us see how we can use this fact anyways.

Let us aim at writing $$ \frac{2\cos x+3\sin x}{3\cos x+2\sin x}=c_1 \frac{2\cos x-3\sin x}{3\cos x+2\sin x}+c_2 \frac{3\cos x+2\sin x}{3\cos x+2\sin x} $$ since both those terms are easy to integrate. This leads us to the linear equations $2=2c_1+3c_2$ and $3=-3c_1+2c_2$. The solution to this system is $c_1=-5/13$ and $c_2=12/13$. Thus $$ \int\frac{2\cos x+3\sin x}{3\cos x+2\sin x}\,dx = -\frac{5}{13}\int \frac{2\cos x-3\sin x}{3\cos x+2\sin x}\,dx +\frac{12}{13}\int \frac{3\cos x+2\sin x}{3\cos x+2\sin x}\,dx. $$ I guess you can take it from here?

Solution 2:

We can split this into two integrals:

$$3 \int \frac{\sin(x)}{2\sin(x)+3\cos(x)}dx + 2 \int \frac{\cos(x)}{2\sin(x)+3\cos(x)}dx.$$

Focusing on the second integral we find:

$$\int \frac{\cos(x)}{2\sin(x)+3\cos(x)}dx = \int \frac{1}{2\tan(x)+3}dx$$

Make the substitution $u=2\tan(x)+3$ which makes $$du = 2\sec^2(x)dx = 2(\tan^2(x)+1)dx = 2(u^2+1)dx.$$

Thus we have $$\int \frac{\cos(x)}{2\sin(x)+3\cos(x)}dx = \frac12 \int \frac{1}{u(u^2+1)} du = \frac12 \int \left(\frac{1}{u} - \frac{u}{u^2+1}\right) du.$$

This integral can be computed by another substitution:

$$\int \frac{\cos(x)}{2\sin(x)+3\cos(x)}dx=\frac12 \left(\ln|2\tan(x)+3| - \frac12 \ln|(2\tan(x)+3)^2+1|\right) + C.$$

That completes the second integral. The first can be handled in a similar manner.