Evaluate $\int \frac{\cos 2x \: dx}{3 \sin x+4 \cos x}$ Evaluate 

$$I=\int \frac{\cos 2x \: dx}{3 \sin x+4 \cos x}$$

My Try:
$$I=\int \frac{(\cos x-\sin x)(\cos x+\sin x)dx}{3 \sin x+4 \cos x}$$
we have $$\cos x-\sin x=\frac{1}{25}(3 \sin x+4 \cos x)+\frac{7}{25}(3 \cos x-4 \sin x)$$  and
$$\cos x+\sin x=\frac{7}{25}(3 \sin x+4 \cos x)+\frac{-1}{25}(3 \cos x-4 \sin x)$$
So
$$\cos 2x=\frac{7}{625}(3 \sin x+4 \cos x)^2+\frac{48}{625}\left((3 \sin x+4 \cos x)(3\cos x-4 \sin x)\right)-\frac{7}{625}(3 \cos x-4 \sin x)^2$$
So
$$I=\frac{7}{625}\int (3 \sin x+4 \cos x)dx+\frac{48}{625}\int (3 \cos x-4 \sin x)dx-J$$
where 
$$J=\frac{7}{625}\int \frac{(3 \cos x-4 \sin x)^2dx}{3 \sin x+4 \cos x}$$
I got stuck up to integrate $J$. 
 A: What about the following? Note that the denominator can be written as $$3 \sin x + 4 \cos x = 5 \sin (x + \theta)$$ where $\theta$ is easy to determine. The integral becomes $$I= \frac{1}{5} \int \frac{\cos 2x \: dx}{\sin (x + \theta)}.$$
Now change the variable of integration from $x$ to $y = x + \theta$ so that you now have to evaluate
$$I= \frac{1}{5} \int \frac{\cos (2y - 2 \theta) \: dy}{\sin y}$$ and use the expansion formula for $\cos (2 y - 2 \theta)$. Eventually you have to evaluate integrals of the form $ \int \frac{\cos 2 y}{\sin y} dy$ and $ \int \frac{\sin 2y}{\sin y} dy$ which are straight forward(?).
A: $$I=\int \frac{\cos 2x \: dx}{3 \sin x+4 \cos x} = \dfrac15\int \frac{\cos 2x \: dx}{\dfrac35 \sin x+\dfrac45 \cos x} = \dfrac15\int \frac{\cos 2x \: dx}{\cos(x - \alpha)}$$
Where $\alpha = \cos^{-1} \dfrac45$
$$\dfrac15\int \frac{\cos 2x \: dx}{\cos(x - \alpha)} = \dfrac15\int \frac{2\cos^2 x - 1 \: }{\cos(x - \alpha)}\ dx = \dfrac15\int \frac{2\cos^2 x  \: }{\cos(x - \alpha)}\ dx - \dfrac15\int \sec(x - \alpha) dx$$
Now for the first integral, let $u = x - \alpha$
$$\dfrac25\int \frac{\cos^2 (u + \alpha)  }{\cos(u)}\ du = \dfrac25\int \frac{(\cos u \cos \alpha - \sin u \sin \alpha)^2  }{\cos(u)}\ du \\= \dfrac25\int\frac{(\cos^2 u \cos^2 \alpha + \sin^2 u \sin^2 \alpha) + 2\sin \alpha \cos \alpha \sin u \cos u   }{\cos(u)}\ du\\=\dfrac25\int{\cos u \cos^2 \alpha}\ du + \dfrac25\int \frac{\sin^2 u \sin^2 \alpha}{\cos u} du+ \dfrac25\int {2\sin \alpha \cos \alpha \sin u   }{}\ du $$
The middle integral,
$$\dfrac25\int \frac{(1 -\cos^2 u) \sin^2 \alpha}{\cos u}\ du = \dfrac25\int{\sec u \sin^2 \alpha}\ du - \dfrac25\int \cos u \sin^2 \alpha \ du$$
So the answer is,
$$I = \dfrac25\int{\sec u \sin^2 \alpha}\ du - \dfrac25\int \cos u \sin^2 \alpha \ du + \dfrac25\int{\cos u \cos^2 \alpha}\ du + \dfrac25\int {2\sin \alpha \cos \alpha \sin u   }{}\ du -\dfrac15\int \sec(u) du$$ 
$$I = \dfrac25\sin^2 \alpha\int{\sec u }\ du + \dfrac25\cos (2\alpha)\int{\cos u }\ du + \dfrac25\sin (2\alpha)\int { \sin u   }{}\ du -\dfrac15\int \sec(u) du$$ 
A: Note that $$3\sin x+4\cos x=5\Big( \dfrac{3}{5}\sin x+\dfrac{4}{5}\cos x \Big)$$ and $$\cos2x=1-2\sin^2x$$
also $\arcsin(4/5)=\arccos(3/5)=0.92$
combining all this, your integral becomes $\frac{1}{5}\int \frac{1 -2\sin^2x\: dx}{\sin(x+0.92)}$.
From here, writing $x=(x+0.92)-0.92$ in numerator and basic integration formula for $\csc x$, $\cot x$ will work.
A: \begin{align}
Hint:(3\cos x-4\sin x)^2&=25-(3\sin x+4\cos x)^2\\
\int\frac{(3\cos x-4\sin x)^2}{3\sin x+4\cos x}dx&=\int\frac{25-(3\sin x+4\cos x)^2}{3\sin x+4\cos x}dx\\
&=25\int\frac{dx}{3\sin x+4\cos x}-\int(3\sin x+4\cos x)dx\\
&=25\int\frac{dx}{3\sin x-4+4(1+\cos x)}+3\cos x-4\sin x\\
&=25\int\frac{\frac{1}{1+\cos x}dx}{3\frac{\sin x}{1+\cos x}-4\frac{1}{1+\cos x}+4}+3\cos x-4\sin x\\
&=25\int\frac{d(\frac{\sin x}{1+\cos x})}{3\frac{\sin x}{1+\cos x}-2((\frac{\sin x}{1+\cos x})^2+1)+4}+3\cos x-4\sin x\\
&=25\int\frac{dt}{2+3t-2t^2}+3\cos x-4\sin x\\
&=25(\frac{1}{5}\ln \left|\frac{2t+1}{2-t}\right |)+3\cos x-4\sin x\\
&=5\ln \left|\frac{2\sin x+1+\cos x}{2(1+\cos x)-\sin x}\right |+3\cos x-4\sin x+C\\
\end{align}
A: HINT: set $$\sin(x)=2\,{\frac {\tan \left( x/2 \right) }{1+ \left( \tan \left( x/2
 \right)  \right) ^{2}}}
$$
$$\cos(x)={\frac {1- \left( \tan \left( x/2 \right)  \right) ^{2}}{1+ \left( 
\tan \left( x/2 \right)  \right) ^{2}}}
$$
your Integrand is given by $$-1/2\,{\frac { \left( {t}^{2}+2\,t-1 \right)  \left( {t}^{2}-2\,t-1
 \right) }{ \left( 2\,t+1 \right)  \left( t-2 \right)  \left( {t}^{2}+
1 \right) }}
$$ with $t=\tan(x/2)$
and don't Forget $$dx=\frac{2dt}{1+t^2}$$
