Indefinite Integral with "sin" and "cos": $\int\frac{3\sin(x) + 2\cos(x)}{2\sin(x) + 3\cos(x)} \; dx $ Indefinite Integral with sin/cos
I can't find a good way to integrate: $$\int\dfrac{3\sin(x) + 2\cos(x)}{2\sin(x) + 3\cos(x)} \; dx $$
 A: ![The method I was speaking of if anyone especially OP is interested.... ][1]
[1]: http://i.stack.imgur.com/r05sp.jpg  $$
\text{ Let there be a right triangle with angle A (not with measurement 90 deg) } \\ 
\text{  whose adjacent has measurement }  3 \text{ and whose opposite has measurement } 2. \\ 
\text{ Therefore the  hypotenuse of the triangle has measurement } \sqrt{13}. \\
\text{ So this means } \sin(A)=\frac{2}{\sqrt{13}} \text{ and } \cos(A)=\frac{3}{\sqrt{13}} . \\  \text{  } \\ \text{  } \\ 
3 \sin(x)+2 \cos(x)=\sqrt{13}(\frac{3}{\sqrt{13}} \sin(x)+\frac{2}{\sqrt{13}} \cos(x)) \\  
=\sqrt{13}(\cos(A) \sin(x)+\sin(A) \cos(x)) =\sqrt{13} \sin(x+A) \\ \text{   } \\ \text{   } 
  2 \sin(x)+3 \cos(x)  = \sqrt{13}(\frac{2}{\sqrt{13}} \sin(x)+\frac{3}{\sqrt{13}} \cos(x))  \\  \text{   } \\ \text{   }
