Integrating the trigonometric function So the problem goes as follows:-
$$\int{{\cos^2x+\sin2x}\over{(2\cos x-\sin x)^2}}~dx$$
My attempt is as follows:-
\begin{align*}\int{{\cos^2x+\sin2x}\over{(2\cos x-\sin x)^2}}~dx&=\int{{\cos^2x+2\sin x\cos x}\over{(2\cos x-\sin x)^2}}~dx\\
&=
\int{{(\cos x)(\cos x+2\sin x)}\over{(2\cos x-\sin x)^2}}~dx
\end{align*}
Now i could see that $\cos x+2\sin x $ is $-1$ times derivative of the denominator:-
$$\cos x+2\sin x=(-1){{d(2\cos x-\sin x)}\over{dx}}$$
And to handle the $\cos x$ term in the numerator i tried the following:-
$$2\cos x=t+\sin x \implies \cos x={{t+\sin x}\over{2}}$$
But the $\sin x$ term in the numerator is annoying.   
 A: Note that
$$\begin{aligned}
\displaystyle \int \frac{\sin \left ( 2x \right )  + \cos^2 \left ( x \right ) }{ \left ( \sin \left ( x \right )  - 2 \cos \left ( x \right )  \right ) ^2} \; \mathrm{d}x 
&= \displaystyle \int \frac{2 \tan \left ( x \right )  + 1}{ \left ( \tan \left ( x \right )  - 2 \right ) ^2} \; \mathrm{d}x\\
\end{aligned}$$
by dividing by $\cos^2 \left ( x \right ) $ on numerator and denominator. If we let $u = \tan \left ( x \right ) $, $\mathrm{d}u = \sec^2 \left ( x \right )  \; \mathrm{d}x \implies \mathrm{d}x = \frac{\mathrm{d}u}{u^2+1}$, we get
$$\begin{aligned}
\displaystyle \int \frac{2 \tan \left ( x \right )  + 1}{ \left ( \tan \left ( x \right )  - 2 \right ) ^2} \; \mathrm{d}x 
&= \displaystyle \int \frac{2u+1}{ \left ( u - 2 \right ) ^2 \left ( u^2 + 1 \right ) } \; \mathrm{d}u\\
&= \displaystyle \int \frac{2u-1}{5 \left ( u^2 + 1 \right ) } - \frac{2}{5 \left ( u-2 \right ) } + \frac{1}{ \left ( u-2 \right ) ^2} \; \mathrm{d}u\\
&= \frac{1}{5} \ln \left ( u^2 + 1 \right )  - \frac{1}{5} \tan^{-1} \left ( u \right )  - \frac{2}{5} \ln \left ( u - 2 \right )  - \frac{1}{u - 2} + C\\
&= \frac{1}{5} \ln \left ( \sec^2 \left ( x \right )  \right )  - \frac{x}{5} - \frac{2}{5} \ln \left | \tan \left ( x \right )  - 2 \right | - \frac{1}{\tan \left ( x \right )  - 2} + C
\end{aligned}$$
A: Integrate by parts
With $v=\dfrac{\cos x+2\sin x}{(2\cos x-\sin x)^2}=\dfrac{d(2\cos x-\sin x)^{-1}}{dx}$
the required integration $$=\cos x\int v\ dx-\int\left(\dfrac{d(\cos x)}{dx}\cdot \int v\ dx\right)$$
Finally for $\int\dfrac{a\cos x+b\sin x}{c\sin x+d\sin x)}dx,$
write $a\cos x+b\sin x=p(c\sin x+d\cos x)+q\cdot\dfrac{d(c\sin x+d\cos x)}{dx}$
Can you identify $a,b,c,d$ here and find $p,q$
A: Recall that $\int -{f'\over f^2} dx= {1\over f}+C$, setting $f(x)=2 \cos x-\sin x $ your integral is ${1\over 2 \cos x-\sin x}$