=\sqrt{13}(\sin(A) \sin(x)+\cos(A) \cos(x)) =\sqrt{13} \cos(x-A) \\  
\text{… } \\
\int \frac{ 3 \sin(x)+2 \cos(x)}{  2 \sin(x)+3 \cos(x)   } dx= \int \frac{\sqrt{13} \sin(x+A)   }{\sqrt{13} \cos(x-A)   } dx \\
=\int \frac{ \sin(x-A+2A)} {\cos(x-A)} dx=\int \frac{ \sin(x-A) \cos(2A)+ \sin(2A) \cos(x-A)}{\cos(x-A)} dx \\ =\cos(2A) \int \frac{ \sin(x-A)}{\cos(x-A)} dx+ \sin(2A) \int \frac{\cos(x-A)}{\cos(x-A)} dx\\ 
=(\cos^2(A)-\sin^2(A)) \int \frac{\sin(x-A)}{\cos(x-A)} dx+2 \sin(A) \cos(A) \int 1 dx \\ 
=((\frac{3}{\sqrt{13}})^2-(\frac{2}{\sqrt{13}})^2) \int \frac{-du}{u} +2 \frac{2}{\sqrt{13}}  \frac{3}{\sqrt{13}} x +C \\ 
\text{ (note: where } u=\cos(x-A) \text{ and so } du=-\sin(x-A) dx \text{ ) } \\
=(\frac{9}{13}-\frac{4}{13}) (- \ln|u|)+\frac{12}{13} x+C \\ 
=- \frac{5}{13} \ln|\cos(x-A)| +\frac{12}{13}x+C \\ 
=-\frac{5}{13} \ln|\cos(x) \cos(A)+\sin(x) \sin(A)|+\frac{12}{13}x+C \\
=-\frac{5}{13} \ln|\cos(x) \frac{3}{\sqrt{13}}+ \sin(x) \frac{2}{\sqrt{13}}|+\frac{12}{13}x+C \\ 
=-\frac{5}{13} \ln| \frac{1}{\sqrt{13}} (3 \cos(x)+2  \sin(x))| +\frac{12}{13}x+C \\ 
=-\frac{5}{13} \ln|\frac{1}{\sqrt{13}}|-\frac{5}{13} \ln|3 \cos(x)+2 \sin(x)|+\frac{12}{13}x+C \\ 
=-\frac{5}{13} \ln|3 \cos(x)+2 \sin(x)|+\frac{12}{13}x-\frac{5}{13} \ln|\frac{1}{\sqrt{13}}|+C \\ 
=-\frac{5}{13} \ln|3 \cos(x)+2 \sin(x)|+\frac{12}{13}x+K \\ 
$$
A: 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.
A: Use this trigonometric identity:
$$
\frac{3\sin x+2\cos x}{2\sin x+3\cos x} = \overbrace{\frac{12}{13} + \frac5{13}\tan\left( x - \varphi \right)}^{\text{So integrate this function.}} \text{ where }\varphi = \arctan\frac 2 3.
$$
NOTE: I initially mislaid the denominator in $5/13$ and just had $5$ as the coefficient.  @robjohn pointed out the error in comments below.
Proof: The graph looks like a tangent function with period $\pi$ except that the inflection point is higher than the $x$-axis and the asymptotes are not at $\pm\pi/2$.  The asymptotes occur where the denominator is $0$, so at those points $2\sin x+3\cos x=0$, so $\tan x = -3/2$.  Hence the inflection points are at
$$
\frac\pi2 -\arctan\frac 3 2 = \arctan\frac 2 3.
$$
We have
$$
\frac{3\sin x+2\cos x}{2\sin x+3\cos x} = \frac{3\tan x + 2}{2\tan x + 3}
$$
and when $\tan x = \dfrac 2 3$ this simplifies to $\dfrac{12}{13}$.  So we want
$$
\frac {12}{13} + c\tan(x-\varphi) = \frac{12}{13} + c\frac{\tan x - \frac 2 3}{1+ \frac 2 3 \tan x} = \frac {12}{13} + c\frac{3\sin x - 2\cos x}{3\cos x + 2\sin x}.
$$
We need to find the value of $c$ for which we get the right function, and a bit of algebra tells us $c=5/13$.
A: 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?
A: HINT: One way is to use /reduce half angle tan formulas like $  \cos(x) = \dfrac{1-t^2}{1+t^2}$ with $dx. $
A: $$\int \frac{3\sin(x)+2\cos(x)}{2\sin(x)+ 3\cos(x)} \, dx$$
Multiply top and bottom by $\sec^{3}(x)$
\begin{align}
& \int \frac{3\tan(x)\sec^2(x)+2\sec^2(x)}{2\tan(x)\sec^2(x)+ 3\sec^2(x)} dx \\[10pt]
& \int \frac{(3\tan(x)+2)\sec^2(x)}{(2\tan(x)+ 3)\sec^2(x)} \, dx \\[10pt]
& \int \frac{(3\tan(x)+2)\sec^2(x)}{(2\tan(x)+ 3)(\tan^2(x)+1)} \, dx
\end{align}
Substitute $u = \tan(x)$ and $du = \sec^2(x)dx$
$$\int \frac{3u+2}{(2u+3)(u^2+1)}du$$
Use partial fractions to write 
$$\int \left(\frac{5u+12}{13(u^2+1)}-\frac{10}{13(2u+3)}\right) \, du$$
$$\frac{1}{13}\int \left(\frac{5u}{u^2+1} + \frac{12}{u^2+1}-\frac{10}{2u+3}\right) \, du$$
for first term, substitute $s = u^2+1$ and $ds = 2u \, du$
$$\frac{1}{13}\int \left(\frac{5}{2s} + \frac{12}{u^2+1}-\frac{10}{2u+3}\right) \, du$$
the integral of $\frac{1}{s} = \ln s$ and the integral of $\frac{1}{u^2+1} = \tan^{-1}u$ turns it into
$$\frac{1}{13} \left(\frac{5\ln s}{2} + 12 \tan^{-1}u- \int \frac{10}{2u+3} \, du\right)$$
Substitute $p=2u+3$ and $dp = 2 \, du$
$$\frac{1}{13}(\frac{5\ln s}{2} + 12 \tan^{-1}u- \int \frac{5}{p} \, dp)$$
$$\frac{1}{13}(\frac{5\ln s}{2} + 12 \tan^{-1}u- 5\ln p)$$
Substituting back for $s = u^2 +1$ and $p = 2u+3$ and $u=\tan(x)$
$$\frac{1}{13} \left(\frac{5\ln (\tan^2(x)+1)}{2} + 12 \tan^{-1}(\tan(x))- 5\ln{(2\tan x+3)}\right)$$
$$\frac{1}{13}(\frac{5\ln (\sec^2(x))}{2} + 12x- 5\ln{(2\tan x+3)})$$
$$\frac{1}{13}(5\ln (\sec(x)) + 12x- 5\ln{(2\tan x+3)})$$
$$= \frac{1}{13}(12x - 5\ln{(2\sin(x)+3\cos(x))}) + \text{constant}$$
A: Use Technique:
$$Numerator=A(diff(denominator))+B(denominator)$$
This will solve your issue for sure. 
